MCP docs: Claude Code

Clients

Analyze PCAP files in Claude Code

Tested with Claude Code 2.1.326 · Updated

Claude Code connects to the PcapAI MCP server with one command. From then on you can ask it to analyze a PCAP file in plain words, or use the slash commands the server adds: Claude uploads the capture, reads you the free summary, asks before it spends a report credit and fetches the evidence, the fix steps and the PDF.

This page assumes you have a token in PCAPAI_TOKEN; if not, the install guide takes two minutes. The Claude Code extension for VS Code shares this configuration, and the JetBrains plugin runs Claude Code in the IDE's terminal, so the same command covers both. The Code tab of the Claude desktop app runs Claude Code too; add the server for it with the same command.

Add the server to Claude Code

Run this once in a terminal. --scope user makes the server available in every project; leave it out to add it to the current project only.

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

The shell replaces $PCAPAI_TOKEN with the token when you press Enter, and Claude Code stores the token itself in ~/.claude.json, a file in your home folder. That is fine for your own machine, but it means a new token needs the command again.

For a repository your team shares, use project scope instead: a .mcp.json file in the project root that names only the variable. Each teammate sets their own PCAPAI_TOKEN, the file is safe to commit, and Claude Code asks each person once whether to trust the server.

.mcp.json (project root)
{
  "mcpServers": {
    "pcapai": {
      "type": "http",
      "url": "https://pcapai.com/mcp",
      "headers": {
        "Authorization": "Bearer ${PCAPAI_TOKEN}"
      }
    }
  }
}

Check the connection

List the servers Claude Code knows. The PcapAI line should end in ✔ Connected; ✘ Failed to connect almost always means the token did not reach the server.

Terminal
claude mcp list

Inside a session, type /mcp to see the server with its ten tools and five prompts. Then ask "Show my PcapAI account": Claude calls get_account and tells you the plan, the report credits left, the largest capture you can upload and the analyses left today.

Analyze your first capture

Start Claude Code in the folder with the capture, or give it the path, and describe the problem the way you would to a colleague:

Remote management to the server is slow and Wireshark shows hundreds of retransmissions. Analyze ./winrm-slow.pcapng in troubleshooting mode: is the network dropping packets?

Claude then works through the same steps every time:

  1. It measures the file and calls upload_capture, which returns a signed upload link and a ready curl command.
  2. It runs the curl command to upload the capture; Claude Code asks you first unless you allowed it (see below).
  3. It calls analyze_capture and, while the engine works, get_analysis. The free summary usually takes about two minutes.
  4. It explains the verdict, the network health, the fault domain and each problem. If you want the evidence or the PDF, it tells you the price and waits for your yes before unlock_analysis spends the credit.

After the unlock, ask follow-up questions as long as you like: "Show me the evidence for the first problem and the checks I can run", "Which hosts are involved?", "Make the PDF for the server team". None of them costs anything more. More requests are on the example prompts page.

Two recorded sessions show these steps from the first request to the PDF, one in each analysis mode:

Slash commands

The server ships five prompts, ready-made requests that Claude Code shows in the / menu. They save typing for the common jobs and tell Claude to ask before spending a credit. Arguments are positional and separated by spaces, so a path with a space in it cannot be passed; rename the file or ask in plain words instead.

CommandWhat it does
/pcapai:triage-capture [path] Triage a capture. Analyze a capture and explain the free summary.
/pcapai:why-is-the-network-slow [interface] [path] Why is the network slow?. Capture traffic during the problem, or take a capture, and find the cause.
/pcapai:is-this-host-compromised <host> [path] Is this host compromised?. Check one host's traffic for signs of compromise.
/pcapai:client-report <analysis_id> Client report. Get the PDF of an unlocked analysis and a short message for the client.
/pcapai:verify-a-fix <analysis_id> [path] Verify a fix. Capture again after a change and compare with the analysis before it.

For example, /pcapai:why-is-the-network-slow eth0 has Claude capture 30 seconds on eth0 and analyze it in troubleshooting mode, and /pcapai:is-this-host-compromised 10.2.3.101 ./workstation.pcap checks one host in security mode. The /mcp__pcapai__… form of the same names works too.

Let Claude Code run the tools without asking

By default Claude Code asks before every tool call and every shell command, which is right for the first session. Once you trust the flow, allow the calls that cannot spend money or delete anything. Add this to .claude/settings.json in a project, or to ~/.claude/settings.json for all projects:

.claude/settings.json
{
  "permissions": {
    "allow": [
      "mcp__pcapai__get_account",
      "mcp__pcapai__upload_capture",
      "mcp__pcapai__analyze_capture",
      "mcp__pcapai__get_analysis",
      "mcp__pcapai__list_analyses",
      "mcp__pcapai__get_finding",
      "mcp__pcapai__query_analysis",
      "mcp__pcapai__create_pdf_report",
      "Bash(curl -sS --fail -T:*)"
    ]
  }
}

The last rule allows only the upload command the server hands out, which starts with curl -sS --fail -T. unlock_analysis and delete_analysis are left out on purpose, so Claude Code still asks before it spends a credit or deletes an analysis. The credit question in the chat comes from the server either way, unless the token was created with Unlock without asking.

Capture the traffic first

When there is no capture yet, Claude can take one on the machine it runs on: ask it to capture while you reproduce the problem, or use /pcapai:why-is-the-network-slow with the interface name. It asks before it uses sudo. A typical command it runs:

Terminal
# 30 seconds on eth0, full packets, then tcpdump exits
sudo tcpdump -i eth0 -s 0 -w /tmp/slow.pcap -G 30 -W 1

Capture where the problem shows: on the client that is slow, or on a host on the same network path. A capture taken on the wrong side of a NAT or a proxy can only show what crossed that point; the network health in the free summary names the checks that could judge it, so you know whether a new capture would help.

Claude Desktop and Claude.ai

The chat in Claude Desktop and Claude.ai adds remote servers as custom connectors, which sign in through a browser window. The PcapAI server takes personal tokens for now, so those apps cannot connect yet; sign-in comes later. Until then, use the Code tab of the Claude desktop app, which is Claude Code and works as described on this page. The deprecated pcap-ai-mcp binary that used to run in Claude Desktop gets no fixes and will stop working, so remove it from claude_desktop_config.json if you still have it.

If it does not work

  • ✘ Failed to connect: run echo ${PCAPAI_TOKEN:0:11}. It must print pcapai_pat_; if it prints nothing, load the variable and run claude mcp add again.
  • The token is revoked, expired or unknown: create a new token in your profile and add the server again, because Claude Code stored the old value.
  • ⏸ Pending approval for a project server: start claude in that folder and approve it.
  • Missing environment variables: PCAPAI_TOKEN under a project server: the variable was not set in the shell that started Claude Code.
  • The upload never arrives: Claude did not run the curl command, or you declined it. Allow it once, or add the rule above.

Every server message with its fix is on the troubleshooting page.

Was this page helpful?