Charles MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add charles-mcp -- uvx charles-mcp
README.md

Integrates Charles Proxy with MCP clients for real-time network traffic analysis

Charles MCP Server

English README | Tool Contract

Charles MCP Server 用于把 Charles Proxy 接入 MCP 客户端,让 agent 可以稳定地读取实时流量、分析历史录包,并在需要时再展开单条请求细节。

它解决的核心问题只有三个:

  • 录制还在进行时,agent 也能持续读取当前 session 的增量流量
  • live 与 history 统一走结构化分析,不再让 agent 直接消费原始抓包字典
  • 默认使用 summary-first 输出,先看热点与摘要,再 drill-down 到单条 detail

快速开始

1. 开启 Charles Web Interface

在 Charles 中依次进入:Proxy -> Web Interface Settings

请确认:

  • 勾选 Enable web interface
  • 用户名为 admin
  • 密码为 123456

菜单位置示意:

Charles Web Interface Menu

设置窗口示意:

Charles Web Interface Settings

2. 安装并配置到 MCP 客户端

无需 clone 仓库,无需手动创建虚拟环境。需要先安装 uv

Claude Code CLI
claude mcp add-json charles '{
  "type": "stdio",
  "command": "uvx",
  "args": ["charles-mcp"],
  "env": {
    "CHARLES_USER": "admin",
    "CHARLES_PASS": "123456",
    "CHARLES_MANAGE_LIFECYCLE": "false"
  }
}'
Claude Desktop / Cursor / 通用 JSON 配置
{
  "mcpServers": {
    "charles": {
      "command": "uvx",
      "args": ["charles-mcp"],
      "env": {
        "CHARLES_USER": "admin",
        "CHARLES_PASS": "123456",
        "CHARLES_MANAGE_LIFECYCLE": "false"
      }
    }
  }
}
Codex CLI
[mcp_servers.charles]
command = "uvx"
args = ["charles-mcp"]

[mcp_servers.charles.env]
CHARLES_USER = "admin"
CHARLES_PASS = "123456"
CHARLES_MANAGE_LIFECYCLE = "false"

让 AI 自动安装

将以下提示词复制粘贴给任意 AI agent(Claude Code、ChatGPT、Gemini CLI、Cursor Agent 等),agent 会自动完成安装和配置:

🔴 点击展开自动安装提示词(推荐)
Install the "charles-mcp" MCP server and configure it for my MCP client. Follow these steps exactly:

Step 1 — Detect OS:
  Determine if this machine runs Windows, macOS, or Linux.

Step 2 — Ensure uv is installed:
  Run: uv --version
  If the command fails (uv not found):
    - macOS/Linux: run: curl -LsSf https://astral.sh/uv/install.sh | sh
    - Windows: run: powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
  After installing, verify uv works: uv --version

Step 3 — Detect which MCP client is installed:
  Check in this order and use the FIRST match:

  a) Claude Code — run: claude --version
     If it succeeds, run this command and skip to Step 5:
       claude mcp add-json charles '{"type":"stdio","command":"uvx","args":["charles-mcp"],"env":{"CHARLES_USER":"admin","CHARLES_PASS":"123456","CHARLES_MANAGE_LIFECYCLE":"false"}}'

  b) Claude Desktop — check if config file exists:
     - macOS:   ~/Library/Application Support/Claude/claude_desktop_config.json
     - Windows: %APPDATA%\Claude\claude_desktop_config.json
     - Linux:   ~/.config/Claude/claude_desktop_config.json

  c) Cursor — check if any of these exist:
     - ~/.cursor/mcp.json
     - .cursor/mcp.json (in current project)

  d) Windsurf — check if exists:
     - ~/.codeium/windsurf/mcp_config.json

  If none detected, ask the user which client they use.

Step 4 — Write config (for clients b/c/d):
  The config entry to add is:
    "charles": {
      "command": "uvx",
      "args": ["charles-mcp"],
      "env": {
        "CHARLES_USER": "admin",
        "CHARLES_PASS": "123456",
        "CHARLES_MANAGE_LIFECYCLE": "false"
      }
    }

  IMPORTANT: If the config file already exists, read it first, parse the JSON,
  add the "charles" key inside "mcpServers" (create "mcpServers" if absent),
  and write back. Do NOT overwrite other existing MCP server entries.
  If the file does not exist, create it with:
    { "mcpServers": { "charles": { ... } } }

Step 5 — Verify:
  Run: uvx charles-mcp
  Wait 3 seconds then terminate the process.
  If it starts without import errors, the installation is successful.

Step 6 — Report:
  Print: "charles-mcp installed successfully. Please restart your MCP client to load the new server."
  Also mention that Charles Proxy must be running with Web Interface enabled (Proxy → Web Interface Settings, username: admin, password: 123456).

前置条件

  • Python 3.10+
  • 本机已启动 Charles Proxy
  • Charles Web Interface 已启用
  • Charles 代理默认监听 127.0.0.1:8888

推荐默认保持 CHARLES_MANAGE_LIFECYCLE=false。除非你明确希望 MCP server 接管 Charles 生命周期,否则不要让它在退出时关闭你的 Charles 进程。

环境变量

变量 默认值 说明
CHARLES_USER admin Charles Web Interface 用户名
CHARLES_PASS 123456 Charles Web Interface 密码
CHARLES_PROXY_HOST 127.0.0.1 Charles 代理主机
CHARLES_PROXY_PORT 8888 Charles 代理端口
CHARLES_CONFIG_PATH 自动探测 Charles 配置文件路径
CHARLES_REQUEST_TIMEOUT 10 控制面 HTTP 超时秒数
CHARLES_MAX_STOPTIME 3600 有界录制最大时长
CHARLES_MANAGE_LIFECYCLE false 是否由 MCP server 管理 Charles 启停

推荐使用路径

实时分析

  1. `

Tools (2)

get_trafficRetrieves captured network traffic from Charles Proxy for analysis
get_request_detailFetches detailed information for a specific network request

Environment Variables

CHARLES_USERCharles Web Interface username
CHARLES_PASSCharles Web Interface password
CHARLES_PROXY_HOSTCharles proxy host address
CHARLES_PROXY_PORTCharles proxy port
CHARLES_MANAGE_LIFECYCLEWhether the MCP server manages Charles process lifecycle

Configuration

claude_desktop_config.json
{"mcpServers": {"charles": {"command": "uvx", "args": ["charles-mcp"], "env": {"CHARLES_USER": "admin", "CHARLES_PASS": "123456", "CHARLES_MANAGE_LIFECYCLE": "false"}}}}

Try it

Analyze the latest network traffic and identify any failed API requests.
Show me a summary of the recent traffic captured by Charles Proxy.
Get the full details for the request with ID 123 to debug the payload.
Filter the current session traffic to show only requests to the production API.

Frequently Asked Questions

What are the key features of Charles MCP Server?

Real-time network traffic capture from Charles Proxy. Structured analysis of historical and live traffic sessions. Summary-first approach to reduce token usage during debugging. Drill-down capability for detailed request inspection. Automated configuration support for major MCP clients.

What can I use Charles MCP Server for?

Debugging API integration issues by inspecting real-time request/response payloads. Analyzing historical network traffic to identify intermittent performance bottlenecks. Filtering out noise from large traffic captures to focus on specific endpoints. Automating the monitoring of network traffic during agent-based testing.

How do I install Charles MCP Server?

Install Charles MCP Server by running: claude mcp add-json charles '{"type": "stdio", "command": "uvx", "args": ["charles-mcp"], "env": {"CHARLES_USER": "admin", "CHARLES_PASS": "123456", "CHARLES_MANAGE_LIFECYCLE": "false"}}'

What MCP clients work with Charles MCP Server?

Charles MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Charles MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare