The key is missing, mistyped, revoked or expired, or the person who created it lost access to the project. Check the header name x-ansehn-api-key, or create a new key.
Connect Claude Code, Cursor or VS Code
Coding agents connect to the Ansehn MCP Server with a project API key. Create the key first, then add the server address https://api.ansehn.com/v1/mcp and the key as the x-ansehn-api-key header to your agent's configuration.
For Claude (claude.ai, Claude Desktop and Cowork) and ChatGPT, you don't need a key: see Connect Claude or ChatGPT to Ansehn.
Before you start
You need the Owner, Admin or Agency role on the project to create an API key.
Create the key in Project Settings > API Keys with the Analytics Read scope. Add Propose personas and schedules only if the agent should propose new personas and schedules for you to confirm (see Set up personas and buying simulations). All scopes are described in API keys and scopes.
Copy the key when it is shown. We can't show it again.
Claude Code
Add the server once from your terminal. Replace YOUR_API_KEY with your key.
claude mcp add --transport http ansehn https://api.ansehn.com/v1/mcp --header "x-ansehn-api-key: YOUR_API_KEY"Start Claude Code and run /mcp. Ansehn shows as connected with its tools. To share the server with your team, add it to the project's .mcp.json instead and keep the key out of source control.
Cursor
Add the server to ~/.cursor/mcp.json for all projects, or to .cursor/mcp.json in one project.
{
"mcpServers": {
"ansehn": {
"url": "https://api.ansehn.com/v1/mcp",
"headers": { "x-ansehn-api-key": "YOUR_API_KEY" }
}
}
}Open Cursor's MCP settings and check that Ansehn is enabled and lists its tools.
VS Code
Add the server to .vscode/mcp.json in your workspace. Agent mode in GitHub Copilot can then use the Ansehn tools.
{
"servers": {
"ansehn": {
"type": "http",
"url": "https://api.ansehn.com/v1/mcp",
"headers": { "x-ansehn-api-key": "YOUR_API_KEY" }
}
}
}Other MCP clients
Any client that supports remote MCP servers over Streamable HTTP with custom headers works. Use the address https://api.ansehn.com/v1/mcp and send the key in the x-ansehn-api-key header. Clients that only support local servers can connect through the mcp-remote bridge.
Treat the key like a password: it can read your project data. Keep it in your client configuration or a secret store, never in a shared document or chat. If a key was exposed, revoke it in Project Settings > API Keys. Revoking takes effect immediately.
Troubleshooting
The agent says it can't connect or gets an authorization error
The agent connects but some tools are missing
The agent only sees the tools its key's scopes allow. Proposing personas and schedules needs the Propose personas and schedules scope, and the person who created the key must be able to edit the project.
Requests fail with a rate limit error
Each key can make 60 requests per minute, and your organization has a daily limit set by your plan. Wait for the time the error names, or spread the work over time.