MCP docs: Install & connect

Get started

Install and connect the PcapAI MCP server

Tested with Claude Code 2.1.326, Cursor 3.32.10, Codex CLI 0.172.0 and VS Code 1.148.0 · Updated

There is nothing to install on your machine: the PcapAI MCP server runs at https://pcapai.com/mcp. You create a personal token, keep it in an environment variable, and add one entry to your agent's configuration. It takes about five minutes, and the last step checks that it works.

Before you start

Any PcapAI account can connect, including a free one; you only pay when you unlock the details of a capture. The agent must be able to run shell commands, because it uploads the capture itself with curl (and, if you ask, takes the capture with tcpdump). Claude Code, Cursor, Codex and VS Code with GitHub Copilot can; the chat apps cannot yet.

AccountLargest capture
No plan, or credit packs20 MB
Starter25 MB
Pro50 MB
Advanced100 MB

Every account gets 20 analyses a day, 3 at a time and 60 requests a minute, for uncompressed .pcap or .pcapng files. Wi-Fi captures in monitor mode (radiotap), USB and Bluetooth captures are not supported. A larger capture can be split or trimmed with editcap before the agent uploads it; the troubleshooting page shows how.

Connect in four steps

  1. 1Create a token

    Sign in at pcapai.com (a free account works), open the MCP Server section of your profile and create a token. Give it a name you will recognize, choose when it expires and whether the agent may spend report credits. Copy the token at once: it starts with pcapai_pat_ and is shown only once.

    No account yet? Sign up free, then come back to this step.

    Open Profile → MCP Server and fill in the form. The Report credits choice decides what the token may do:

    Report creditsThe agent canScopes
    Ask before each unlock (default)Upload, read free summaries, and unlock after you say yes in the chatanalyses:read analyses:write credits:spend
    Unlock without askingUnlock as soon as it decides to, for scripts and CI; every analysis it unlocks uses a creditthe same
    Never spend creditsUpload and read free summaries; any unlock is refusedanalyses:read analyses:write

    A token expires after 30 days, 90 days (the default) or a year, and an account can hold ten. PcapAI keeps only a hash of it, so if you lose the value, revoke it and create a new one.

  2. 2Keep it in an environment variable

    Store the token as PCAPAI_TOKEN in your shell's environment, not in a file you share or commit. The commands below keep it in the macOS Keychain, in a file only you can read on Linux, or in your Windows user environment.

    Terminal (macOS, zsh)
    # Keep the token in the Keychain (paste it when asked)
    security add-generic-password -a "$USER" -s pcapai-mcp -w
    
    # Load it into every new shell
    echo 'export PCAPAI_TOKEN="$(security find-generic-password -a "$USER" -s pcapai-mcp -w)"' >> ~/.zshrc
    Terminal (Linux, bash)
    # A file only you can read (paste the token when asked)
    install -m 600 /dev/null ~/.pcapai-token
    read -rs -p "Token: " t && printf '%s' "$t" > ~/.pcapai-token && unset t
    
    # Load it into every new shell
    echo 'export PCAPAI_TOKEN="$(cat ~/.pcapai-token)"' >> ~/.bashrc
    PowerShell
    [Environment]::SetEnvironmentVariable("PCAPAI_TOKEN", (Read-Host "Token"), "User")

    Open a new terminal afterwards, so the variable is loaded. Desktop apps started from the macOS Dock do not read your shell files; the Cursor guide shows two ways to hand them the token.

  3. 3Add the server to your agent

    Add the server https://pcapai.com/mcp to your agent's configuration, with your token in the Authorization header. Pick your agent below: each tab has the exact command or file and a link to the full guide.

    Terminal
    claude mcp add --transport http --scope user pcapai https://pcapai.com/mcp \
      --header "Authorization: Bearer $PCAPAI_TOKEN"

    The shell fills in the token when you run the command, and Claude Code keeps it in ~/.claude.json. Claude Code guide

  4. 4Check the connection

    Restart the agent and ask: "Show my PcapAI account". It calls get_account and answers with your plan, the report credits left, your capture size limit and the analyses left today. If it cannot connect, the troubleshooting page lists every error with its fix.

    To test the token without an agent, ask the server directly. 405 means the token was accepted (the endpoint only takes POST); 401 means it is missing or wrong.

    Terminal
    curl -s -o /dev/null -w "%{http_code}\n" \
      -H "Authorization: Bearer $PCAPAI_TOKEN" https://pcapai.com/mcp

VS Code and other clients

VS Code connects through GitHub Copilot's agent mode. Put the file above in .vscode/mcp.json of a workspace, or run MCP: Open User Configuration from the Command Palette to add the same entry for every workspace. Then run MCP: List Servers, pick pcapai and start it: VS Code asks for the token once, keeps it in its secret storage, and the server starts with ten tools. Because of that prompt, the token never sits in the file and no environment variable is needed. Ask in plain words in agent mode. VS Code does not show the server's prompts, so the slash commands of Claude Code are not available there; every request works without them.

Other clients need three things: MCP over streamable HTTP (the server is stateless and answers plain JSON, so clients that expect a session or server-sent events still work), a way to send the Authorization header with a static value, and a shell the agent can run curl in. The connection details:

Connection details
URL        https://pcapai.com/mcp
Transport  Streamable HTTP (POST, JSON answers, no session)
Header     Authorization: Bearer <your pcapai_pat_ token>

The server speaks the MCP protocol versions 2024-11-05, 2025-03-26, 2025-06-18, 2025-11-25 and 2026-07-28. Claude.ai, the chat in Claude Desktop and ChatGPT add remote servers through a sign-in window in the browser and cannot connect with a token; that sign-in comes later.

Rotate, revoke or remove

To replace a token before it expires, create a new one, put it in PCAPAI_TOKEN and restart the agent; Claude Code users run the claude mcp add command again, because Claude Code stored the old value. Then revoke the old token in your profile: every agent that still uses it loses access at once. Revoking is also the answer if a token may have leaked, for example into a repository or a shared terminal log.

To remove the server, delete the pcapai entry from ~/.cursor/mcp.json, ~/.codex/config.toml or .vscode/mcp.json, or run this in Claude Code:

Terminal
claude mcp remove --scope user pcapai

Removing the server does not delete your analyses; ask the agent to delete them first, or let analyses you did not unlock expire after 24 hours. What PcapAI keeps and for how long is on security, tokens and data handling.

Was this page helpful?