Skip to main content
Glama

codegraph-summary

CodeGraph 中文语义摘要工具 — 为代码符号生成中文业务摘要,支持语义搜索和 PRD 关联分析。

将代码知识图谱与 LLM 结合,让你用中文业务术语搜索代码、理解系统架构、追踪需求覆盖。

特性

  • 一键初始化codegraph-summary init 自动构建索引 + 生成摘要

  • 中文语义搜索 — 用 "交易查询"、"清退流程" 等业务术语搜索代码

  • FTS5 trigram — 高质量中文子串匹配,无需分词器

  • 图谱扩展 — 搜索结果展示调用链(谁调用了它、它调用了谁)

  • PRD 关联 — 导入需求文档,自动关联到代码实现

  • 多协议 LLM — 支持 Anthropic / OpenAI 兼容 API

  • 启发式降级 — 无 LLM API Key 时仍可生成基础摘要

  • 三种接口 — CLI / HTTP API / MCP Server

Related MCP server: MCP Indexer

快速开始

安装

npm install -g codegraph-summary

需要先安装 CodeGraph

npm install -g @colbymchenry/codegraph

一键初始化

cd your-project
codegraph-summary init

这会自动完成:

  1. 构建 CodeGraph 代码索引(如果不存在)

  2. 用 LLM 为所有导出符号生成中文摘要

配置 LLM(可选)

在项目根目录创建 .env 文件:

SUMMARY_LLM_API_KEY=your-api-key
SUMMARY_LLM_BASE_URL=https://api.anthropic.com
SUMMARY_LLM_MODEL=claude-sonnet-4-20250514
SUMMARY_LLM_API_TYPE=anthropic

不配置 API Key 也能用(启发式模式,用函数签名作为摘要)。

使用

搜索代码

codegraph-summary search "交易查询" -p /path/to/project

查看状态

codegraph-summary status -p /path/to/project

强制重新生成

codegraph-summary init -f
codegraph-summary generate -f -p /path/to/project

PRD 关联

# 导入 PRD 文档(支持 .md / .docx / .pdf / .txt)
codegraph-summary prd-import ./docs/prd.md -p /path/to/project

# 用需求描述搜索代码
codegraph-summary prd-search "用户清退流程" -p /path/to/project

# 查看需求覆盖率
codegraph-summary prd-coverage -p /path/to/project

MCP Server(AI 助手集成)

codegraph-summary mcp

在 Claude Code 的 MCP 配置中添加即可让 AI 助手直接搜索代码摘要。

HTTP API

codegraph-summary serve --port 3000

环境变量

变量

说明

默认值

SUMMARY_LLM_API_KEY

LLM API Key

(空,启发式模式)

SUMMARY_LLM_BASE_URL

LLM API 地址

(空)

SUMMARY_LLM_MODEL

模型名称

(空)

SUMMARY_LLM_API_TYPE

anthropicopenai

anthropic

SUMMARY_LLM_BATCH_SIZE

每批符号数量

10

SUMMARY_LLM_CONCURRENCY

并发请求数

3

SUMMARY_VECTOR_GATEWAY_URL

向量服务地址(可选)

(空)

CODEGRAPH_BIN

自定义 codegraph 路径

(自动查找)

系统要求

  • Node.js >= 22.5.0

  • CodeGraph (用于代码索引)

  • PDF 支持需要 poppler-utils(macOS: brew install poppler

  • DOCX 支持需要 unzip 命令

License

MIT

Available Tools

6 tools
prd_coverageC

分析 PRD 需求的代码覆盖率,找出没有对应实现的需求片段(离散节点)。

ParametersJSON Schema
NameRequiredDescriptionDefault
projectPathNo项目路径

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It implies a read-only analysis but does not explicitly state whether the tool is safe (non-destructive), what permissions are needed, or any other behavioral traits like rate limits or side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that front-loads the key purpose. It is appropriately sized with no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of output schema and annotations, the description leaves significant gaps: the agent doesn't know what the output looks like, how results are structured, or how to interpret 'discrete nodes'. For a tool analyzing coverage, more detail is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% for the single parameter (projectPath), with a schema description ('项目路径'). The tool description does not add extra meaning beyond the schema, meeting the baseline for full coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it analyzes code coverage of PRD requirements and finds uncovered fragments, using a specific verb ('分析') and resource ('PRD需求的代码覆盖率'). Differentiates from sibling tools like prd_import and prd_search which handle other PRD operations. However, '离散节点' (discrete nodes) may be ambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like prd_search or summary_generate. No prerequisites or exclusions mentioned, leaving the agent to infer appropriate usage without context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

prd_importC

导入 PRD/需求文档,按章节切分后与代码符号建立关联。支持 markdown 格式。需要向量库配置。

ParametersJSON Schema
NameRequiredDescriptionDefault
prdPathYesPRD 文档路径
minScoreNo最低关联相似度(默认 0.7)
projectPathNo项目路径

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It discloses that the tool splits chapters and associates with code symbols, and requires a vector library. However, it fails to mention whether the operation is destructive, what permissions are needed, rate limits, or side effects. This is insufficient for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with three short sentences that are front-loaded with the main action. Each sentence adds value: action, format support, prerequisite. No unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 3 parameters and no output schema, the description should explain return values or error conditions. It does not. The prerequisite (vector library) is mentioned but not what happens if unmet. The description is too brief to be complete for a non-trivial tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the parameters are already described. The description adds that markdown format is supported and vector library is required, which provides context beyond the schema. However, it does not elaborate on parameter specifics like the meaning of minScore or projectPath beyond what the schema already says.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool imports PRD/requirements documents, splits them by chapters, and associates with code symbols. It also specifies markdown support. However, it does not explicitly differentiate from siblings like prd_search or prd_coverage, which slightly reduces clarity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It only mentions a prerequisite (vector library configuration). There is no discussion of exclusion cases, context, or when other tools would be more appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

summary_generateA

为当前项目的导出符号生成或更新中文摘要。首次运行全量生成,后续运行增量更新。需要 LLM API 配置(SUMMARY_LLM_API_KEY 等环境变量)。

ParametersJSON Schema
NameRequiredDescriptionDefault
forceNo强制全量重新生成
projectPathNo项目路径

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description supplies behavioral info: full vs incremental updates and environment variable requirements. However, it does not disclose whether updates override existing summaries, auth details, or rate limits, leaving some gaps for a tool with no annotation support.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description consists of two concise sentences. The first sentence states the core purpose, and the second adds usage guidance and prerequisites. No superfluous information is present.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with two optional parameters, no output schema, and no nested objects, the description adequately covers behavior and prerequisites. It could mention integration with sibling tools like summary_search, but the existing detail is sufficient for typical use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, with both parameters described in the schema. The tool description adds minor context (force triggers full regeneration, projectPath optional) but does not significantly extend beyond the schema, meeting the baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it generates or updates Chinese summaries for exported symbols, using specific verbs and resource. It distinguishes itself from sibling tools like summary_search and summary_status, which have different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context: first run performs full generation, subsequent runs are incremental updates, and it requires LLM API configuration. It does not explicitly state when not to use the tool or list alternatives, but the context is adequate for decision-making.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

summary_statusA

查看当前项目的摘要生成状态:覆盖率、PRD 关联情况。

ParametersJSON Schema
NameRequiredDescriptionDefault
projectPathNo项目路径

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must convey behavioral traits. It indicates a read operation (viewing status) but does not disclose potential side effects, authentication requirements, or error handling (e.g., what happens if the project path is invalid). The description is minimal in behavioral disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that front-loads the primary purpose. Every word contributes to understanding the tool's function without extraneous information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (one optional parameter, no output schema), the description covers the main output (coverage and PRD association). However, it lacks details on the return format or any additional behavioral context, leaving some gaps for the agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% coverage with a single parameter described as '项目路径' (project path). The description adds no additional semantic value beyond the schema. Since schema coverage is high, baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states the tool's purpose: viewing summary generation status including coverage and PRD association. It distinguishes itself from sibling tools like summary_generate and prd_import by focusing on status retrieval rather than generation or import.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for checking status but does not provide direct guidance on when to use this tool versus alternatives such as summary_generate or prd_search. No explicit exclusions or prerequisites are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 6 tool updatesv0.1.0
    • First observedprd_coverage
    • First observedprd_import
    • First observedprd_search
    • First observedsummary_generate
    • First observedsummary_search
    • First observedsummary_status

TDQS

A3.7/5.0
Disambiguation5/5

Each tool has a distinct purpose: generating summaries, importing PRDs, searching via PRD or summaries, analyzing coverage, and checking status. No overlap.

Naming Consistency5/5

Tool names follow a clear domain_action pattern: 'summary_generate', 'prd_import', 'prd_search', etc. Consistent prefixing and verb usage.

Tool Count5/5

6 tools is well-scoped for the server's purpose of code summary and PRD management. Not excessive or insufficient.

Completeness4/5

Covers core workflows: generation, import, search, coverage, status. Minor gap: no explicit tool for deleting or updating individual summaries, but incremental generation works around.

Maintenance

ActivitySlowing
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables semantic code search across projects using AI embeddings to find code by meaning rather than just text matching. Provides fast intelligent search, symbol analysis, and code similarity detection with multi-language support.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables semantic code search across multiple repositories using natural language queries. Provides intelligent code discovery, symbol lookups, and cross-repo dependency analysis for AI coding agents.
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Enables semantic code search across codebases with automatic incremental indexing. Searches return relevant code snippets with file paths and line numbers based on natural language queries.
    1
    806
    Apache 2.0
  • A
    license
    A
    quality
    F
    maintenance
    Provides code repository indexing and semantic search capabilities, allowing natural language queries to find relevant code snippets with automatic incremental indexing and multi-language support.
    1
    19
    360
    ISC

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lix30684-stack/codegraph-summary'

If you have feedback or need assistance with the MCP directory API, please join our Discord server