Skip to main content

CodeBook MCP Server

让不会写代码的人也能理解、诊断和修改软件产品的 MCP 工具。

快速开始

cd mcp-server

# 安装依赖(macOS 请用 pip3)
pip3 install -e ".[dev]"

# 启动 MCP Server(stdio 模式,供 Claude Desktop 使用)
python3 -m src.server

# 或使用 entry point
codebook

配置 MCP 客户端

Claude Desktop

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "codebook": {
      "command": "codebook-server"
    }
  }
}

Claude Code (CLI)

claude mcp add codebook -- codebook-server

可用工具

工具 说明 对应能力
scan_repo 扫描项目,生成蓝图总览 + Mermaid 依赖图 蓝图 + 看懂
read_chapter 查看指定模块的详细卡片 看懂
diagnose 自然语言描述问题 → 追踪调用链 → 定位代码 定位
ask_about 针对模块进行多轮追问 追问

运行测试

pytest tests/ -v

项目结构

mcp-server/
├── src/
│   ├── server.py          # MCP Server 入口
│   ├── config.py          # pydantic-settings 配置
│   ├── tools/             # 4 个核心工具
│   ├── parsers/           # Tree-sitter 代码解析(Phase 1.2)
│   ├── prompts/           # Prompt 模板管理(Phase 1.3)
│   ├── summarizer/        # 模块卡片生成引擎(Phase 1.3)
│   └── diagnoser/         # 问题定位引擎(Phase 1.5)
├── tests/
├── pyproject.toml
└── README.md

环境变量

变量 默认值 说明
CODEBOOK_LOG_LEVEL INFO 日志级别
CODEBOOK_MAX_REPO_SIZE_MB 100 最大仓库大小限制

注意: 不需要设置 ANTHROPIC_API_KEY。CodeBook 作为 MCP Server 运行在 Claude Desktop 内部,由宿主 LLM 直接推理,无需额外 API 调用。

Metadata

Release files for codebook-mcp 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codebook-mcp 0.5.0
File Size Uploaded Provenance Actions
codebook_mcp-0.5.0.tar.gz 247.9 kB Without provenance Details for codebook_mcp-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for codebook-mcp 0.5.0
File Interpreter ABI Platform Actions
codebook_mcp-0.5.0-py3-none-any.whl Python 3 none any Details for codebook_mcp-0.5.0-py3-none-any.whl

Total release size: 390.1 kB

Release files / codebook_mcp-0.5.0.tar.gz

Download URL codebook_mcp-0.5.0.tar.gz
Size 247.9 kB
Tags Source
SHA-256 checksum
How to use checksums
89b9d5cee16e73769618d68424892c34351e4d0976a2165c730683ea1789bdb6
BLAKE2b-256 checksum
How to use checksums
1691bb3a0907b869c6c5f7650b0959fc4791bb9bb5515d9a3c441f9389628cb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / codebook_mcp-0.5.0-py3-none-any.whl

Download URL codebook_mcp-0.5.0-py3-none-any.whl
Size 142.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3aeb7a8127ab172f02ab2b79a615493dfd777a243eb0e445f6ee5ee3bbbf1fee
BLAKE2b-256 checksum
How to use checksums
412c33a6e98f671e8fec82f2c096131ed06d6ca657872020a3cd7baf07048ce6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for codebook-mcp 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page