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.
What is MCP?
Section titled “What is MCP?”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
How MCP Works in Cosine CLI
Section titled “How MCP Works in Cosine CLI”When you configure an MCP server in Cosine CLI:
- The CLI starts and manages the MCP server process
- Cosine discovers the tools (functions) exposed by the server
- When relevant, Cosine can call these tools to perform actions
- All tool executions require your approval (unless using
--auto-accept)
MCP servers run locally on your machine and communicate with Cosine through standardized protocols.
Quick Start
Section titled “Quick Start”1. Create the Configuration File
Section titled “1. Create the Configuration File”MCP servers are configured in ~/.cosine/mcp.json:
{ "mcpServers": { "filesystem": { "transport": "stdio", "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/projects"] } }}2. Start Cosine
Section titled “2. Start Cosine”cos startCosine will automatically discover and connect to your configured MCP servers.
3. Use MCP Tools
Section titled “3. Use MCP Tools”Once connected, Cosine can use the MCP tools:
You: List all files in my projects directoryCosine: I'll list the files for you. [Uses mcp_filesystem tool]Configuration File Location
Section titled “Configuration File Location”MCP servers are configured in:
- macOS/Linux:
~/.cosine/mcp.json - Windows:
%USERPROFILE%\.cosine\mcp.json
Transport Types
Section titled “Transport Types”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"] } }}Best for: Remote services, web APIs, already-running servers
The streamable HTTP transport connects to an MCP server running as a web service.
{ "mcpServers": { "remote-api": { "transport": "streamable", "url": "http://localhost:3000/mcp" } }}Configuration Fields
Section titled “Configuration Fields”Common Fields
Section titled “Common Fields”| Field | Type | Required | Description |
|---|---|---|---|
transport | string | No | Transport type: "stdio", "sse", or "streamable". Auto-detected if not specified. |
disabled | boolean | No | Set to true to disable this server temporarily. |
stdio Transport Fields
Section titled “stdio Transport Fields”| Field | Type | Required | Description |
|---|---|---|---|
command | string | Yes | The executable to run (e.g., npx, node, python, uv). |
args | array | No | Arguments passed to the command. |
env | object | No | Environment variables as key-value pairs. |
HTTP Transport Fields
Section titled “HTTP Transport Fields”| Field | Type | Required | Description |
|---|---|---|---|
url | string | Yes | The HTTP endpoint URL for the MCP server. |
Managing MCP Servers
Section titled “Managing MCP Servers”Viewing Server Status
Section titled “Viewing Server Status”In the TUI, you can see the status of all MCP servers:
- Press
Ctrl+Jto open the command palette - Select “MCP servers”
- View the list of configured servers with their status indicators
Restarting Servers
Section titled “Restarting Servers”If an MCP server becomes unresponsive:
- Open the command palette with
Ctrl+J - Select “MCP servers”
- Select “Restart MCP servers”
Disabling Servers
Section titled “Disabling Servers”To temporarily disable a server without removing it:
{ "mcpServers": { "github": { "transport": "stdio", "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"], "disabled": true } }}Next Steps
Section titled “Next Steps”- MCP Examples - See example configurations for popular MCP servers
- MCP Server Management - Learn about managing and troubleshooting MCP servers
- Configuration - Learn about general CLI configuration