Use Anychat from Claude Code, Claude Desktop & Cursor¶
Drive your Anychat workspace from your own AI agent. The @anychat-ai/mcp
package is a Model Context Protocol (MCP)
server that any MCP host (Claude Code, Claude Desktop, Cursor, and others)
can run locally. Once connected, the host's model can read and edit your
agents' Definitions, configure their capabilities, connect channels, browse
conversations, and look things up in these docs, all through the same
Agent API the console uses.
The server runs on your machine and authenticates to api.anychat.ai with an
Anychat API key. It has no access beyond what that key grants.
Prerequisites¶
- An Anychat account with at least one agent.
- An API key. Create one in the console at Workspace · API keys (admin role required) and copy the value when it is shown; Anychat stores only a hash and cannot show it again. Give the key the scopes you intend to use, per the authorization model:
| You want the host to | Scopes |
|---|---|
| Read agents and their configuration | agents:read |
| Edit Definitions and capability configuration, connect channels | agents:write |
| Read conversations, logs, and activity | messages:read |
| Read or manage People | people:read or people:write |
| Export People in bulk | people:export (implied by people:write) |
| Read knowledge documents | knowledge:read |
| Apply catalog templates | templates:apply |
| Read org settings, API keys, and webhooks | org:admin, webhooks:manage |
A key that only reads is a reasonable place to start; mint a second key with write scopes once you have seen what the host does with the first.
- Node.js 20 or later (
npxruns the package; no global install).
Setup¶
The server is configured with two environment variables:
| Variable | Required | Meaning |
|---|---|---|
ANYCHAT_API_KEY |
yes | Your API key (sk-any-…). |
ANYCHAT_API_URL |
no | API base URL. Default https://api.anychat.ai. |
The run command is the same everywhere: npx -y @anychat-ai/mcp.
Claude Code¶
Run claude mcp list to confirm the server is registered, then start a
session and ask it about your agents.
Claude Desktop¶
Open Settings · Developer · Edit Config and add the server to
mcpServers in claude_desktop_config.json:
{
"mcpServers": {
"anychat": {
"command": "npx",
"args": ["-y", "@anychat-ai/mcp"],
"env": { "ANYCHAT_API_KEY": "sk-any-..." }
}
}
}
Restart Claude Desktop. The Anychat tools appear under the tools menu in a new conversation.
Cursor¶
Add the same block to .cursor/mcp.json in your project (or
~/.cursor/mcp.json for every project):
{
"mcpServers": {
"anychat": {
"command": "npx",
"args": ["-y", "@anychat-ai/mcp"],
"env": { "ANYCHAT_API_KEY": "sk-any-..." }
}
}
}
Enable the server under Settings · MCP if Cursor does not pick it up automatically.
Any other MCP host¶
The server speaks MCP over stdio. Point your host at the command
npx -y @anychat-ai/mcp with ANYCHAT_API_KEY in its environment. Hosts
that read the standard mcpServers JSON shape accept the Cursor block
above unchanged.
What the host can do¶
Each MCP tool is a thin, one-to-one projection of a documented Agent API route, so the API reference is the authoritative description of what each one reads or writes. The tools are grouped the way the reference is; the full list, with parameters, is in the package README.
| Group | The host can | Examples |
|---|---|---|
| Orient | See who the key belongs to, list agents, load a whole agent as one document, browse the catalogs of agent templates, playbooks, objectives, guardrails, personalities, flows, and channel setup forms. | whoami, list_agents, export_agent, list_catalog_items |
| Definition | Author the sections of an agent's Definition: identity, personality, objectives, playbooks (including each playbook's declared uses and its deterministic flow), guardrails, message templates, the media library (add by URL, replace a file, edit names / hints / descriptions, delete); import catalog templates into them; apply a whole agent template; review and apply template updates; import a definition file; lint the whole Definition; generate a Flow from a playbook's text; switch the agent's runtime (v2 preview). |
update_identity, create_playbook, update_playbook, add_media, lint_agent, generate_playbook_flow, update_agent |
| Capabilities | Configure capabilities: custom integrations (tool bindings) and their connection status, custom tool contracts, scheduling, People fields, products, outreach settings, outreach links, knowledge documents (read). | upsert_tool_binding, replace_scheduling_config, replace_outreach_config, create_outreach_link |
| Channels | List an agent's channels, request a managed channel, connect an unmanaged one, adjust delivery pacing and compliance, enable/disable, remove. | list_channels, request_channel, bind_channel, update_channel |
| People | Work with People and segments: search, read, create, update, merge, import, export; send outreach and follow-ups; list appointments. | list_people, get_person, send_outreach, merge_people, create_segment |
| Testers | Manage the people invited to try an agent in the tester app: list, invite (the sign-in link comes back once, for you to share), disable/enable, regenerate a link, remove. | list_testers, invite_tester, regenerate_tester_link |
| Activity | Read messages, conversations, users, logs, the activity feed, and (v2 agents) per-turn traces. | list_conversations, list_messages, list_turns, list_activity |
| Org | Read and update org settings, list API keys (metadata only, never the secret), manage webhooks. | get_org, list_api_keys, create_webhook |
| Docs | Search and read these docs, so the host can check how something works before it changes your agent. | search_docs, list_docs, read_doc |
The full table (123 tools as of v0.6.0) is in the
package README and printed by
npx -y @anychat-ai/mcp tools.
Nothing sysop-level, and nothing that manages members, roles, or billing, is exposed. Those stay in the console.
Safety model¶
The server never has more authority than the key you gave it:
- Your key, your scopes. Every call is made with your API key and is checked against the key's scopes and the role floor of the route, exactly as a direct API call would be. A read-only key cannot write, whatever the model asks for.
- Writes are labeled. Tools that change something carry MCP annotations marking them as writes, and tools that only read are marked read-only, so your host can tell them apart. Claude Code, Claude Desktop, and Cursor prompt before running a tool by default and let you allow individual tools; a sensible setup allows the read tools and keeps prompting for writes.
- Outward and destructive actions are labeled destructive. Deleting anything, importing a definition or applying a template over an existing agent, requesting a managed channel, disconnecting an integration, and rotating a webhook secret carry the destructive annotation. Keep these out of any always-allow list and confirm each one as it comes up.
- Nothing is stored server-side. The package keeps no session state and
sends no data anywhere except
api.anychat.ai(or the URL you set) and docs.anychat.ai for the docs tools. Its API calls carryX-Anychat-Agent: mcp, an attribution header that appears in Anychat's access log and grants nothing.
Treat the API key like a password: keep it out of shared configuration files and revoke it at Workspace · API keys if it leaks.
Example prompts¶
- "List my agents and tell me which ones have no channels connected."
- "Review the guardrails on my MediSpa agent against best practice and suggest changes. Don't apply anything yet."
- "Add a playbook to the Acme sales agent that handles pricing questions: give ranges from the product catalog, never quote a final price, and offer to book a call."
- "Set up a WhatsApp channel for this agent."
- "Show me yesterday's conversations for the Acme agent where the person asked about pricing, and summarize what went wrong."
- "Export the Acme agent's definition, change the personality to the 'Concise professional' template, and show me the diff before importing."
- "How does scheduling handle same-day bookings? Check the docs, then tell me what my agent's scheduling config is set to."
The docs tools mean you can ask "how do I…" questions in the same session as "do it" requests; the host reads the relevant page before acting.
Troubleshooting¶
| Symptom | Cause | Fix |
|---|---|---|
Every call fails with 401 |
The key is missing, mistyped, expired, or revoked. | Check ANYCHAT_API_KEY in the host's config; mint a new key at Workspace · API keys if needed. |
A call fails with 403 auth.scope_missing |
The key lacks the scope that route requires. | Edit the key's scopes at Workspace · API keys (or mint a new key) and restart the host. |
A call fails with 403 and mentions a role |
The route's role floor is above the role of the key's issuer (for example, an editor's key calling an admin-only route). | Ask an org admin to perform the action, or to mint the key. |
A resource returns 404 for an agent that exists |
The key belongs to a different org, or the agent id is wrong. | Run the whoami tool to see the key's org; copy the agent id from the console. |
| The host does not list any Anychat tools | The server failed to start, usually because Node.js is missing or npx cannot reach the npm registry. |
Run npx -y @anychat-ai/mcp in a terminal with ANYCHAT_API_KEY set and read the error. |