Skip to content

MCP Configuration

The Model Context Protocol (MCP) is an open standard that allows Cosine CLI to connect with external tools, APIs, and data sources. Think of MCP as a USB-C port for AI applications—providing a standardized way to plug in capabilities like database access, file system operations, API integrations, and more.

MCP (Model Context Protocol) is an open-source standard developed by Anthropic that enables secure, two-way connections between AI applications and external systems. With MCP, you can:

  • Access databases - Query PostgreSQL, MySQL, or any database with an MCP server
  • Interact with APIs - Connect to GitHub, Slack, Jira, or custom APIs
  • File system operations - Read and write files in controlled directories
  • Browser automation - Control browsers through specialized MCP servers
  • Custom integrations - Build your own MCP servers for proprietary tools

When you configure an MCP server in Cosine CLI:

  1. The CLI starts and manages the MCP server process
  2. Cosine discovers the tools (functions) exposed by the server
  3. When relevant, Cosine can call these tools to perform actions
  4. All tool executions require your approval (unless using --auto-accept)

MCP servers run locally on your machine and communicate with Cosine through standardized protocols.

For most users, the easiest way to add an MCP server is with cos mcp add.

If you already use Claude Code, the workflow is the same: replace claude with cos.

Terminal window
cos mcp add --transport http stripe https://mcp.stripe.com/

For local stdio servers, place -- between the server name and the command you want Cosine to run:

Terminal window
cos mcp add -e API_KEY=xxx my-server -- npx my-mcp-server
Terminal window
cos start

Cosine will automatically discover and connect to your configured MCP servers.

Once connected, Cosine can use the MCP tools:

You: List all files in my projects directory
Cosine: I'll list the files for you. [Uses mcp_filesystem tool]

Use cos mcp add when you want Cosine to save the server for future sessions. The command writes the server configuration to ~/.cosine/mcp.json for you.

Terminal window
cos mcp add --transport http stripe https://mcp.stripe.com/
Terminal window
cos mcp add --transport http corridor \
https://app.corridor.dev/api/mcp \
--header "Authorization: Bearer ..."
Terminal window
cos mcp add my-server -- npx -y my-mcp-server

Add a Local stdio Server with Environment Variables

Section titled “Add a Local stdio Server with Environment Variables”
Terminal window
cos mcp add --transport stdio -e API_KEY=xxx airtable \
-- npx -y airtable-mcp-server
  • Put Cosine’s flags before the server name
  • Use -- before the command for stdio servers
  • Use --header for remote HTTP headers
  • Use --env or -e for stdio server environment variables

For example:

  • cos mcp add --transport http stripe https://mcp.stripe.com/
  • cos mcp add --transport stdio my-server -- python server.py --port 8080

If you prefer, you can still edit ~/.cosine/mcp.json manually.

For example:

{
"mcpServers": {
"filesystem": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/projects"]
}
}
}

MCP servers are configured in:

  • macOS/Linux: ~/.cosine/mcp.json
  • Windows: %USERPROFILE%\.cosine\mcp.json

cos mcp add writes to the same file.

Cosine CLI supports two transport protocols:

Best for: Local tools, command-line utilities, file system access

The stdio transport spawns the MCP server as a subprocess and communicates over standard input/output.

{
"mcpServers": {
"filesystem": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/pz/projects"]
}
}
}
FieldTypeRequiredDescription
transportstringNoTransport type: "stdio" or "http". Auto-detected if not specified.
disabledbooleanNoSet to true to disable this server temporarily.
FieldTypeRequiredDescription
commandstringYesThe executable to run (e.g., npx, node, python, uv).
argsarrayNoArguments passed to the command.
envobjectNoEnvironment variables as key-value pairs.
FieldTypeRequiredDescription
urlstringYesThe HTTP endpoint URL for the MCP server.

In the terminal user interface (TUI), you can see the status of all MCP servers:

  1. Press Ctrl+J to open the command palette
  2. Select “MCP servers”
  3. View the list of configured servers with their status indicators

If an MCP server becomes unresponsive:

  1. Open the command palette with Ctrl+J
  2. Select “MCP servers”
  3. Select “Restart MCP servers”

To temporarily disable a server without removing it:

{
"mcpServers": {
"github": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"disabled": true
}
}
}