MCP Client Support — connect to external MCP servers as tool providers #86
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Competitor
Kind/Documentation
Kind/Enhancement
Kind/Epic
Kind/Feature
Kind/Security
Kind/Story
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Scope/Core
Scope/Cross-Plugin
Scope/Plugin-System
Scope/Single-Plugin
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ultanio/cobot#86
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Add MCP (Model Context Protocol) client support to cobot, allowing it to connect to external MCP servers and expose their tools to the agent. This is the standard way AI agents integrate with external tool ecosystems.
Why
MCP is becoming the universal protocol for AI tool integration (backed by Anthropic, adopted by VS Code, Claude Desktop, Codex CLI, Cursor, etc.). Adding client support means cobot can instantly access:
Without MCP support, every tool integration requires a custom plugin. With it, we get ecosystem compatibility for free.
MCP Protocol Essentials
Architecture: Host (cobot) → Client (one per server) → Server (external process)
Transports:
Protocol: JSON-RPC 2.0 over the transport. Key methods:
initialize— capability negotiationtools/list— discover available tools (returns name, description, JSON Schema params)tools/call— invoke a tool with arguments, get results backData flow:
tools/list→ gets tool definitionsTOOL_DEFINITIONSformatsession.call_tool(name, args)Python SDK
Official library:
mcp(maintained by Anthropic/MCP team)pip install mcp(oruv add mcp)ClientSession,StdioServerParameters,stdio_clientClient code is ~30 lines:
Integration Plan
Phase 1: MCP plugin (core client) — ~2-3 days
New plugin:
cobot/plugins/mcp/plugin.pycobot.yaml:Implements
ToolProviderinterface — the existing pattern intools/plugin.pyalready aggregates tools from allToolProviderplugins. The MCP plugin just needs to:get_definitions()→ convert MCP tool schemas to cobot formatexecute(tool_name, args)→ route tosession.call_tool()Lifecycle:
start()→ spawn configured MCP servers, runinitialize(), cache tool listsstop()→ graceful shutdown of subprocessesTool namespacing: Prefix tools to avoid collisions:
mcp_code-index_search_codePhase 2: Dynamic server management — ~1-2 days
CLI commands:
cobot mcp list— show connected servers and their toolscobot mcp add <name> <command>— add a server at runtimecobot mcp remove <name>— disconnect a serverWeb panel (depends on #43): show connected servers, tool counts, health status
Phase 3: Remote transport — ~1 day
Effort Estimate
mcppip packagePhase 1 alone gives us a working MCP client. Phases 2-3 are nice-to-haves.
Dependencies
mcppackage (adds:httpx,pydantic,anyio— cobot may already have some of these)References
ToolProviderinterface inplugins/interfaces.pytools/plugin.pyalready aggregates from allToolProviderplugins (lines 153-175)