IDE代码助手

ChatCod是一个通过浏览器自动化将IDE上下文转发到免费在线AI聊天(如ChatGPT、Claude、Gemini、Perplexity)并返回结构化代码更改的MCP兼容服务器。无需API密钥或付费计划。

  • by jinto-ag
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 jinto-ag/chatcod

使用说明

ChatCod

MCP兼容服务器,通过浏览器自动化将IDE上下文转发到免费的在线AI聊天(ChatGPT、Claude、Gemini、Perplexity),并返回结构化代码更改。不需要API密钥或付费计划。

特性

  • MCP协议支持-适用于Claude Desktop和任何MCP客户端
  • 自动上下文收集-活动文件、导入、相关文件
  • 浏览器自动化-登录一次,重复使用会话Cookie
  • 多平台–ChatGPT、Claude.ai、Gemini、困惑
  • 结构化输出——文件级差异、行范围、验证状态
  • 零成本——仅依赖于公共网络界面

安装

# 1. Install UV (single binary)
curl -LsSf https://astral.sh/uv/install.sh | sh

# 2. Clone and enter project
git clone https://github.com/your-org/chatcod-mcp.git
cd chatcod-mcp

# 3. Download browser once
uv run playwright install chromium

# 4. Add server to Claude Desktop
# macOS: ~/Library/Application Support/Claude/mcp.json
# Windows: %APPDATA%\Claude\mcp.json
{
  "mcpServers": {
    "chatcod": {
      "command": "uv",
      "args": ["run", "--directory", "/full/path/chatcod-mcp", "src/server.py"]
    }
  }
}

重新启动克劳德桌面;这 chatcod 工具组会自动出现。

用法

  1. 打开IDE中的任何项目文件夹。
  2. 在Claude聊天类型中:
    @chatcod code_assist:0 {"problem": "add CLI argument parser", "file": "main.py"}
  3. ChatCod扩展上下文,打开浏览器选项卡,收集答案,并返回一个JSON补丁,您可以一键应用。

项目布局

chatcod-mcp
├── src
│   ├── server.py          # MCP entry point
│   ├── browser_agent.py   # Playwright helpers
│   └── context.py         # IDE context expansion
├── pyproject.toml         # UV project metadata
└── README.md

发展

uv run pytest              # unit tests
uv run ruff check          # lint
uv run pyright             # type check

安全说明

  • Cookie存储在本地 cookies.json;把文件保密。
  • 浏览器在自己的配置文件中运行;无法访问个人浏览器数据。
  • 可以在中启用无头模式 browser_agent.py 首次登录后。

许可证

麻省理工学院