Pharaoh

so.pharaoh由 pharaoh.so 發布官方發布者v1.0.286更新於 Nov 8, 2026

Codebase knowledge graph — architectural awareness for AI coding agents via MCP

已驗證Streamable HTTP可網頁執行知識與記憶開發者工具

概覽

AI 產生的概覽

Pharaoh 為編碼助理提供已對應程式碼庫的可查詢知識圖譜,不必逐一讀取檔案就能回答架構、相依與影響範圍問題。

可以做什麼
  • 對應儲存庫的模組、相依、熱點檔案、端點與進入點
  • 依名稱或概念搜尋函式,並檢視模組的匯出、匯入與呼叫端
  • 評估函式、檔案或模組變更的影響範圍,找出沒有進入點可達的程式碼
  • 平行執行多項查詢,用於變更規劃或 PR 審查
  • 查看連線、方案與已對應儲存庫狀態,並觸發儲存庫重新對應
適用情境
適用於助理在 TypeScript、JavaScript 或 Python 儲存庫中工作,需要快速掌握整體架構、重構前評估影響範圍或找出死程式碼的情況。也適合變更規劃與拉取請求審查,以結構化事實取代逐一讀取檔案。
執行需求
需要 Pharaoh 帳號並透過 OAuth 登入(無瀏覽器環境使用裝置授權流程)。儲存庫須透過安裝在所屬帳號或組織的 Pharaoh GitHub App 完成對應。npm 代理需要 Node.js 18 以上版本;也可使用 mcp.pharaoh.so 遠端端點。憑證儲存在本機,7 天後過期。
安裝前請注意
此代理會寫入 Claude Code、Codex 與 OpenClaw 的設定目錄,包括斜線命令、技能與權限允許清單項目,安裝前應確認其變更。它會向 Pharaoh 回報 CLAUDE.md、AGENTS.md 等檔案的有限中繼資料以及所連線的用戶端資訊。舊版本曾自動核准所有 Pharaoh 工具,包括帳號刪除與管理工具,應移除 mcp__pharaoh 這條萬用規則。僅在可信任的伺服器位址下使用,因為它會把驗證權杖傳送到該位址。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Pharaoh,將其新增到工作區。
  2. 連接 所需的 憑證。它們會被私密儲存,絕不會在公開頁面上展示。
  3. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/so.pharaoh%2Fpharaoh/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。 客戶端會在首次連接時完成 OAuth 登入。

{
  "mcpServers": {
    "pharaoh": {
      "type": "http",
      "url": "https://mcp.pharaoh.so/mcp"
    }
  }
}

README

@pharaoh-so/mcp

[npm version] [license] [node] [pharaoh MCP server]

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:

bash
npx @pharaoh-so/mcp

This 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

bash
npx @pharaoh-so/mcp

Verify the connection:

bash
claude mcp list

You should see pharaoh listed as a stdio server.

Switching from SSE

If you previously added Pharaoh as an SSE server, remove it first:

bash
claude mcp remove pharaohnpx @pharaoh-so/mcp

How It Works

Claude Code ← stdio → @pharaoh-so/mcp ← SSE/HTTP → mcp.pharaoh.so

The proxy implements the Model Context Protocol (MCP) specification:

  1. Claude Code launches the proxy as a child process and communicates via stdio (stdin/stdout)
  2. The proxy authenticates with Pharaoh using stored credentials (or triggers device flow)
  3. All MCP messages (tool calls, responses, notifications) are relayed to the remote Pharaoh server over SSE (Server-Sent Events)
  4. Pharaoh queries the knowledge graph and returns architectural data to the proxy
  5. 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

ToolWhat it answers
get_codebase_mapWhat modules exist and how do they relate?
get_module_contextWhat does this module look like before I modify it?
search_functionsDoes this function already exist somewhere?
pharaoh_reconMap, module context, search and blast radius in one call

Investigate

ToolWhat it answers
get_blast_radiusWhat breaks if I change this function/file/module?

Manage

ToolWhat it answers
pharaoh_accountCheck plan, toggle PR Guard, trigger refresh
pharaoh_adminOrg-level administration

Inspect Mode

Use --inspect to dump the full tool manifest as JSON (useful for MCP registry validation and debugging):

bash
npx @pharaoh-so/mcp --inspect

This 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 number

Configuration

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:

bash
npx @pharaoh-so/mcp --logout

Custom Server

For self-hosted Pharaoh instances or development, register manually, pinned to a version (npx @pharaoh-so/mcp --version prints the one you have):

bash
claude mcp add --scope user pharaoh -- npx @pharaoh-so/mcp@<version> --server https://your-pharaoh-instance.com

Environment Variables

VariableDefaultDescription
PHARAOH_SERVER_URLhttps://mcp.pharaoh.soPharaoh server URL (alternative to --server)

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.md holds 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's CLAUDE.md, CLAUDE.local.md, .claude/CLAUDE.md and AGENTS.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.

PathModeWhenWhat
~/.pharaoh/0700, set again on every startAlwaysCredentials and the Claude Code plugin marketplace
~/.pharaoh/credentials.json0600After sign-inAccess token, refresh token, expiry
~/.pharaoh/claude-marketplace/—~/.claude/ existsThe one-plugin marketplace Claude Code installs as pharaoh@pharaoh: the skills and the Grep routing hook. Rewritten when the package version changes
~/.claude/commands/plan.md, review.md—~/.claude/ existsSlash commands. A file is written only when it is absent or is Pharaoh's: it carries the front-matter comment # managed-by: pharaoh-mcp, or has the exact header and $ARGUMENTS footer of a Pharaoh command from 0.3.46 or earlier. Any other file with that name is yours: it is kept, a symlink is never followed, and the setup output names it. Rename your file to keep both. 0.3.51 and earlier also wrote sessions.md; later versions delete it while it carries the marker
~/.claude.json—Interactive setupRemoves earlier pharaoh entries, then claude mcp add --scope user pharaoh -- npx @pharaoh-so/mcp@<version>
~/.claude/settings.json—Interactive setup, and only if the file already existsAdds to permissions.allow, each by full name: mcp__pharaoh__get_codebase_map, mcp__pharaoh__get_module_context, mcp__pharaoh__search_functions, mcp__pharaoh__get_blast_radius, mcp__pharaoh__get_unused_code, mcp__pharaoh__pharaoh_recon, mcp__pharaoh__pharaoh_account. The setup prints a line saying what it did. The proxy never creates this file and never touches it on a start
~/.agents/skills/pharaoh-review/—~/.codex/ existsThe review skill for Codex ($pharaoh-review), rewritten on every start. Other tools share ~/.agents/skills/, so nothing else there is touched
~/.openclaw/skills/, ~/.openclaw/openclaw.json—~/.openclaw/ existsSkills prefixed pharaoh-, and an mcpServers.pharaoh entry running npx @pharaoh-so/mcp@<version>. An entry that is not an npx @pharaoh-so/mcp command is left alone

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:

bash
npx @pharaoh-so/mcp@latest

This 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 [email protected]. 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:

bash
npx @pharaoh-so/mcp

Or clear credentials and start fresh:

bash
npx @pharaoh-so/mcp --logoutnpx @pharaoh-so/mcp

"pharaoh" not showing in claude mcp list

Make sure you added it with the correct command:

bash
npx @pharaoh-so/mcp

Note 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:

bash
npm install -g @pharaoh-so/mcpclaude mcp add --scope user pharaoh -- pharaoh-mcp

How 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.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT -- 2407066 Alberta Inc.

Links

來源:README.md,提交 be82947

工具

9

get_codebase_map

Codebase Map

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.

輸入參數repo必填include_healthinclude_metrics

pharaoh_recon

Codebase Recon

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.

輸入參數repo必填modulesfunctionsinclude_mapblast_radiusdependencies

get_module_context

Module Context

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.

輸入參數repo必填module必填

get_blast_radius

Blast Radius

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.

輸入參數repo必填depthscopeentity必填entity_type必填local_context

search_functions

Search Functions

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.

輸入參數filerepo必填limitquery必填moduleoffsetexported_only

get_unused_code

Unused Code

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.

輸入參數repo必填modulefunctions

pharaoh_setup

Setup

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.

輸入參數repo必填

pharaoh_account

Account Status

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.

輸入參數action

pharaoh_manage_repo

Refresh Repo

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.

輸入參數fullrepo必填action必填

版本歷史

60
  1. v1.0.286最新Nov 7, 2026
  2. v1.0.281Nov 6, 2026
  3. v1.0.280Nov 5, 2026
  4. v1.0.279Nov 5, 2026
  5. v1.0.278Nov 5, 2026
  6. v1.0.274Nov 5, 2026
  7. v1.0.272Nov 4, 2026
  8. v1.0.271Nov 3, 2026
  9. v1.0.270Nov 1, 2026
  10. v1.0.269Oct 30, 2026
  11. v1.0.268Oct 30, 2026
  12. v1.0.265Oct 26, 2026
  13. v1.0.264Oct 26, 2026
  14. v1.0.263Oct 25, 2026
  15. v1.0.261Oct 24, 2026
  16. v1.0.260Oct 23, 2026
  17. v1.0.259Oct 23, 2026
  18. v1.0.257Oct 22, 2026
  19. v1.0.256Oct 21, 2026
  20. v1.0.255Oct 20, 2026
  21. v1.0.252Oct 19, 2026
  22. v1.0.249Oct 18, 2026
  23. v1.0.248Oct 17, 2026
  24. v1.0.245Oct 17, 2026
  25. v1.0.244Oct 16, 2026
  26. v1.0.242Oct 16, 2026
  27. v1.0.239Oct 15, 2026
  28. v1.0.237Oct 15, 2026
  29. v1.0.236Oct 15, 2026
  30. v1.0.235Oct 15, 2026
  31. v1.0.233Oct 14, 2026
  32. v1.0.229Oct 13, 2026
  33. v1.0.228Oct 13, 2026
  34. v1.0.227Oct 11, 2026
  35. v1.0.226Oct 10, 2026
  36. v1.0.225Oct 9, 2026
  37. v1.0.224Oct 9, 2026
  38. v1.0.223Oct 7, 2026
  39. v1.0.222Oct 6, 2026
  40. v1.0.221Oct 5, 2026
  41. v1.0.220Oct 4, 2026
  42. v1.0.219Oct 3, 2026
  43. v1.0.218Oct 2, 2026
  44. v1.0.217Oct 1, 2026
  45. v1.0.216Sep 30, 2026
  46. v1.0.215Sep 29, 2026
  47. v1.0.214Sep 29, 2026
  48. v1.0.213Sep 27, 2026
  49. v1.0.212Sep 26, 2026
  50. v1.0.211Sep 25, 2026
  51. v1.0.210Sep 24, 2026
  52. v1.0.209Sep 23, 2026
  53. v1.0.208Sep 22, 2026
  54. v1.0.207Sep 21, 2026
  55. v1.0.206Sep 20, 2026
  56. v1.0.205Sep 19, 2026
  57. v1.0.204Sep 18, 2026
  58. v1.0.203Sep 17, 2026
  59. v1.0.202Sep 16, 2026
  60. v1.0.201Sep 16, 2026

評分

已滿足適用檢查項的 100%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分