Claude Code
Add the MCP server to Claude Code, and check that it works.
Claude Code connects to the MCP server over Streamable HTTP. The key goes in a header. Claude Code reads the key from an environment variable.
Install
-
Make a test key in the dashboard. A test key starts with
sk_test_. -
Put the key in an environment variable. Add this line to your shell profile:
export AFFFAST_API_KEY="sk_test_..." -
Add the server. Use single quotes. They keep your shell from reading
${AFFFAST_API_KEY}. Claude Code reads it when it connects.claude mcp add --transport http afffast https://api.afffast.com/mcp \ --header 'Authorization: Bearer ${AFFFAST_API_KEY}'
By default, the server is local to the current project (--scope local). Use --scope user for all your projects. Use --scope project to write the server to .mcp.json, which your team can share. The file stores only the name of the variable, not the key.
{
"mcpServers": {
"afffast": {
"type": "http",
"url": "https://api.afffast.com/mcp",
"headers": { "Authorization": "Bearer ${AFFFAST_API_KEY}" }
}
}
}Check that it works
Run this command. The server must show Connected:
claude mcp listThe add command does not check the key. A wrong key shows Failed to connect here. Inside Claude Code, type /mcp to see the server and its tools.
Example prompts
- "Query the revenue by network for this month. Show the result as a table."
- "List the 10 newest conversions that have the status pending."
- "Make a test link for the program
prog_...that goes tohttps://shop.example/products/boots."
Troubleshooting
Failed to connector a 401 error. The key is wrong, or the variable is not set in the shell that started Claude Code. If a variable is not set, Claude Code warns inclaude mcp listand sends the text${AFFFAST_API_KEY}as the key. Export the variable. Start Claude Code again.- The tools are missing. The key decides the tools. A read-only key has no write tools. Make a key with the scope that you need.
- A key in the URL. Do not do this. The API refuses a key in the query string.
- A 429 error. The tool call hit a rate limit. Wait for the time in
Retry-After. See Rate limits. - You use a project scope. Claude Code asks you to approve the servers of
.mcp.jsonbefore it uses them.
Security
- Never paste a key into a chat. Use the environment variable.
- Start with a test key. A test key reads and writes test data only.
- Use a read-only key if the tool must only read.
- Do not commit a key. The
.mcp.jsonfile must have${AFFFAST_API_KEY}, not the key. - Each tool call is in the request logs of the dashboard. Look there to see what the tool did.