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.

MCP servers are configured in ~/.cosine/mcp.json:

{
"mcpServers": {
"filesystem": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/projects"]
}
}
}
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]

MCP servers are configured in:

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

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", "sse", or "streamable". 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 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
}
}
}