MCP (Model Context Protocol) is an open protocol for tool interoperability with AI models. ChatCLI integrates with MCP servers, allowing the AI to access external tools such as file systems, web searches, databases, and any compatible service.
Overview
ChatCLI <-> MCP Manager <-> MCP Server (stdio/SSE)
|
External tools
(filesystem, search, DB, ...)
Load configuration
The MCP Manager loads the MCP server configuration.
Start servers
Starts the configured servers (stdio or SSE).
Discover tools
Discovers the available tools on each server.
Expose to the model
Exposes the tools to the AI model as ToolDefinition.
Route calls
Routes tool calls to the correct server.
Configuration
Configuration File
Create ~/.chatcli/mcp_servers.json:
{
"mcpServers": [
{
"name": "filesystem",
"transport": "stdio",
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-filesystem", "/workspace"],
"enabled": true
},
{
"name": "web-search",
"transport": "sse",
"url": "http://localhost:8080/sse",
"enabled": true
},
{
"name": "database",
"transport": "stdio",
"command": "/usr/local/bin/mcp-postgres",
"args": ["--connection-string", "postgresql://localhost/mydb"],
"env": {
"PGPASSWORD": "secret"
},
"enabled": true
}
]
}
Environment Variables
CHATCLI_MCP_ENABLED=true
CHATCLI_MCP_CONFIG=~/.chatcli/mcp_servers.json
Via Server Flag
chatcli server --mcp-config ~/.chatcli/mcp_servers.json
Transports
stdio
SSE (Server-Sent Events)
The stdio transport starts a local process and communicates via stdin/stdout using JSON-RPC 2.0:{
"name": "filesystem",
"transport": "stdio",
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-filesystem", "/workspace"]
}
Use case: Local servers distributed as npm packages, standalone binaries, or scripts. The sse transport connects to a remote HTTP server via Server-Sent Events:{
"name": "remote-tools",
"transport": "sse",
"url": "http://mcp-server:8080/sse"
}
Use case: Remote servers, microservices, shared network tools.
MCP tools are automatically prefixed with mcp_ and receive a description from the source server:
Original name: read_file
Name in ChatCLI: mcp_read_file
Description: [MCP:filesystem] Reads a file from the filesystem
The mcp_ prefix prevents collisions with ChatCLI’s native tools.
Deploy via Helm
Inline MCP Servers
Existing ConfigMap
# values.yaml
mcp:
enabled: true
servers:
- name: filesystem
transport: stdio
command: npx
args: ["-y", "@anthropic/mcp-server-filesystem", "/workspace"]
enabled: true
mcp:
enabled: true
existingConfigMap: "my-mcp-config"
The Helm chart automatically creates a ConfigMap with the mcp_servers.json and mounts it at /etc/chatcli/mcp/.
Checking Status
The MCP Manager exposes the status of each server:
statuses := mcpMgr.GetServerStatus()
for _, s := range statuses {
fmt.Printf("Server: %s, Connected: %v, Tools: %d\n",
s.Name, s.Connected, s.ToolCount)
}
To check if a tool is MCP:
if mcpMgr.IsMCPTool("mcp_read_file") {
result, err := mcpMgr.ExecuteTool(ctx, "read_file", args)
}
Popular MCP Servers
| Server | Description | Installation |
|---|
@anthropic/mcp-server-filesystem | File system access | npx -y @anthropic/mcp-server-filesystem /path |
@anthropic/mcp-server-github | GitHub integration | npx -y @anthropic/mcp-server-github |
@anthropic/mcp-server-postgres | PostgreSQL queries | npx -y @anthropic/mcp-server-postgres |
@anthropic/mcp-server-slack | Slack integration | npx -y @anthropic/mcp-server-slack |