MCP Server Mode

CodeCLI can act as an MCP (Model Context Protocol) server, exposing all its built-in tools to other applications like Claude Desktop, VS Code extensions, or any MCP-compatible client.

Quick Start

Stdio Transport (default)

bash
codecli mcp-server

Connect from another app:

json
{
"type": "stdio",
"command": ["codecli", "mcp-server"]
}

HTTP Transport

bash
codecli mcp-server -t http -p 4097

Connect from another app:

json
{
"type": "http",
"url": "http://localhost:4097/mcp-server"
}

Available Tools (36)

Built-in Tools (25)

ToolDescription
bashExecute shell commands
readRead file contents
writeCreate files
editEdit files with exact string replacement
globFind files by pattern
grepSearch file contents with regex
computer_useGUI automation (screenshot, click, type, etc.)
taskSpawn sub-agents
webfetchFetch and parse web content
websearchSearch the web
skillLoad specialized skill instructions
todowrite / todoreadTask list management
kanbanwrite / kanbanreadKanban board management

Management Tools (11)

ToolDescription
codecli_infoServer version, directory, tool/MCP counts
codecli_tools_listList all tools with descriptions
codecli_mcp_listMCP server status
codecli_mcp_toggleConnect/disconnect an MCP server
codecli_mcp_toolsTools from connected MCP servers
codecli_skills_listAvailable skills
codecli_commands_listSlash commands
codecli_config_getCurrent configuration
codecli_config_setUpdate config values
codecli_plugins_listLoaded plugins and hooks
codecli_sessions_listRecent sessions

Protocol

The server implements the MCP protocol (version 2024-11-05) using the official@modelcontextprotocol/sdk. It supports:

  • initialize — protocol handshake
  • tools/list — enumerate all tools with JSON Schema parameters
  • tools/call — execute any tool
  • ping — health check

Testing

bash
# Run the included test script
bash script/test-mcp.sh
# Or test manually
echo '{"jsonrpc":"2.0","id":1,"method":"ping"}' | codecli mcp-server
PreviousCLI FlagsNextACP (IDE Integration)