Skip to main content
Claude Code connects to Perfai’s hosted MCP server directly over HTTP and the authentication is a Perfai API key, passed as a header.

Get an API key

  1. Log into cloud.perfai.ai.
  2. In the left sidebar, click API Keys.
  3. Click + Create key.
  4. Name: something that identifies where it’s used, e.g. Claude Code.
  5. Expires after (days): optional — leave blank for the 90-day default, or set up to 365.
  6. Click Create key.
The “Copy your key now” dialog that appears gives you two ready-to-use snippets — one labeled Claude Code (hosted server), one labeled Any MCP client (local server). You’ll use the Claude Code one below; it already has your key filled in.
The key is shown once, in that dialog, and never again. If you close it without copying, revoke the key and create a new one.

Installation

  1. Open Claude Code — by its chat panel in your IDE, to start a session.
  2. In the message box, type /mcp and press Enter. This opens the MCP servers panel (a dialog, not a chat response).
  3. Click Add server.
  4. Name: perfai-mcp.
  5. Transport: select HTTP (remote)”
  6. URL: https://mcp-server.perfai.ai/mcp
  7. Headers: one per line, as Header-Name: value. Add:
    using your key from above.
  8. Scope: pick User (available in all your projects) — not Local (private to just this project, not written to any shared file) or Project (shared via .mcp.json), unless you specifically want one of those instead.
  9. Click Add server. Back in the MCP servers list, perfai-mcp should show ✔ Connected.
Added it but your chat still can’t find perfai-mcp? Close that chat session entirely and start a genuinely new one — Claude Code loads MCP tools once at session start, so a server added mid-session won’t be visible in it until it restarts.

To install via the CLI command

Same result, from a terminal instead of the chat panel. Paste the Claude Code (hosted server) snippet from the “Copy your key now” dialog — it looks like this (with your own key in place of the example):
By default this registers the server for your user (available in every project). Add --scope project before perfai to limit it to the current project instead, which writes to .mcp.json in your project root. This writes to the same config file the UI method does, but if you were already mid-chat in a session started before you ran it, that session still won’t see the new server until it restarts — same as above.

Confirm you’re signed in

The API key signs you in — there is no separate login step. Every tool call runs as the user who created the key, with that user’s organizations and role. In a fresh Claude Code chat, type:
It answers with the key’s id (pfk_xxxxxxxxxxxx_…), never the secret. If a tool call fails with 401, the key has expired or been revoked — create a new one and update the server.

Use it

Tell Claude Code:
Registers the app and runs a security test.
Shows what it found.
Fixes everything, prioritized by severity.

To run it locally

If you’d rather Claude Code spawn the Perfai server as a local process instead of connecting to the hosted one — useful on a network that blocks outbound HTTP to mcp-server.perfai.ai, or if you just prefer a local process — this needs Node.js 18+ (run node --version to check) follow these steps. Edit the config file
  1. Decide the scope:
    • Global (available in every project) — the file is ~/.claude.json on macOS/Linux, or %USERPROFILE%\.claude.json on Windows. This is your home folder — if the file doesn’t already exist there, create it.
    • Project-scoped (this project only) — create a file named .mcp.json in your project’s root folder.
  2. Open that file in any text editor (or your IDE) and add this inside it:
  1. Save the file, then restart Claude Code (or start a new session) so it picks up the change.