MCP docs: Cursor

Clients

Analyze PCAP files in Cursor

Tested with Cursor 3.32.10 and the Cursor CLI 2026.11.22 · Updated

Cursor's agent can analyze PCAP files through the PcapAI MCP server: add the server with one click or a few lines of mcp.json, and the agent uploads the capture from your workspace, reads the free summary and asks before it spends a report credit on the evidence and the PDF.

You need a token in the environment variable PCAPAI_TOKEN; the install guide shows how to create and store one. The only part specific to Cursor is getting that variable into a desktop app, covered below.

Add the server to Cursor

The button opens Cursor and asks you to confirm the new server. It adds the same entry as the file below, with the token read from PCAPAI_TOKEN, so no secret travels in the link.

Add to Cursor

To add it by hand, put this in ~/.cursor/mcp.json for all projects, or in .cursor/mcp.json in a project folder for that project only. If the file already has servers, add the pcapai entry next to them.

~/.cursor/mcp.json
{
  "mcpServers": {
    "pcapai": {
      "url": "https://pcapai.com/mcp",
      "headers": {
        "Authorization": "Bearer ${env:PCAPAI_TOKEN}"
      }
    }
  }
}

${env:PCAPAI_TOKEN} is Cursor's syntax for an environment variable. A project file with this line is safe to commit: it names the variable, not the token.

Give Cursor the token

Cursor reads PCAPAI_TOKEN from its own environment when it starts. On macOS an app started from the Dock, Spotlight or Finder does not load ~/.zshrc, so it starts without the variable and the server cannot sign in. Start Cursor from a terminal that has the variable, or hand the variable to Dock-started apps, then quit and reopen Cursor:

Terminal (macOS)
# Either start Cursor from a shell that has the variable
cursor .

# or hand the variable to apps started from the Dock (until you log out)
launchctl setenv PCAPAI_TOKEN "$PCAPAI_TOKEN"

The cursor command comes from Cursor's Command Palette: Shell Command: Install 'cursor' command. launchctl setenv lasts until you log out. On Linux, a Cursor started from your desktop session usually sees variables set in ~/.profile; on Windows, a user environment variable is seen by every app started after you set it.

If neither suits you, write the token itself into ~/.cursor/mcp.json in place of ${env:PCAPAI_TOKEN}. That file lives in your home folder; never do this in a project's .cursor/mcp.json that gets committed.

Check the connection

Open Cursor Settings and find the MCP section. The pcapai server should show a green dot and list ten tools; a red dot means the connection failed, almost always because the token was empty. The details are in the Output panel: open it with View → Output and choose MCP Logs. Then ask in the agent chat: "Show my PcapAI account".

Analyze a capture in the agent chat

Use the chat in Agent mode, where Cursor can call tools and run terminal commands. Describe the problem and where the capture is:

Analyze ./captures/branch-office.pcapng in troubleshooting mode and tell me why uploads to the backup server are slow.

The agent calls upload_capture, runs the curl command it gets in Cursor's terminal to upload the file, then calls analyze_capture and reads you the free summary. Cursor asks for approval before each MCP tool call and each terminal command unless you allowed them; that is your chance to see exactly what runs. When you want the evidence, the hosts or the PDF, the agent asks before unlock_analysis spends a report credit. Ready-made requests for other jobs are on the example prompts page.

To see the whole flow first, watch the two recorded sessions: a slow server and a compromised host. They were recorded in Claude Code; Cursor calls the same tools and gets the same answers.

The Cursor CLI

The Cursor CLI, cursor-agent, runs the same agent in a terminal and reads the same mcp.json files, so a server added for the editor works there too. Because it starts from your shell, it sees PCAPAI_TOKEN without any of the steps above, which makes it the quickest way to tell a token problem from a configuration problem:

Terminal
cursor-agent mcp list
cursor-agent mcp list-tools pcapai

The first command should show pcapai: ready, and the second the ten PcapAI tools with their parameters. A server in a project's .cursor/mcp.json shows not loaded (needs approval) until you approve it, in the editor or with cursor-agent mcp enable pcapai. If the CLI connects and the editor does not, the editor is missing the variable.

If it does not work

  • Red dot or 401 in MCP Logs: the token was empty when Cursor started. Use one of the two ways above, then quit Cursor completely and reopen it.
  • The agent does not use the tools: switch the chat to Agent mode and check that the pcapai server is enabled in Settings.
  • The upload never arrives: the terminal command was declined or failed. Approve it, or run it yourself from the chat.
  • The token is revoked, expired or unknown: create a new token, update the variable or the file, and restart Cursor.

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

Was this page helpful?