pi-codegraph
Click on "Install 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., "@pi-codegraphexplore the architecture of the main module"
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.
@isac322/pi-codegraph
CodeGraph tools for Pi and OMP, with worktree-aware index lifecycle management.
Why this package
The extension exposes CodeGraph's structural tools with native Pi metadata and rendering while keeping OMP on its native MCP path. Indexes are separated per worktree, stored centrally, synchronized automatically, identity-checked, and garbage-collected after worktrees disappear.
Related MCP server: codegraph
Install
Pi
pi install npm:@isac322/pi-codegraphOMP
omp install @isac322/pi-codegraph
omp plugin listRestart OMP or run /reload-plugins after installation. omp install uses the user scope by default.
OMP loads the package-local .mcp.json and omp.extensions entry. Pi loads pi.extensions and starts the internal MCP facade at session start, never during extension discovery.
The package installs @colbymchenry/codegraph@1.4.1 as an optional dependency and falls back to a codegraph executable on PATH.
Node.js 22.19 through Node 24 is required. OMP itself may run under Bun, but it starts this package's compiled MCP facade with the node command declared in .mcp.json; MCP child processes do not inherit or need to match the host agent's runtime.
The repository contains TypeScript source only. Release builds compile it into dist, and the npm tarball includes the compiled JavaScript, declarations, and source maps rather than the TypeScript runtime source.
Tools
codegraph_explore: broad architecture and flow explorationcodegraph_search: symbol-name lookupcodegraph_node: one known symbol and its relationshipscodegraph_files: indexed project structurecodegraph_callers: inbound callscodegraph_callees: outbound callscodegraph_impact: transitive change impactcodegraph_status: CodeGraph index health
Pi adds compact call/result rendering and /codegraph status|sync|doctor|gc.
Worktrees
Each worktree gets a distinct database. New indexes are stored under the configured central index store and exposed to CodeGraph through the worktree's .codegraph symlink. Existing real .codegraph directories remain in place and receive identity metadata.
A project path is accepted only when it is inside an allowed root or resolves to a worktree with the same Git common directory as the session root. Repository and worktree identities are checked before an index is reused. Missing or replaced worktrees fail closed.
Configuration
Global configuration is read from ~/.config/pi-codegraph/config.json, or from PI_CODEGRAPH_CONFIG.
{
"autoSync": true,
"autoGc": true,
"indexStore": "/home/me/.cache/pi-codegraph",
"workerIdleTimeoutMs": 300000,
"maxWorkers": 6,
"requestTimeoutMs": 30000,
"syncMinIntervalMs": 15000,
"maxOutputChars": 60000,
"allowedProjectRoots": ["/work/company"],
"promptInjection": true,
"codegraphExecutable": ""
}Environment overrides:
PI_CODEGRAPH_AUTO_SYNCPI_CODEGRAPH_AUTO_GCPI_CODEGRAPH_INDEX_STOREPI_CODEGRAPH_WORKER_IDLE_MSPI_CODEGRAPH_MAX_WORKERSPI_CODEGRAPH_REQUEST_TIMEOUT_MSPI_CODEGRAPH_SYNC_MIN_INTERVAL_MSPI_CODEGRAPH_MAX_OUTPUT_CHARSPI_CODEGRAPH_ALLOWED_ROOTSPI_CODEGRAPH_PROMPT_INJECTIONPI_CODEGRAPH_EXECUTABLE
PI_CODEGRAPH_ALLOWED_ROOTS uses the platform path delimiter.
Runtime behavior
Pi defers process startup until
session_startand closes all resources onsession_shutdown.OMP uses one package-local MCP facade and project-scoped CodeGraph workers.
Workers are capped, evicted by least-recently-used idle order, and terminated after the idle timeout.
Tool cancellation and timeout propagate to the worker. Diagnostics are ANSI-stripped, size-limited, and redact common token and secret forms.
codegraph_filesaccepts absolute in-project paths and~, normalizing them to repo-relative POSIX prefixes.Large results are bounded and retain both their beginning and end with an explicit truncation marker.
Development
npm ci
npm run typecheck
npm run buildnpm pack and local npm publish run the build through prepack. The release workflow installs locked dependencies, typechecks, builds dist, and publishes that distribution through npm OIDC.
Security
Pi checks project trust before initialization or tool execution. The MCP facade resolves real paths and restricts access to the active workspace, sibling worktrees of the same repository, and explicitly configured roots.
Pi package gallery
The npm package declares the pi-package keyword and an explicit pi.extensions manifest. After npm publication, Pi's package gallery can index it at pi.dev/packages.
Releases are managed by Release Please. Conventional commits on main update a release PR. Merging that PR updates package.json and CHANGELOG.md, creates the version tag and GitHub Release, and publishes the package through npm trusted publishing in the same workflow. See CONTRIBUTING.md for the version rules and release process.
Use fix: for patch releases, feat: for minor releases, and a ! or BREAKING CHANGE: footer for major releases. Configure the npm trusted publisher with GitHub owner isac322, repository pi-codegraph, workflow filename publish.yml, no environment, and the npm publish action.
Shared daemon lifecycle
All Pi and OMP sessions that use the same indexStore attach to one CodeGraph daemon. Each tool request forwards its canonical projectPath, so the daemon can serve multiple repositories and Git worktrees without merging their indexes.
maxWorkers controls the shared daemon's query worker count. workerIdleTimeoutMs controls how long the daemon remains alive after the last Pi or OMP client disconnects; the default is five minutes. Set the same indexStore for every session that should share a daemon.
License
MIT
Available Tools
1 toolcodegraph_statusB
Report CodeGraph index health and pending synchronization state.
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | No | Absolute path to the target project or worktree. Pi fills this with the active cwd when omitted; OMP child agents should pass their exact worktree path. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must convey behavioral traits. The word 'Report' implies a read-only operation, but the description does not explicitly state that the tool is non-destructive, does not require authentication, or has any other behavioral constraints. For a read-only tool, this is a minimal but insufficient disclosure.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single concise sentence that directly states the tool's purpose. There is no extraneous information, and it achieves front-loading of the core function. Every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool is simple (one optional parameter, no output schema), and the description explains the purpose but not the expected output format or example values. Without an output schema, a brief note on what the report contains (e.g., 'Returns health status: green/yellow/red') would improve completeness. As is, it is minimally adequate.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with the parameter 'projectPath' already fully documented in the schema. The tool description adds no additional parameter information, but the baseline score is 3 when schema coverage is high. The description does not compensate for any gaps, nor is it necessary.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: 'Report CodeGraph index health and pending synchronization state.' It uses a specific verb ('Report') and identifies the resource ('CodeGraph index health and pending synchronization state'). With no sibling tools listed, differentiation is not required, and the purpose is unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
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, nor does it specify prerequisites or exclusions. There are no sibling tools to reference, but even a brief note on typical scenarios (e.g., 'Use to check if indexing is complete') would improve this dimension.
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 tool update
v0.3.1- First observed
codegraph_status
TDQS
With only one tool, there is no potential for confusion or ambiguity among tools.
Single tool name follows a clear pattern (codegraph_status), consistent with itself.
A single tool is too few for meaningful interaction; suggests insufficient scope for a standalone server.
Only one reporting tool; missing core operations like querying, updating, or managing the code graph.
Maintenance
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
Ground-truth code graph for your codebase: exact callers, callees, symbols & dependencies.
Ask a codebase what calls what: search, blast radius, paths between symbols, and diffs.
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Hosted code graph over MCP: exact callers, dependencies, and cross-repo blast radius for AI agents.
251
Related MCP Servers
- FlicenseAqualityCmaintenanceIndexes a workspace and exposes code-navigation tools to Codex, enabling symbol lookup, reference finding, dependency analysis, and security audit for local codebases.10-
- AlicenseNot gradedqualityBmaintenanceIndexes a codebase into a live symbol graph and serves it via MCP to AI coding tools for context-aware code queries.351MIT
- AlicenseAqualityBmaintenanceEnables AI assistants to search, analyze, and understand multi-language codebases by providing indexed code intelligence via MCP.167527MIT
- FlicenseNot gradedqualityAmaintenanceEnables developer agents to perform semantic codebase search, dependency and impact analysis, cross-file refactoring, and full-stack API tracing through a unified query DSL over a high-performance graph engine.-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/isac322/pi-codegraph'
If you have feedback or need assistance with the MCP directory API, please join our Discord server