@pharaoh-so/mcp 0.3.59 → 0.3.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.mcp.json +1 -1
- package/CHANGELOG.md +5 -0
- package/README.md +3 -2
- package/dist/backend.d.ts +7 -0
- package/dist/install-skills.d.ts +13 -0
- package/dist/install-skills.js +107 -2
- package/dist/proxy-server.js +2 -1
- package/package.json +1 -1
package/.mcp.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -26,6 +26,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
26
26
|
- The `pharaoh` skill's connection URL is `https://mcp.pharaoh.so/mcp` instead of `/sse`. The skill also carries the guidance that was only in the server instructions: one Pharaoh call answers what grep and file reads take many turns to piece together, load Pharaoh's tools before the first code search when your client defers them, summarize a block marked "Trace view available" instead of reproducing it, and check related repos when a change touches shared interfaces.
|
|
27
27
|
- The server instructions state facts: what Pharaoh maps, which tool answers which question, what the graph leaves to grep, how repos are mapped and what each account tool does. Asking Pharaoh first, not re-checking its answers with grep, surfacing and crediting its ★ blocks and the rest of that guidance now live in the `pharaoh` skill. Claude Code and OpenClaw list the skill in every session and load its body only when they use it. The Grep hook and the optional `~/.claude/CLAUDE.md` line are unchanged and apply from the start of a session.
|
|
28
28
|
|
|
29
|
+
## [0.3.60] - 2026-11-05
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
- When it connects, the proxy tells Pharaoh what your agent's instruction files say about it: whether `~/.claude/CLAUDE.md` holds the line setup suggests, mentions Pharaoh another way, doesn't, or is missing, and whether setup's block is still there. In Claude Code started at a git repo's root, the same for the project's `CLAUDE.md`, `CLAUDE.local.md`, `.claude/CLAUDE.md` or `AGENTS.md`. Only those values are sent, never file text. A file over 64 KB, or one that isn't a regular file or can't be read, counts as unknown. Pharaoh uses this to learn whether the line leads agents to use it (privacy policy § 9, connection records).
|
|
33
|
+
|
|
29
34
|
## [0.3.59] - 2026-11-04
|
|
30
35
|
|
|
31
36
|
### Changed
|
package/README.md
CHANGED
|
@@ -152,10 +152,11 @@ claude mcp add --scope user pharaoh -- npx @pharaoh-so/mcp@<version> --server ht
|
|
|
152
152
|
- Credentials are stored with restrictive file permissions (`0600` — owner-read/write only)
|
|
153
153
|
- Authentication uses the [RFC 8628](https://datatracker.ietf.org/doc/html/rfc8628) device authorization flow — no secrets are embedded in the package
|
|
154
154
|
- All communication with the Pharaoh server uses HTTPS/TLS
|
|
155
|
-
- The proxy never
|
|
155
|
+
- 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.
|
|
156
|
+
- 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.
|
|
156
157
|
- Tokens expire after 7 days and are refreshed automatically
|
|
157
158
|
- Only use trusted server URLs — the proxy sends your auth token to the configured server
|
|
158
|
-
-
|
|
159
|
+
- 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.
|
|
159
160
|
|
|
160
161
|
### What the installer writes on your machine
|
|
161
162
|
|
package/dist/backend.d.ts
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import type { CallToolResult, ClientCapabilities, Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
19
19
|
import type { DeviceFlowGateway } from "./gateway.js";
|
|
20
|
+
import type { InstructionState, ManagedBlockState } from "./install-skills.js";
|
|
20
21
|
/**
|
|
21
22
|
* Notification that tells Pharaoh which client the proxy serves. Pharaoh sees
|
|
22
23
|
* the proxy itself as `pharaoh-proxy`; this lands on the session's row.
|
|
@@ -32,6 +33,12 @@ export type DownstreamClient = {
|
|
|
32
33
|
};
|
|
33
34
|
/** Pharaoh's Claude Code plugin as ~/.claude/settings.json lists it. */
|
|
34
35
|
plugin: "enabled" | "disabled" | "absent";
|
|
36
|
+
/** What the client's instruction files say about Pharaoh (install-skills.ts instructionStates); never their text. */
|
|
37
|
+
instructions?: {
|
|
38
|
+
user: InstructionState;
|
|
39
|
+
managed: ManagedBlockState;
|
|
40
|
+
project: InstructionState;
|
|
41
|
+
};
|
|
35
42
|
};
|
|
36
43
|
/** The contract ProxyServer uses to delegate tool handling. */
|
|
37
44
|
export interface Backend {
|
package/dist/install-skills.d.ts
CHANGED
|
@@ -87,6 +87,19 @@ export declare function allowReadTools(home?: string): AllowReadToolsResult;
|
|
|
87
87
|
export declare function describeAllowReadTools(result: AllowReadToolsResult): string;
|
|
88
88
|
/** What the interactive setup asks before writing the line. */
|
|
89
89
|
export declare const CLAUDE_MD_QUESTION = "Pharaoh: add one line to ~/.claude/CLAUDE.md so Claude checks Pharaoh before searching your code?\n \"In repos Pharaoh has mapped, before searching or reading files, ask Pharaoh where the relevant code is, what calls it, and whether what you need already exists.\"\n[Y/n] ";
|
|
90
|
+
/** What an instruction file says about Pharaoh: the suggested line, another mention, none, no file, or unreadable. */
|
|
91
|
+
export type InstructionState = "exact" | "mention" | "none" | "missing" | "unknown";
|
|
92
|
+
/** Whether the block setup wrote into ~/.claude/CLAUDE.md is there and holds the current line. */
|
|
93
|
+
export type ManagedBlockState = "current" | "stale" | "absent" | "unknown";
|
|
94
|
+
/**
|
|
95
|
+
* The instruction state the proxy reports for its client. Project files only
|
|
96
|
+
* for clients known to start the proxy in the project folder. Never throws.
|
|
97
|
+
*/
|
|
98
|
+
export declare function instructionStates(clientName: string | undefined, cwd?: string, home?: string): {
|
|
99
|
+
user: InstructionState;
|
|
100
|
+
managed: ManagedBlockState;
|
|
101
|
+
project: InstructionState;
|
|
102
|
+
};
|
|
90
103
|
/** What `offerClaudeMdLine` did; `describeClaudeMdOutcome` words it. */
|
|
91
104
|
export type ClaudeMdOutcome = "added" | "updated" | "declined" | "kept" | "failed" | "current" | "answered" | "cancelled" | "no-terminal" | "no-claude";
|
|
92
105
|
/**
|
package/dist/install-skills.js
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* and OpenClaw skills in ~/.openclaw/skills/. Also merges the Pharaoh MCP
|
|
7
7
|
* server config into OpenClaw.
|
|
8
8
|
*/
|
|
9
|
-
import { closeSync, constants, cpSync, existsSync, lstatSync, mkdirSync, openSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync, } from "node:fs";
|
|
9
|
+
import { closeSync, constants, cpSync, existsSync, fstatSync, lstatSync, mkdirSync, openSync, readdirSync, readFileSync, readSync, renameSync, rmSync, writeFileSync, } from "node:fs";
|
|
10
10
|
import { homedir } from "node:os";
|
|
11
|
-
import { dirname, join } from "node:path";
|
|
11
|
+
import { dirname, join, resolve } from "node:path";
|
|
12
12
|
import { fileURLToPath } from "node:url";
|
|
13
13
|
import { ensurePharaohHome } from "./credentials.js";
|
|
14
14
|
import { CLAUDE_CLI_SETUP_URL, claudeCliFor } from "./setup.js";
|
|
@@ -765,6 +765,111 @@ function readClaudeMd(home) {
|
|
|
765
765
|
const current = text.slice(block.body, block.to) === `${PHARAOH_CLAUDE_MD_LINE}\n`;
|
|
766
766
|
return { state: current ? "current" : "stale", path, text, block };
|
|
767
767
|
}
|
|
768
|
+
/** A CLAUDE.md is a few KB; anything bigger reads as "unknown" instead of slowing initialize. */
|
|
769
|
+
const INSTRUCTION_READ_CAP = 64 * 1024;
|
|
770
|
+
/**
|
|
771
|
+
* A project's instruction files, read only for clients confirmed to start the
|
|
772
|
+
* proxy in the project folder (Claude Code 2.1.310 does: probed 2026-11-04).
|
|
773
|
+
*/
|
|
774
|
+
const PROJECT_INSTRUCTION_FILES = [
|
|
775
|
+
"CLAUDE.md",
|
|
776
|
+
"CLAUDE.local.md",
|
|
777
|
+
join(".claude", "CLAUDE.md"),
|
|
778
|
+
"AGENTS.md",
|
|
779
|
+
];
|
|
780
|
+
const PROJECT_CWD_CLIENTS = new Set(["claude-code"]);
|
|
781
|
+
/**
|
|
782
|
+
* Up to `cap` bytes of a regular file, read from the descriptor that was
|
|
783
|
+
* checked, so a FIFO or device swapped in can't block `initialize`. A symlink
|
|
784
|
+
* is followed: only a state is derived from what it points at.
|
|
785
|
+
*
|
|
786
|
+
* @returns The file's text, wrapped so no content can read as a state;
|
|
787
|
+
* "missing" when there's no file; "unknown" when it's over the cap, not a
|
|
788
|
+
* regular file, or unreadable
|
|
789
|
+
*/
|
|
790
|
+
function readBoundedText(path, cap = INSTRUCTION_READ_CAP) {
|
|
791
|
+
let fd;
|
|
792
|
+
try {
|
|
793
|
+
fd = openSync(path, constants.O_RDONLY | (constants.O_NONBLOCK ?? 0));
|
|
794
|
+
}
|
|
795
|
+
catch (err) {
|
|
796
|
+
const code = err.code;
|
|
797
|
+
return code === "ENOENT" || code === "ENOTDIR" ? "missing" : "unknown";
|
|
798
|
+
}
|
|
799
|
+
try {
|
|
800
|
+
if (!fstatSync(fd).isFile())
|
|
801
|
+
return "unknown";
|
|
802
|
+
const buf = Buffer.alloc(cap + 1);
|
|
803
|
+
let length = 0;
|
|
804
|
+
while (length <= cap) {
|
|
805
|
+
const n = readSync(fd, buf, length, cap + 1 - length, null);
|
|
806
|
+
if (n === 0)
|
|
807
|
+
break;
|
|
808
|
+
length += n;
|
|
809
|
+
}
|
|
810
|
+
return length > cap ? "unknown" : { text: buf.toString("utf-8", 0, length) };
|
|
811
|
+
}
|
|
812
|
+
catch {
|
|
813
|
+
return "unknown";
|
|
814
|
+
}
|
|
815
|
+
finally {
|
|
816
|
+
closeSync(fd);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
/** Whether `text` holds the suggested line, otherwise mentions Pharaoh, or neither. */
|
|
820
|
+
function classifyInstructionText(text) {
|
|
821
|
+
if (text.includes(PHARAOH_CLAUDE_MD_LINE))
|
|
822
|
+
return "exact";
|
|
823
|
+
return /\bpharaoh\b/i.test(text) ? "mention" : "none";
|
|
824
|
+
}
|
|
825
|
+
/** What ~/.claude/CLAUDE.md says about Pharaoh, and whether setup's block is there and current. */
|
|
826
|
+
function userInstructionState(home = homedir()) {
|
|
827
|
+
const file = readBoundedText(join(home, ".claude", "CLAUDE.md"));
|
|
828
|
+
if (file === "missing")
|
|
829
|
+
return { user: "missing", managed: "absent" };
|
|
830
|
+
if (file === "unknown")
|
|
831
|
+
return { user: "unknown", managed: "unknown" };
|
|
832
|
+
const { text } = file;
|
|
833
|
+
const block = findClaudeMdBlock(text);
|
|
834
|
+
const managed = block === null
|
|
835
|
+
? "absent"
|
|
836
|
+
: block === "broken"
|
|
837
|
+
? "unknown"
|
|
838
|
+
: text.slice(block.body, block.to) === `${PHARAOH_CLAUDE_MD_LINE}\n`
|
|
839
|
+
? "current"
|
|
840
|
+
: "stale";
|
|
841
|
+
return { user: classifyInstructionText(text), managed };
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* The strongest state across a project's instruction files: any exact line,
|
|
845
|
+
* then any mention, then any unreadable file, then a file without a mention.
|
|
846
|
+
* "unknown" outside a git repository's root or in the home folder.
|
|
847
|
+
*/
|
|
848
|
+
function projectInstructionState(cwd, home = homedir()) {
|
|
849
|
+
if (resolve(cwd) === resolve(home) || !existsSync(join(cwd, ".git")))
|
|
850
|
+
return "unknown";
|
|
851
|
+
const states = PROJECT_INSTRUCTION_FILES.map((file) => {
|
|
852
|
+
const read = readBoundedText(join(cwd, file));
|
|
853
|
+
return typeof read === "string" ? read : classifyInstructionText(read.text);
|
|
854
|
+
});
|
|
855
|
+
return (["exact", "mention", "unknown", "none"].find((s) => states.includes(s)) ?? "missing");
|
|
856
|
+
}
|
|
857
|
+
/**
|
|
858
|
+
* The instruction state the proxy reports for its client. Project files only
|
|
859
|
+
* for clients known to start the proxy in the project folder. Never throws.
|
|
860
|
+
*/
|
|
861
|
+
export function instructionStates(clientName, cwd, home = homedir()) {
|
|
862
|
+
try {
|
|
863
|
+
// process.cwd() throws when the folder was deleted: inside the try, so it reads as unknown.
|
|
864
|
+
const project = clientName && PROJECT_CWD_CLIENTS.has(clientName)
|
|
865
|
+
? projectInstructionState(cwd ?? process.cwd(), home)
|
|
866
|
+
: "unknown";
|
|
867
|
+
return { ...userInstructionState(home), project };
|
|
868
|
+
}
|
|
869
|
+
catch {
|
|
870
|
+
return { user: "unknown", managed: "unknown", project: "unknown" };
|
|
871
|
+
}
|
|
872
|
+
}
|
|
768
873
|
/**
|
|
769
874
|
* Offer the Pharaoh-first line in ~/.claude/CLAUDE.md. Interactive setup only,
|
|
770
875
|
* never a proxy start. Asks only when the block is absent and the user hasn't
|
package/dist/proxy-server.js
CHANGED
|
@@ -27,7 +27,7 @@ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextpro
|
|
|
27
27
|
import { AuthRequiredBackend, createSseBackend, } from "./backend.js";
|
|
28
28
|
import { loadBundledCatalog } from "./catalog.js";
|
|
29
29
|
import { createGateway } from "./gateway.js";
|
|
30
|
-
import { claudePluginState } from "./install-skills.js";
|
|
30
|
+
import { claudePluginState, instructionStates } from "./install-skills.js";
|
|
31
31
|
import { TenantSuspendedError, TokenExpiredError } from "./proxy.js";
|
|
32
32
|
import { registerTraceResource } from "./trace-resource.js";
|
|
33
33
|
import { getPackageVersion } from "./version.js";
|
|
@@ -70,6 +70,7 @@ export class ProxyServer {
|
|
|
70
70
|
const downstream = {
|
|
71
71
|
client: { name: info?.name, version: info?.version },
|
|
72
72
|
plugin: claudePluginState(),
|
|
73
|
+
instructions: instructionStates(info?.name),
|
|
73
74
|
};
|
|
74
75
|
this.downstream = downstream;
|
|
75
76
|
this.clientCapabilities = this.server.getClientCapabilities() ?? {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pharaoh-so/mcp",
|
|
3
3
|
"mcpName": "so.pharaoh/pharaoh",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.60",
|
|
5
5
|
"description": "MCP proxy for Pharaoh — maps codebases into queryable knowledge graphs for coding agents. Enables Claude Code in headless environments (VPS, SSH, CI) via device flow auth.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|