PrecisionContextEngine
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PrecisionContextEngine Initialize the project and find the main entry point."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
PCE — Precision Context Engine
为 AI 编程 Agent 设计的代码库理解减负及加速层
大型代码库理解的最大成本不是"搜索",而是反复 grep、手工翻目录、拼接调用链带来的上下文消耗。PCE 通过 MCP 暴露的工具接口把入口定位、链路梳理、影响面分析从主 Agent 中拆出来:
节省主 Agent 上下文:代码库调研由 PCE 独立完成,主 Agent 的上下文窗口不被探索过程消耗,得以在一轮会话中连续完成目标任务
降低模型调用成本:PCE 的分析任务不依赖旗舰模型——推荐使用参数量小、速度快的轻量模型,性价比更高,响应更快
推荐模型(实测性价比均衡):
xiaomi/mimo-v2-flash·openai/gpt-5.4-mini·openai/gpt-5.4-nano
工具一览
工具 | 用途 |
| 绑定项目,构建索引与导航上下文 |
| 定位入口、梳理模块职责与主干调用链 |
| 分析已知目标的影响边界、下游传播链与变更风险 |
| 代码变更后增量同步索引与认知状态 |
| 查看初始化状态、索引信息与 staging 状态 |
典型工作流:
pce_init → pce_query → pce_impact → [修改代码] → pce_sync目标未知 → 先用
pce_query目标已知,评估波及面 → 用
pce_impact改完代码后 → 用
pce_sync
Related MCP server: Symbol Delta Ledger
快速接入(MCP)
推荐直接以 MCP 方式接入,无需手动启动服务。
Claude Code
在 MCP 配置文件中添加:
{
"pce": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/Bluezeamer/PrecisionContextEngine",
"pce",
"serve"
],
"env": {
"PCE_PROVIDER": "openrouter",
"PCE_MODEL": "openai/gpt-5.4-nano",
"PCE_API_KEY": "your_api_key",
"PCE_TEMPERATURE": "1.0",
"PCE_AGENT_TIMEOUT": "1200"
}
}
}Codex
[mcp_servers.pce]
command = "uvx"
startup_timeout_sec = 60
args = ["--python", "3.11", "--from", "git+https://github.com/Bluezeamer/PrecisionContextEngine", "pce", "serve"]
tool_timeout_sec = 1200
[mcp_servers.pce.env]
PCE_PROVIDER = "openrouter"
PCE_MODEL = "openai/gpt-5.4-nano"
PCE_API_BASE = "https://openrouter.ai/api/v1"
PCE_API_KEY = "your_api_key"
PCE_TEMPERATURE = "1.0"
PCE_AGENT_TIMEOUT = "1200"[重要]提示词建议
经过实测MCP本身的工具调用提示词在各Agent内部的引导优先级权重不高,容易被淹没在大量的工具噪音里。因此为了强化主Agent适时使用PCE的倾向获得更好的使用体验,建议将AGENTS.md中的内容复制粘贴到你的目标Agent系统提示词约束中——例如对于claudecode来说是CLAUDE.md,对于codex来说是AGENTS.md。
环境变量
变量 | 必填 | 说明 |
| 是 | LiteLLM provider,如 |
| 是 | provider 下的模型名 |
| 是 | 对应模型的 API Key |
| 否 | 自定义兼容端点 |
| 否 | 全局温度,默认 |
| 否 | Agent 总超时(秒),默认 |
| 否 | 每模型 completion 重试次数,默认 |
| 否 | fallback 模型链,逗号分隔 |
完整示例见 .env.example。
本地部署
环境要求:Python 3.11–3.12,uv
uv sync --all-extras
cp .env.example .env # 按上表填写必填变量
uv run pce serve # 以 stdio MCP server 方式运行License
GPL-3.0
Available Tools
5 toolspce_impactA
Purpose: The primary tool for analyzing the impact boundary of a known change target. Outputs direct call sites, direct consumers, main propagation chains, risks, and suggested modification order. When to use: Use when you already know which symbol, field, interface contract, or file to change, and want to understand what will be affected before making the change. Best practice: Provide an explicit target; if you know the file containing the symbol, also provide the file parameter to speed up resolution. Frame the question as a concrete change, e.g. 'modify field X', 'change function signature of Y', 'what breaks if file Z is deleted'. Avoid: If the target is still ambiguous or you are choosing between multiple candidates, do not use impact as a substitute for the discovery step — use pce_query first to converge on the target. If you only want to view local implementation or exact definitions, impact is not necessary.
Inputs: target (required), change_type (required), file.
pce_initA
Purpose: Bind a target project and initialize the PCE runtime, building the index and navigation context required by query / impact / sync. When to use: Call this when entering a new project or the first time PCE is needed in a session. Do NOT call pce_query, pce_impact, pce_sync, or edit tools before pce_init succeeds. Best practice: Typically called once per session and awaited until success. Only call again when switching projects or retrying after a failure. Avoid: Do not use this as a code query tool; it establishes context but does not directly answer code questions.
Inputs: project_path (required).
pce_queryA
Purpose: The primary tool for codebase navigation and understanding. Best suited for project-level understanding, architecture overviews, major module responsibilities, entry points, main call chains, candidate file scopes, and overall project/module comprehension. When to use: Use when the target location is unclear. When you do not know which file contains the information, need to understand what the project or a subsystem does, need a rough architecture or module-level picture, want to find entry points / main call chains / module responsibilities, or need to narrow down the search scope — use this tool first. Do NOT manually traverse directories, broadly inspect the repo, or batch-read files before trying pce_query. Best practice: Prefer describing your question in natural language rather than just giving exact identifiers. This tool is especially appropriate for questions like what the project does, how a subsystem is organized, where a feature lives, or which modules participate in a workflow. You can request file:line references, name_path, candidate file lists, call chain summaries, or results grouped by module. Avoid: When you already know the exact file or exact identifier and only need to view local implementation or do exact string matching, pce_query is not necessary. If the target is already clear and the task becomes 'what will be affected by changing it', switch to pce_impact instead.
Inputs: query (required).
pce_statusA
Purpose: Return current service and project status, including initialization phase, index statistics, staging area, and warnings. When to use: Use when you need to confirm whether PCE is available, whether the index has been built, or to diagnose init / query / impact / sync issues. Best practice: Treat this as a diagnostic tool. When unsure whether to call init or sync first, check status. Avoid: Do not use this as a code understanding tool; it does not locate entry points, call chains, or impact boundaries.
Inputs: no named parameters.
pce_syncA
Purpose: Synchronize Serena and PCE index state after codebase modifications, so subsequent query / impact calls work against the latest code. When to use: Use after completing a batch of code modifications, file deletions, renames, or structural changes. Best practice: Use this as a batch synchronization step; typically call once after completing a round of changes, rather than after every small edit. Avoid: Do not use this as a code understanding tool; it refreshes index state but does not explain code.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool occupies a distinct lifecycle role: init sets up, status diagnoses, query discovers, impact analyzes changes, and sync refreshes. The descriptions explicitly warn against cross-use, particularly between query and impact, so an agent can reliably select the right tool.
All tools share a consistent pce_ prefix and a single lowercase keyword, making the pattern immediately predictable. Although the second words mix verbs and nouns, the convention is uniform and readable.
Five tools is well-scoped for a context engine: setup, status, discovery, impact analysis, and synchronization cover the core workflow without redundancy. No tool feels decorative or missing from the set.
The lifecycle is complete: init builds context, status verifies it, query consumes it for exploration, impact consumes it for change analysis, and sync brings it up to date after edits. There are no obvious dead ends for the stated purpose.
Maintenance
Related MCP Connectors
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Codebase intelligence for AI agents — dead code, blast radius, ownership.
Codebase intelligence for agents: 152 structured artifacts across 21 programs, one call.
Deterministic context layer for your codebase: change impact, blast radius, answers with receipts.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI coding agents to query a pre-built semantic knowledge graph of code, reducing token usage and tool calls. Supports 16 tools for code exploration, analysis, and context building.19 npm8MIT
- FlicenseNot gradedqualityAmaintenanceEnables AI coding agents to efficiently query code context via a symbol graph, reducing token usage by up to 20x.1,021 npm498-
- AlicenseNot gradedqualityCmaintenanceEnables AI coding agents to analyze codebase behavior through entrypoints, call paths, and tests, providing impact analysis and context packs for code changes.MIT
- AlicenseNot gradedqualityDmaintenanceEnables LLM agents to efficiently understand and navigate a codebase by providing semantic search over symbols and a reference graph, replacing expensive grep/glob calls with structured tools like definition lookup, caller/callee queries, and change-impact analysis.4MIT