Why export a ChatAgent as an MCP server?
Publishing your ChatAgent as an MCP server turns your agent into a universal AI backend.
Any MCP-compatible client (Claude, Cursor, editors, or your own app) can connect, chat, and run tools through your agent as if it were a native API—no custom integration required.
Quick Start
Method 1: Use Service Scripts
Scripted Server:
Launch your agent as an MCP server with the ready-made scripts in
Configure your MCP client (Claude, Cursor, etc.) to connect:
Launch your agent as an MCP server with the ready-made scripts in
services/
.Configure your MCP client (Claude, Cursor, etc.) to connect:
mcp_servers_config.json Example
Tip: Just point your MCP client at this config, and it will auto-discover and call your agent!
Method 2: Use `to_mcp()`
Turn any
ChatAgent
into an MCP server instantly with to_mcp()
:agent_mcp_server.py
Supported transports:
stdio
, sse
, streamable-http
What does this unlock?
- Plug-and-play with any MCP client: Claude, Cursor, editors, automations—just connect and go.
- Universal API: Your agent becomes an “AI API” for any tool that speaks MCP.
- Security & Flexibility: Keep control over keys, environments, and agent configs.
Real-world Example
Claude calling a CAMEL MCP server
You can use Claude, Cursor, or any other app to call your custom agent!
Just connect to your CAMEL MCP server

Just connect to your CAMEL MCP server


You can expose any number of custom tools, multi-agent workflows, or domain knowledge, right from your own laptop or server!
Why make your ChatAgent an MCP server?
Benefits
- Universal Access: Any client, any platform, anytime.
- Multi-Agent Workflows: Power agent societies by letting agents call each other.
- Local Control: Expose only the tools and data you want, with full security.
- No Glue Code: MCP handles discovery and invocation, no custom REST or RPC needed.
Want to create your own tools and toolkits?
See Toolkits Reference for everything you can expose to the MCP ecosystem!
See Toolkits Reference for everything you can expose to the MCP ecosystem!