Agent MCP Server
Expose a ChatDrift agent as an MCP server so AI assistants like Claude Desktop, Cursor, and ChatGPT can call it as a tool.
Agent MCP Server
Every ChatDrift agent can be exposed as a Model Context Protocol (MCP) server. Once enabled, any MCP-compatible client — Claude Desktop, Cursor, or ChatGPT — can connect to your agent and call it as a tool. Use this when you want your AI coding assistant or chat client to answer questions using your agent's persona, knowledge base, and configured tools.
Note
The MCP endpoint is public and unauthenticated — it has the same trust level as your embeddable widget. Anyone who knows the agent key can send messages to your agent, and every call consumes your team's AI credits. Only enable this feature for agents you are comfortable making publicly chattable.
Enable the MCP server
- In your ChatDrift dashboard, open the agent you want to expose.
- Go to Settings → Integrations.
- Toggle MCP server on.
- Copy the endpoint URL shown below the toggle. It has the form described in the next section.
The toggle must be on for the endpoint to accept requests. Turning it off returns 403 to all MCP clients immediately.
Endpoint
https://chatwidget.app/api/mcp/<agent-key>
Replace <agent-key> with the agent's public key — the same key that appears in your embed snippet and help-page URL (/frame/<agent-key>).
If you are self-hosting the ChatDrift widget frame, substitute chatwidget.app with your widget-frame host.
| Field | Value |
|---|---|
| Transport | Streamable HTTP (MCP 2025-03-26) |
| Authentication | None |
| Content-Type | application/json |
A GET to the endpoint returns a status probe:
{
"status": "online",
"message": "ChatDrift Agent MCP Server",
"transport": "streamable-http"
}
The ask_agent tool
The server exposes one tool: ask_agent.
Inputs
| Option | Type | Required | Description |
|---|---|---|---|
question | string | Yes | The question or message to send to the agent. |
conversation_id | string | No | Pass the value returned by a previous call to continue the same conversation thread. Omit to start a new conversation. |
Output
The tool returns the agent's answer as a string. The response object also includes a conversation_id. Pass this value as conversation_id in your next call to continue the conversation with full context.
Example: continuing a conversation
First call — omit conversation_id to start fresh:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "ask_agent",
"arguments": {
"question": "What is your return policy?"
}
}
}
Second call — pass the returned conversation_id to continue:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "ask_agent",
"arguments": {
"question": "What about international orders?",
"conversation_id": "conv_abc123"
}
}
}
The agent answers using its configured persona, knowledge base, and any enabled tools (order lookup, live search, etc.).
Add to your MCP client
Open your Claude Desktop configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add an entry under mcpServers:
{
"mcpServers": {
"my-chatdrift-agent": {
"url": "https://chatwidget.app/api/mcp/<agent-key>"
}
}
}
Replace <agent-key> with your agent's public key and my-chatdrift-agent with any label you want to appear in Claude. Restart Claude Desktop after saving.
Troubleshooting
- Connector does not appear in client — Confirm the MCP server toggle is on in the agent's Settings → Integrations. Verify the agent key in the URL is correct (it is case-sensitive).
- Calls return 403 — The MCP server toggle is off for this agent. Enable it in the dashboard.
- Calls return 404 — The agent key does not match any active agent, or the agent has been deleted.
- Calls fail or time out — The agent may be over your team's AI credit limit. Check usage in Dashboard → Billing.