Pharaoh - Your AI breaks things it can't see
Pharaoh maps codebases into a queryable knowledge graph so coding agents can get architectural answers—structure, dependencies, blast radius, dead code—instead of reading files one by one.
get_codebase_map — a repo's full architecture: modules with file counts/LOC, module dependencies (two-way flagged), most-changed files, endpoints, entry points, and risk signals (untested high-risk functions, clones, cycles).
pharaoh_recon — run several queries in one parallel call: codebase map, up to 5 module profiles, 3 function searches, 3 blast-radius targets, and 3 module dependency paths.
get_module_context — one module's profile: files, LOC, exported signatures with complexity, imports in/out, DB tables, endpoints, cron jobs, env vars, and cross-module callers.
get_blast_radius — what a change to a function, file, or module reaches: risk, production callers by module/file, endpoints, cron jobs, and DB operations across 1–5 hops (test callers excluded).
search_functions — find functions by name or concept with path, line range, module, signature, export status, and complexity; also surfaces matching constants for SCREAMING_SNAKE queries.
get_unused_code — call-graph reachability: dead code, possibly-unused code (with the files that name it), test-only-used exports, or the call path from an entry point for specific functions.
pharaoh_setup — check sign-in state, whether the repo is mapped, whether the Pharaoh-first instructions line is in use, plus up to three suggested starter questions for the repo (writes nothing).
pharaoh_account — see each workspace's plan and tracked-repo count, push-mapping status, and links to setup/billing pages (read-only).
pharaoh_manage_repo — queue a delta or full re-map of a repo (
refresh_repo);set_free_repois retired and does nothing.
Integrates with GitHub through a dedicated App and webhooks to automatically map repositories and synchronize codebase changes for architectural analysis.
Provides structural intelligence for Python codebases, allowing agents to map module dependencies, search for functions, and trace execution paths.
Provides structural intelligence for TypeScript codebases, allowing agents to map module dependencies, search for functions, and trace execution paths.
This server has a remotely hosted endpoint. Open its connector listing for connection details, authentication requirements, and setup instructions:
@pharaoh-so/mcp
MCP proxy for Pharaoh — maps codebases into queryable knowledge graphs for coding agents.
Pharaoh gives coding agents such as Claude Code, Cursor, Codex and OpenClaw a complete architectural map of your codebase: every function, dependency, module, and connection. Instead of reading files one at a time, your agent queries the knowledge graph and gets instant answers about blast radius, unused code, dependency chains, and more.
This package enables Claude Code to connect to Pharaoh in headless environments (VPS, SSH, containers, CI) where a browser isn't available for OAuth. It acts as a stdio-to-SSE proxy, presenting itself as a local MCP server while relaying all communication to the remote Pharaoh server.
Quick Start
Step 1 — Authenticate
Run the proxy directly to trigger the device authorization flow:
npx @pharaoh-so/mcpThis displays a device code and a URL. Open the URL on any device (phone, laptop, tablet) and enter the code to authorize. Credentials are saved to ~/.pharaoh/credentials.json and remain valid for 7 days, with automatic re-authorization when they expire.
Step 2 — Add to Claude Code
npx @pharaoh-so/mcpVerify the connection:
claude mcp listYou should see pharaoh listed as a stdio server.
Switching from SSE
If you previously added Pharaoh as an SSE server, remove it first:
claude mcp remove pharaoh
npx @pharaoh-so/mcpRelated MCP server: Context7 MCP
How It Works
Claude Code ← stdio → @pharaoh-so/mcp ← SSE/HTTP → mcp.pharaoh.soThe proxy implements the Model Context Protocol (MCP) specification:
Claude Code launches the proxy as a child process and communicates via stdio (stdin/stdout)
The proxy authenticates with Pharaoh using stored credentials (or triggers device flow)
All MCP messages (tool calls, responses, notifications) are relayed to the remote Pharaoh server over SSE (Server-Sent Events)
Pharaoh queries the knowledge graph and returns architectural data to the proxy
The proxy forwards responses back to Claude Code via stdio
Authentication uses RFC 8628 (OAuth 2.0 Device Authorization Grant) — no browser is needed on the machine running Claude Code.
Available Tools
Once connected, Pharaoh provides these MCP tools:
Orient
Tool | What it answers |
| What modules exist and how do they relate? |
| What does this module look like before I modify it? |
| Does this function already exist somewhere? |
| Map, module context, search and blast radius in one call |
Investigate
Tool | What it answers |
| What breaks if I change this function/file/module? |
Manage
Tool | What it answers |
| Check plan, toggle PR Guard, trigger refresh |
| Org-level administration |
Inspect Mode
Use --inspect to dump the full tool manifest as JSON (useful for MCP registry validation and debugging):
npx @pharaoh-so/mcp --inspectThis outputs the complete list of tools with their schemas and exits immediately, without connecting to the server.
CLI Options
Usage: pharaoh-mcp [options]
Options:
--server <url> Pharaoh server URL (default: https://mcp.pharaoh.so)
--logout Clear stored credentials and exit
--inspect Output tool manifest as JSON and exit
--help Show help
--version Show version numberConfiguration
Credentials
Credentials are stored at ~/.pharaoh/credentials.json with 0600 permissions (owner-read/write only). The file contains:
Access token — used to authenticate MCP requests
Refresh token — used to obtain new access tokens when they expire
Expiry timestamp — tokens are refreshed automatically before expiration
To clear credentials:
npx @pharaoh-so/mcp --logoutCustom Server
For self-hosted Pharaoh instances or development, register manually, pinned to a version (npx @pharaoh-so/mcp --version prints the one you have):
claude mcp add --scope user pharaoh -- npx @pharaoh-so/mcp@<version> --server https://your-pharaoh-instance.comEnvironment Variables
Variable | Default | Description |
|
| Pharaoh server URL (alternative to |
Requirements
Node.js >= 18
Claude Code or any MCP-compatible agent
A Pharaoh account — sign up at pharaoh.so
Security
Credentials are stored with restrictive file permissions (
0600— owner-read/write only)Authentication uses the RFC 8628 device authorization flow — no secrets are embedded in the package
All communication with the Pharaoh server uses HTTPS/TLS
The proxy never sends your code or the text of any file. Pharaoh reads your code from GitHub through its GitHub App, maps it into a knowledge graph of structural metadata (function names, file paths, dependency relationships), and deletes the clone when mapping ends.
From 0.3.60, when it connects, the proxy also tells Pharaoh whether your
~/.claude/CLAUDE.mdholds the line setup suggests, mentions Pharaoh another way, doesn't, or is missing, and whether setup's block is still in it. In Claude Code started at a git repo's root, it does the same for that project'sCLAUDE.md,CLAUDE.local.md,.claude/CLAUDE.mdandAGENTS.md. Only these values are sent, never the files' text.Tokens expire after 7 days and are refreshed automatically
Only use trusted server URLs — the proxy sends your auth token to the configured server
The proxy's only network calls are the device flow, token refresh, the MCP connection, and one registry lookup during interactive setup (below). Over the MCP connection it tells Pharaoh which client it serves (the name and version that client reports) and whether Pharaoh's Claude Code plugin is enabled, which it reads from
~/.claude/settings.json. Nothing else about your machine is sent.
What the installer writes on your machine
npx @pharaoh-so/mcp in a terminal is the interactive setup. Every later proxy start (Claude Code launching the server) repeats the plugin, skill and command steps so a new version takes effect, and nothing else.
Path | Mode | When | What |
|
| Always | Credentials and the Claude Code plugin marketplace |
|
| After sign-in | Access token, refresh token, expiry |
| — |
| The one-plugin marketplace Claude Code installs as |
| — |
| Slash commands. A file is written only when it is absent or is Pharaoh's: it carries the front-matter comment |
| — | Interactive setup | Removes earlier |
| — | Interactive setup, and only if the file already exists | Adds to |
| — |
| The review skill for Codex ( |
| — |
| Skills prefixed |
Versions 0.3.46 and earlier wrote one rule, mcp__pharaoh, on every proxy start. That prefix auto-approved every Pharaoh tool, including account deletion and pharaoh_admin, so a prompt injection could run them without a human prompt. The next interactive setup replaces that rule with the list above; account deletion, pharaoh_admin and any tool not listed prompt before they run. To take the blanket rule out by hand, delete mcp__pharaoh from permissions.allow.
Pinned version and upgrades
Every registration the setup writes runs the exact version that wrote it (npx @pharaoh-so/mcp@<version>). A new release on npm changes nothing on your machine until you upgrade:
npx @pharaoh-so/mcp@latestThis signs you in again, rewrites the registration with the new version and refreshes the plugin. The interactive setup asks the npm registry for the newest version and prints a one-line hint when there is one; proxy starts never check.
Reporting Vulnerabilities
If you discover a security vulnerability, please report it responsibly by emailing security@pharaoh.so. Do not open a public issue.
Troubleshooting
"Connection refused" or "ECONNREFUSED"
The Pharaoh server may be temporarily unavailable. Check status.pharaoh.so or try again in a few minutes.
"Token expired" or "401 Unauthorized"
Re-authenticate by running the proxy directly:
npx @pharaoh-so/mcpOr clear credentials and start fresh:
npx @pharaoh-so/mcp --logout
npx @pharaoh-so/mcp"pharaoh" not showing in claude mcp list
Make sure you added it with the correct command:
npx @pharaoh-so/mcpNote the -- separator between pharaoh and npx.
Device code not working
Ensure you're opening the URL on a device with browser access
The device code expires after 15 minutes — request a new one by re-running the command
Check that you're logged into GitHub when authorizing
Slow startup
The first run after installation may take a moment as npm downloads the package. Subsequent runs use the cached version. To pre-install globally:
npm install -g @pharaoh-so/mcp
claude mcp add --scope user pharaoh -- pharaoh-mcpHow Pharaoh Works
Pharaoh parses your repositories using tree-sitter and maps structural metadata into a Neo4j knowledge graph. The graph contains:
Functions — names, signatures, complexity scores, export visibility
Files — paths, module membership, language classification
Modules — logical groupings detected from directory structure
Dependencies — import/export relationships, call chains, module connections
Vision specs — PRD/spec documents linked to implementation
No source code is stored — only structural metadata. When an agent queries Pharaoh, it gets architectural facts in minimal tokens, not raw code dumps. This means your agent can understand your entire codebase architecture without consuming its context window reading files one by one.
Supported Languages
TypeScript / JavaScript — full support (functions, classes, imports, exports, JSX)
Python — full support (functions, classes, imports, decorators)
More languages planned via tree-sitter grammar support
Contributing
Contributions are welcome. Please open an issue first to discuss what you'd like to change.
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
License
MIT -- 2407066 Alberta Inc.
Links
Available Tools
11 toolsget_blast_radiusBlast RadiusARead-onlyInspect
What a change to a function, file or module reaches.
CALL THIS WHEN: • Changing a signature, refactoring or deleting code • Finding a change's callers or entry points
RETURNS: Detected production callers (depth 1 is direct only). Hosted adds risk, endpoints, cron jobs and DB operations. Verified worktrees report saved-file callers and coverage.
Inputs: repo (required), entity (required), entity_type (required), depth, +2 more.
get_codebase_mapCodebase MapARead-onlyInspect
A repo's architecture in one call.
CALL THIS WHEN: • Orienting in a repo or locating a module • The mapped repo name is unknown
RETURNS: Modules and LOC, dependencies and cycles, hot files (5), endpoints (50), entry points (30), exact clones and high-risk functions without direct test links.
Inputs: repo (required), include_health, include_metrics.
get_issueIssue DetailsARead-onlyInspect
A Codebase Health issue by its Pharaoh ID: one repo's exact duplicates, dependency cycles or complex functions, or one finding among them.
CALL THIS WHEN: • A prompt or an earlier answer gives you an issue ID (pharaoh:owner/repo:…)
RETURNS: The repo's live Health score and mapped commit; each finding's ID, files, related findings and file-disjoint group; and the points its removal adds to the score.
Inputs: id (required), repo (required), cursor.
get_module_contextModule ContextARead-onlyInspect
One module's profile: what it contains, depends on and is called by.
CALL THIS WHEN: • Changing code in a module, or planning a change to it • Finding what a module exports, depends on, or which code calls into it
RETURNS: Files, LOC, exported signatures with complexity, imports in and out, DB tables, endpoints, cron jobs, env vars, and callers in other modules, grouped by module.
Inputs: repo (required), module (required).
get_unused_codeUnused CodeARead-onlyInspect
Find code nothing runs: functions no production entry point (endpoint, CLI command, cron job, event handler, worker, entry file) reaches.
CALL THIS WHEN: • Cleaning up a module or deleting a function • Confirming new code is reached from an entry point
RETURNS: Reachability through the call graph, not text references.
• Dead: unreached, named in no other file, and no import of its file could reach it.
• Possibly unused: unreached, but named in other files (string dispatch, dynamic loading) or an import of its file could reach it. Listed with the files that name it.
• Used only by tests: exported functions and class methods only test files reference.
With functions: each one's status, and the call path from an entry point when it's reachable.
Inputs: repo (required), module, functions.
pharaoh_accountAccount StatusARead-onlyInspect
Your Pharaoh plan and mapped repos in each workspace. Changes nothing.
CALL THIS WHEN: • Checking which plan a workspace is on • A tool says the plan doesn't include it, or a repo isn't mapped • Finding the setup page or the billing page
RETURNS: Each workspace you can access with its plan and tracked-repo count, whether its repos are mapped on every push, the setup page, and the billing page when a workspace has a billing account.
Inputs: action.
pharaoh_manage_repoRefresh RepoADestructiveInspect
Re-map a repo now. Every repo is mapped during the trial and on Pro, and re-maps on every push.
• refresh_repo { repo, full? }: queue a re-map of one repo. • set_free_repo { repo }: retired; it changes nothing, since there is no live repo to choose.
CALL THIS WHEN: • A repo's graph looks out of date, or needs a full rebuild
RETURNS: The queued job.
Inputs: repo (required), action (required), full.
pharaoh_reconCodebase ReconARead-onlyInspect
Several Pharaoh queries in one call, run in parallel: codebase map, module profiles, function searches, blast radius and module dependency paths.
CALL THIS WHEN: • Planning a change, reviewing a PR or assessing architecture, when the modules and functions to check are known
RETURNS: Each requested section in one response, as the single-purpose tools return it. Per call: up to 5 modules, 3 searches, 3 blast radius targets, 3 dependency pairs.
Inputs: repo (required), modules, functions, include_map, +2 more.
pharaoh_setupSetupARead-onlyInspect
Pharaoh's connection and setup status for the repo you're working in. Writes no files.
CALL THIS WHEN: • The user asks to set up Pharaoh, or to check its setup • Pharaoh was just connected and the user asks what to try first
RETURNS: Connection, mapped-repo and access status, a Codebase Health link, optional first-use choices, and the Pharaoh-first instructions line only when needed.
Inputs: repo (required).
pharaoh_updateUpdate PharaohADestructiveIdempotentInspect
Update the npx proxy to the newest Pharaoh release, with the user's consent.
CALL THIS WHEN: • The user asks to update Pharaoh, or accepts a notice that a new Pharaoh version is available
RETURNS: On the npx proxy, whether the newest release passed verification (npm's registry signature and its build provenance) and is staged; it becomes active at the next session start. On a hosted connection, that it is already current.
Inputs: no named parameters.
search_functionsSearch FunctionsARead-onlyInspect
Find functions by name or concept across the whole codebase.
CALL THIS WHEN: • Checking whether a function, helper or utility already exists • Finding where something is implemented (e.g. "retry", "validate", "notify")
RETURNS: Matching functions with file path, line range, module, signature, export status and complexity. Matches name parts (camelCase, snake_case) and file paths, not comments; test code ranks last. SCREAMING_SNAKE queries, and queries no function matches, return matching constants with up to 80 characters of each value.
Inputs: repo (required), query (required), file, limit, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Most tools target distinct concepts: architecture map, module profile, function search, blast radius, dead code, health issue, and account/setup/update admin. However, pharaoh_recon explicitly batches get_codebase_map, get_module_context, search_functions and get_blast_radius, so an agent must decide between the batch call and the single-purpose tools; get_module_context's 'callers in other modules' also partially overlaps get_blast_radius.
Two clear families exist: query tools use get_/search_ prefixes (get_blast_radius, get_issue, get_codebase_map, get_module_context, get_unused_code, search_functions) and admin tools use a pharaoh_ prefix (pharaoh_account, pharaoh_setup, pharaoh_update, pharaoh_manage_repo, pharaoh_recon). The grouping is readable, but mixing get_ with pharaoh_ prefixes and noun-style names (pharaoh_account, pharaoh_setup) with verb-style names (pharaoh_update, pharaoh_manage_repo) is a minor inconsistency.
11 tools is well within a comfortable range and each covers a distinct analysis surface or a distinct account operation. No tool feels like filler; pharaoh_recon is a justified convenience wrapper and pharaoh_update/setup are small but purposeful.
The read-only codebase-intelligence surface is broad (map, module, search, blast radius, dead code) but get_issue requires a Pharaoh issue ID from elsewhere, and no tool lists a repo's Codebase Health findings — an agent with no ID hits a dead end. There is also no way to enumerate all findings across a repo or filter them, though core analysis workflows are otherwise covered.
Maintenance
Related MCP Connectors
AI Agent with Architectural Memory. Impact analysis (free), tests and code from the graph (pro).
Give your AI agent a persistent map of your project's structure, dependencies, and bugs.
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Codebase intelligence for AI coding agents: graph, git history, docs, decisions, code health.
Related MCP Servers
AlicenseAqualityBmaintenanceA remote Model Context Protocol server acting as middleware to the Sentry API, allowing AI assistants like Claude to access Sentry data and functionality through natural language interfaces.74973Functional Source , Version 1.1, ALv2 Future- AlicenseAqualityBmaintenanceA Model Context Protocol server that fetches up-to-date, version-specific documentation and code examples from libraries directly into LLM prompts, helping developers get accurate answers without outdated or hallucinated information.265,338MIT
- AlicenseNot gradedqualityFmaintenanceThis read-only MCP Server allows you to connect to GitHub data from Claude Desktop through CData JDBC Drivers. For full CRUD support, check out the first managed MCP platform: CData Connect AI (https://www.cdata.com/ai/).MIT
- AlicenseNot gradedqualityDmaintenanceProvides AI-enhanced code search capabilities by integrating with Sourcegraph, allowing AI assistants to search across multiple repositories and codebases with advanced query syntax.42MIT