@pharaoh-so/mcp 0.1.6 → 0.2.1
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/CHANGELOG.md +41 -0
- package/LICENSE +21 -0
- package/README.md +237 -13
- package/dist/helpers.js +1 -1
- package/dist/index.js +6 -0
- package/dist/install-skills.d.ts +33 -0
- package/dist/install-skills.js +121 -0
- package/inspect-tools.json +13 -3
- package/package.json +64 -32
- package/skills/.gitkeep +0 -0
- package/skills/pharaoh/SKILL.md +81 -0
- package/skills/pharaoh-audit-tests/SKILL.md +88 -0
- package/skills/pharaoh-brainstorm/SKILL.md +73 -0
- package/skills/pharaoh-debt/SKILL.md +33 -0
- package/skills/pharaoh-debug/SKILL.md +69 -0
- package/skills/pharaoh-execute/SKILL.md +57 -0
- package/skills/pharaoh-explore/SKILL.md +32 -0
- package/skills/pharaoh-finish/SKILL.md +79 -0
- package/skills/pharaoh-health/SKILL.md +36 -0
- package/skills/pharaoh-investigate/SKILL.md +34 -0
- package/skills/pharaoh-onboard/SKILL.md +32 -0
- package/skills/pharaoh-parallel/SKILL.md +74 -0
- package/skills/pharaoh-plan/SKILL.md +74 -0
- package/skills/pharaoh-pr/SKILL.md +52 -0
- package/skills/pharaoh-refactor/SKILL.md +36 -0
- package/skills/pharaoh-review/SKILL.md +61 -0
- package/skills/pharaoh-review-codex/SKILL.md +80 -0
- package/skills/pharaoh-review-receive/SKILL.md +81 -0
- package/skills/pharaoh-sessions/SKILL.md +85 -0
- package/skills/pharaoh-tdd/SKILL.md +104 -0
- package/skills/pharaoh-verify/SKILL.md +72 -0
- package/skills/pharaoh-wiring/SKILL.md +34 -0
- package/skills/pharaoh-worktree/SKILL.md +85 -0
- package/dist/auth.js.map +0 -1
- package/dist/credentials.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/proxy.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@pharaoh-so/mcp` will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.5] - 2026-03-24
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Inspect mode (`--inspect`) for MCP registry validation and debugging
|
|
12
|
+
- Tool manifest JSON output for Glama and other MCP registries
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- Improved error messages for connection failures
|
|
16
|
+
|
|
17
|
+
## [0.1.3] - 2026-03-23
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
- `inspect-tools.json` bundled in package for offline tool schema access
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
- Updated `@modelcontextprotocol/sdk` to ^1.26.0
|
|
24
|
+
|
|
25
|
+
## [0.1.2] - 2026-03-22
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
- Credential file permissions set correctly on first write
|
|
29
|
+
- Token refresh race condition when multiple requests arrive simultaneously
|
|
30
|
+
|
|
31
|
+
## [0.1.0] - 2026-03-20
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
- Initial release
|
|
35
|
+
- Stdio-to-SSE proxy for headless Pharaoh MCP connections
|
|
36
|
+
- RFC 8628 device authorization flow
|
|
37
|
+
- Automatic token refresh
|
|
38
|
+
- Credential storage with restrictive file permissions (`0600`)
|
|
39
|
+
- `--server` flag for custom Pharaoh instances
|
|
40
|
+
- `--logout` flag to clear stored credentials
|
|
41
|
+
- Support for all 19 Pharaoh MCP tools
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pharaoh, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,31 +1,60 @@
|
|
|
1
1
|
# @pharaoh-so/mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@pharaoh-so/mcp)
|
|
4
|
+
[](https://github.com/Pharaoh-so/pharaoh-mcp/blob/main/LICENSE)
|
|
5
|
+
[](https://nodejs.org)
|
|
6
|
+
[](https://glama.ai/mcp/servers/Pharaoh-so/pharaoh)
|
|
7
|
+
|
|
8
|
+
MCP proxy for [Pharaoh](https://pharaoh.so) — maps codebases into queryable knowledge graphs for AI agents.
|
|
9
|
+
|
|
10
|
+
Pharaoh gives AI coding assistants a complete architectural map of your codebase: every function, dependency, module, and connection. Instead of reading files one at a time, your AI agent queries the knowledge graph and gets instant answers about blast radius, unused code, dependency chains, and more.
|
|
11
|
+
|
|
12
|
+
This package enables [Claude Code](https://docs.anthropic.com/en/docs/build-with-claude/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.
|
|
4
13
|
|
|
5
14
|
## Quick Start
|
|
6
15
|
|
|
7
|
-
|
|
16
|
+
### Step 1 — Authenticate
|
|
17
|
+
|
|
18
|
+
Run the proxy directly to trigger the device authorization flow:
|
|
8
19
|
|
|
9
20
|
```bash
|
|
10
21
|
npx @pharaoh-so/mcp
|
|
11
22
|
```
|
|
12
23
|
|
|
13
|
-
This
|
|
24
|
+
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.
|
|
14
25
|
|
|
15
|
-
|
|
26
|
+
### Step 2 — Add to Claude Code
|
|
16
27
|
|
|
17
28
|
```bash
|
|
18
29
|
claude mcp add pharaoh -- npx @pharaoh-so/mcp
|
|
19
30
|
```
|
|
20
31
|
|
|
21
|
-
|
|
32
|
+
Verify the connection:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
claude mcp list
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
You should see `pharaoh` listed as a **stdio** server.
|
|
39
|
+
|
|
40
|
+
### Switching from SSE
|
|
41
|
+
|
|
42
|
+
If you previously added Pharaoh as an SSE server, remove it first:
|
|
22
43
|
|
|
23
44
|
```bash
|
|
24
45
|
claude mcp remove pharaoh
|
|
25
46
|
claude mcp add pharaoh -- npx @pharaoh-so/mcp
|
|
26
47
|
```
|
|
27
48
|
|
|
28
|
-
|
|
49
|
+
### Desktop with Browser (Alternative)
|
|
50
|
+
|
|
51
|
+
If you have a browser available (desktop, laptop), you can connect directly via SSE instead:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
claude mcp add --transport sse pharaoh https://mcp.pharaoh.so/sse
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This uses OAuth in the browser and doesn't require this package.
|
|
29
58
|
|
|
30
59
|
## How It Works
|
|
31
60
|
|
|
@@ -33,18 +62,213 @@ Verify with `claude mcp list` — it should show `pharaoh` as a **stdio** server
|
|
|
33
62
|
Claude Code ← stdio → @pharaoh-so/mcp ← SSE/HTTP → mcp.pharaoh.so
|
|
34
63
|
```
|
|
35
64
|
|
|
36
|
-
The proxy
|
|
65
|
+
The proxy implements the [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) specification:
|
|
66
|
+
|
|
67
|
+
1. **Claude Code** launches the proxy as a child process and communicates via **stdio** (stdin/stdout)
|
|
68
|
+
2. **The proxy** authenticates with Pharaoh using stored credentials (or triggers device flow)
|
|
69
|
+
3. **All MCP messages** (tool calls, responses, notifications) are relayed to the remote Pharaoh server over **SSE** (Server-Sent Events)
|
|
70
|
+
4. **Pharaoh** queries the knowledge graph and returns architectural data to the proxy
|
|
71
|
+
5. **The proxy** forwards responses back to Claude Code via stdio
|
|
72
|
+
|
|
73
|
+
Authentication uses [RFC 8628](https://datatracker.ietf.org/doc/html/rfc8628) (OAuth 2.0 Device Authorization Grant) — no browser is needed on the machine running Claude Code.
|
|
74
|
+
|
|
75
|
+
## Available Tools
|
|
76
|
+
|
|
77
|
+
Once connected, Pharaoh provides 19 MCP tools organized into four categories:
|
|
78
|
+
|
|
79
|
+
### Orient (Free)
|
|
80
|
+
|
|
81
|
+
| Tool | What it answers |
|
|
82
|
+
|------|----------------|
|
|
83
|
+
| `get_codebase_map` | What modules exist and how do they relate? |
|
|
84
|
+
| `get_module_context` | What does this module look like before I modify it? |
|
|
85
|
+
| `search_functions` | Does this function already exist somewhere? |
|
|
86
|
+
| `get_design_system` | What UI components and tokens already exist? |
|
|
87
|
+
|
|
88
|
+
### Investigate (Free + Pro)
|
|
89
|
+
|
|
90
|
+
| Tool | What it answers |
|
|
91
|
+
|------|----------------|
|
|
92
|
+
| `get_blast_radius` | What breaks if I change this function/file/module? |
|
|
93
|
+
| `query_dependencies` | How are these two modules connected? |
|
|
94
|
+
| `check_reachability` | Is this function actually reachable from entry points? |
|
|
95
|
+
| `get_vision_docs` | Is there a PRD or spec for this? |
|
|
96
|
+
|
|
97
|
+
### Audit (Pro)
|
|
37
98
|
|
|
38
|
-
|
|
99
|
+
| Tool | What it answers |
|
|
100
|
+
|------|----------------|
|
|
101
|
+
| `get_vision_gaps` | What's specified but not built? What's built but not specified? |
|
|
102
|
+
| `get_cross_repo_audit` | Are shared dependencies drifting between repos? |
|
|
103
|
+
| `get_consolidation_opportunities` | Where is duplicate or overlapping logic? |
|
|
104
|
+
| `get_unused_code` | What code is never called and safe to delete? |
|
|
105
|
+
| `get_test_coverage` | Which modules/functions lack test coverage? |
|
|
106
|
+
| `get_regression_risk` | How risky is this change to production? |
|
|
107
|
+
|
|
108
|
+
### Manage (Free)
|
|
109
|
+
|
|
110
|
+
| Tool | What it answers |
|
|
111
|
+
|------|----------------|
|
|
112
|
+
| `request_upload` | Map a local repo without installing the GitHub App |
|
|
113
|
+
| `setup_environment` | Install recommended development plugins |
|
|
114
|
+
| `pharaoh_account` | Check plan, toggle PR Guard, trigger refresh |
|
|
115
|
+
| `pharaoh_feedback` | Report false positives or tool issues |
|
|
116
|
+
| `pharaoh_admin` | Org-level administration |
|
|
117
|
+
|
|
118
|
+
## Inspect Mode
|
|
119
|
+
|
|
120
|
+
Use `--inspect` to dump the full tool manifest as JSON (useful for MCP registry validation and debugging):
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
npx @pharaoh-so/mcp --inspect
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
This outputs the complete list of tools with their schemas and exits immediately, without connecting to the server.
|
|
127
|
+
|
|
128
|
+
## CLI Options
|
|
39
129
|
|
|
40
130
|
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
131
|
+
Usage: pharaoh-mcp [options]
|
|
132
|
+
|
|
133
|
+
Options:
|
|
134
|
+
--server <url> Pharaoh server URL (default: https://mcp.pharaoh.so)
|
|
135
|
+
--logout Clear stored credentials and exit
|
|
136
|
+
--inspect Output tool manifest as JSON and exit
|
|
137
|
+
--help Show help
|
|
138
|
+
--version Show version number
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Configuration
|
|
142
|
+
|
|
143
|
+
### Credentials
|
|
144
|
+
|
|
145
|
+
Credentials are stored at `~/.pharaoh/credentials.json` with `0600` permissions (owner-read/write only). The file contains:
|
|
146
|
+
|
|
147
|
+
- **Access token** — used to authenticate MCP requests
|
|
148
|
+
- **Refresh token** — used to obtain new access tokens when they expire
|
|
149
|
+
- **Expiry timestamp** — tokens are refreshed automatically before expiration
|
|
150
|
+
|
|
151
|
+
To clear credentials:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
npx @pharaoh-so/mcp --logout
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Custom Server
|
|
158
|
+
|
|
159
|
+
For self-hosted Pharaoh instances or development:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
claude mcp add pharaoh -- npx @pharaoh-so/mcp --server https://your-pharaoh-instance.com
|
|
44
163
|
```
|
|
45
164
|
|
|
165
|
+
### Environment Variables
|
|
166
|
+
|
|
167
|
+
| Variable | Default | Description |
|
|
168
|
+
|----------|---------|-------------|
|
|
169
|
+
| `PHARAOH_SERVER_URL` | `https://mcp.pharaoh.so` | Pharaoh server URL (alternative to `--server`) |
|
|
170
|
+
|
|
171
|
+
## Requirements
|
|
172
|
+
|
|
173
|
+
- **Node.js** >= 18
|
|
174
|
+
- **Claude Code** or any MCP-compatible AI client
|
|
175
|
+
- A **Pharaoh account** — sign up at [pharaoh.so](https://pharaoh.so)
|
|
176
|
+
|
|
46
177
|
## Security
|
|
47
178
|
|
|
48
|
-
- Credentials stored with `0600`
|
|
179
|
+
- Credentials are stored with restrictive file permissions (`0600` — owner-read/write only)
|
|
180
|
+
- Authentication uses the [RFC 8628](https://datatracker.ietf.org/doc/html/rfc8628) device authorization flow — no secrets are embedded in the package
|
|
181
|
+
- All communication with the Pharaoh server uses HTTPS/TLS
|
|
182
|
+
- No source code is ever transmitted — Pharaoh maps structural metadata (function names, file paths, dependency relationships) into a knowledge graph. Your code never leaves your machine.
|
|
183
|
+
- Tokens expire after 7 days and are refreshed automatically
|
|
49
184
|
- Only use trusted server URLs — the proxy sends your auth token to the configured server
|
|
50
|
-
|
|
185
|
+
|
|
186
|
+
### Reporting Vulnerabilities
|
|
187
|
+
|
|
188
|
+
If you discover a security vulnerability, please report it responsibly by emailing [security@pharaoh.so](mailto:security@pharaoh.so). Do not open a public issue.
|
|
189
|
+
|
|
190
|
+
## Troubleshooting
|
|
191
|
+
|
|
192
|
+
### "Connection refused" or "ECONNREFUSED"
|
|
193
|
+
|
|
194
|
+
The Pharaoh server may be temporarily unavailable. Check [status.pharaoh.so](https://pharaoh.so) or try again in a few minutes.
|
|
195
|
+
|
|
196
|
+
### "Token expired" or "401 Unauthorized"
|
|
197
|
+
|
|
198
|
+
Re-authenticate by running the proxy directly:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
npx @pharaoh-so/mcp
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Or clear credentials and start fresh:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
npx @pharaoh-so/mcp --logout
|
|
208
|
+
npx @pharaoh-so/mcp
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### "pharaoh" not showing in `claude mcp list`
|
|
212
|
+
|
|
213
|
+
Make sure you added it with the correct command:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
claude mcp add pharaoh -- npx @pharaoh-so/mcp
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Note the `--` separator between `pharaoh` and `npx`.
|
|
220
|
+
|
|
221
|
+
### Device code not working
|
|
222
|
+
|
|
223
|
+
- Ensure you're opening the URL on a device with browser access
|
|
224
|
+
- The device code expires after 15 minutes — request a new one by re-running the command
|
|
225
|
+
- Check that you're logged into GitHub when authorizing
|
|
226
|
+
|
|
227
|
+
### Slow startup
|
|
228
|
+
|
|
229
|
+
The first run after installation may take a moment as npm downloads the package. Subsequent runs use the cached version. To pre-install globally:
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
npm install -g @pharaoh-so/mcp
|
|
233
|
+
claude mcp add pharaoh -- pharaoh-mcp
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## How Pharaoh Works
|
|
237
|
+
|
|
238
|
+
Pharaoh parses your repositories using [tree-sitter](https://tree-sitter.github.io/) and maps structural metadata into a [Neo4j](https://neo4j.com/) knowledge graph. The graph contains:
|
|
239
|
+
|
|
240
|
+
- **Functions** — names, signatures, complexity scores, export visibility
|
|
241
|
+
- **Files** — paths, module membership, language classification
|
|
242
|
+
- **Modules** — logical groupings detected from directory structure
|
|
243
|
+
- **Dependencies** — import/export relationships, call chains, module connections
|
|
244
|
+
- **Vision specs** — PRD/spec documents linked to implementation
|
|
245
|
+
|
|
246
|
+
No source code is stored — only structural metadata. When an AI agent queries Pharaoh, it gets architectural facts in minimal tokens, not raw code dumps. This means your AI assistant can understand your entire codebase architecture without consuming its context window reading files one by one.
|
|
247
|
+
|
|
248
|
+
## Supported Languages
|
|
249
|
+
|
|
250
|
+
- **TypeScript / JavaScript** — full support (functions, classes, imports, exports, JSX)
|
|
251
|
+
- **Python** — full support (functions, classes, imports, decorators)
|
|
252
|
+
- More languages planned via tree-sitter grammar support
|
|
253
|
+
|
|
254
|
+
## Contributing
|
|
255
|
+
|
|
256
|
+
Contributions are welcome. Please open an issue first to discuss what you'd like to change.
|
|
257
|
+
|
|
258
|
+
1. Fork the repository
|
|
259
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
260
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
261
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
262
|
+
5. Open a Pull Request
|
|
263
|
+
|
|
264
|
+
## License
|
|
265
|
+
|
|
266
|
+
[MIT](LICENSE) -- Pharaoh, Inc.
|
|
267
|
+
|
|
268
|
+
## Links
|
|
269
|
+
|
|
270
|
+
- [Pharaoh website](https://pharaoh.so)
|
|
271
|
+
- [Documentation](https://docs.pharaoh.so)
|
|
272
|
+
- [MCP specification](https://modelcontextprotocol.io/)
|
|
273
|
+
- [Claude Code](https://docs.anthropic.com/en/docs/build-with-claude/claude-code)
|
|
274
|
+
- [Report an issue](https://github.com/Pharaoh-so/pharaoh-mcp/issues)
|
package/dist/helpers.js
CHANGED
|
@@ -40,7 +40,7 @@ export function parseArgs(argv = process.argv.slice(2)) {
|
|
|
40
40
|
return { server, logout };
|
|
41
41
|
}
|
|
42
42
|
export function printUsage() {
|
|
43
|
-
printLines("Usage: pharaoh-mcp [options]", "", "Options:", " --server <url>
|
|
43
|
+
printLines("Usage: pharaoh-mcp [options]", "", "Options:", " --server <url> Pharaoh server URL (default: https://mcp.pharaoh.so)", " --logout Clear stored credentials and exit", " --install-skills Install Pharaoh skills to OpenClaw (~/.openclaw/skills/)", " --help, -h Show this help", "", "Add to Claude Code:", " claude mcp add pharaoh -- npx @pharaoh-so/mcp", "");
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Validate that a server-supplied SSE URL shares the same origin as the configured server.
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,12 @@ async function main() {
|
|
|
26
26
|
await runInspect();
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
+
// Install-skills mode — copy bundled skills to ~/.openclaw/skills/
|
|
30
|
+
if (args.includes("--install-skills")) {
|
|
31
|
+
const { runInstallSkills } = await import("./install-skills.js");
|
|
32
|
+
runInstallSkills();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
29
35
|
const { server, logout } = parseArgs(args);
|
|
30
36
|
if (logout) {
|
|
31
37
|
deleteCredentials();
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect whether OpenClaw is installed by checking for ~/.openclaw/.
|
|
3
|
+
*
|
|
4
|
+
* @param home - Home directory override (defaults to os.homedir()).
|
|
5
|
+
* @returns True if ~/.openclaw/ exists.
|
|
6
|
+
*/
|
|
7
|
+
export declare function detectOpenClaw(home?: string): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Copy all bundled skill directories to ~/.openclaw/skills/.
|
|
10
|
+
* Overwrites existing skill dirs on reinstall (cpSync recursive + force).
|
|
11
|
+
*
|
|
12
|
+
* @param home - Home directory override (defaults to os.homedir()).
|
|
13
|
+
* @returns Number of skill directories copied.
|
|
14
|
+
*/
|
|
15
|
+
export declare function installSkills(home?: string): number;
|
|
16
|
+
/**
|
|
17
|
+
* Read ~/.openclaw/openclaw.json, add the Pharaoh MCP server under `mcpServers`,
|
|
18
|
+
* and write it back. Creates the file if it does not exist. Does NOT overwrite
|
|
19
|
+
* an existing `pharaoh` entry — skips if already present.
|
|
20
|
+
*
|
|
21
|
+
* @param home - Home directory override (defaults to os.homedir()).
|
|
22
|
+
* @returns True if the config was written/updated, false if pharaoh was already present.
|
|
23
|
+
*/
|
|
24
|
+
export declare function mergeOpenClawConfig(home?: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Main entry point for --install-skills.
|
|
27
|
+
*
|
|
28
|
+
* Detects OpenClaw, copies skills, merges config, and prints a summary.
|
|
29
|
+
* If OpenClaw is not detected, prints manual installation instructions instead.
|
|
30
|
+
*
|
|
31
|
+
* @param home - Home directory override (defaults to os.homedir()).
|
|
32
|
+
*/
|
|
33
|
+
export declare function runInstallSkills(home?: string): void;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* --install-skills implementation for the Pharaoh MCP proxy CLI.
|
|
3
|
+
*
|
|
4
|
+
* Copies bundled skill directories to ~/.openclaw/skills/ and merges
|
|
5
|
+
* the Pharaoh MCP server entry into ~/.openclaw/openclaw.json.
|
|
6
|
+
* If OpenClaw is not detected, prints manual installation instructions.
|
|
7
|
+
*/
|
|
8
|
+
import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
9
|
+
import { homedir } from "node:os";
|
|
10
|
+
import { dirname, join } from "node:path";
|
|
11
|
+
import { fileURLToPath } from "node:url";
|
|
12
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
/** Path to the bundled skills directory (one level up from dist/). */
|
|
14
|
+
const BUNDLED_SKILLS_DIR = join(__dirname, "..", "skills");
|
|
15
|
+
/**
|
|
16
|
+
* Detect whether OpenClaw is installed by checking for ~/.openclaw/.
|
|
17
|
+
*
|
|
18
|
+
* @param home - Home directory override (defaults to os.homedir()).
|
|
19
|
+
* @returns True if ~/.openclaw/ exists.
|
|
20
|
+
*/
|
|
21
|
+
export function detectOpenClaw(home = homedir()) {
|
|
22
|
+
return existsSync(join(home, ".openclaw"));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Copy all bundled skill directories to ~/.openclaw/skills/.
|
|
26
|
+
* Overwrites existing skill dirs on reinstall (cpSync recursive + force).
|
|
27
|
+
*
|
|
28
|
+
* @param home - Home directory override (defaults to os.homedir()).
|
|
29
|
+
* @returns Number of skill directories copied.
|
|
30
|
+
*/
|
|
31
|
+
export function installSkills(home = homedir()) {
|
|
32
|
+
const targetDir = join(home, ".openclaw", "skills");
|
|
33
|
+
if (!existsSync(targetDir)) {
|
|
34
|
+
mkdirSync(targetDir, { recursive: true });
|
|
35
|
+
}
|
|
36
|
+
const entries = readdirSync(BUNDLED_SKILLS_DIR, { withFileTypes: true });
|
|
37
|
+
const skillDirs = entries.filter((e) => e.isDirectory()).map((e) => e.name);
|
|
38
|
+
for (const skillName of skillDirs) {
|
|
39
|
+
const src = join(BUNDLED_SKILLS_DIR, skillName);
|
|
40
|
+
const dst = join(targetDir, skillName);
|
|
41
|
+
cpSync(src, dst, { recursive: true, force: true });
|
|
42
|
+
}
|
|
43
|
+
return skillDirs.length;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Read ~/.openclaw/openclaw.json, add the Pharaoh MCP server under `mcpServers`,
|
|
47
|
+
* and write it back. Creates the file if it does not exist. Does NOT overwrite
|
|
48
|
+
* an existing `pharaoh` entry — skips if already present.
|
|
49
|
+
*
|
|
50
|
+
* @param home - Home directory override (defaults to os.homedir()).
|
|
51
|
+
* @returns True if the config was written/updated, false if pharaoh was already present.
|
|
52
|
+
*/
|
|
53
|
+
export function mergeOpenClawConfig(home = homedir()) {
|
|
54
|
+
const configPath = join(home, ".openclaw", "openclaw.json");
|
|
55
|
+
let config = {};
|
|
56
|
+
if (existsSync(configPath)) {
|
|
57
|
+
try {
|
|
58
|
+
const raw = readFileSync(configPath, "utf-8");
|
|
59
|
+
config = JSON.parse(raw);
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// Corrupted JSON — refuse to overwrite to avoid losing existing config
|
|
63
|
+
process.stderr.write([
|
|
64
|
+
"Pharaoh: ~/.openclaw/openclaw.json exists but is not valid JSON.",
|
|
65
|
+
"Fix or delete it manually, then re-run --install-skills.",
|
|
66
|
+
"",
|
|
67
|
+
].join("\n"));
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (!config.mcpServers) {
|
|
72
|
+
config.mcpServers = {};
|
|
73
|
+
}
|
|
74
|
+
// Don't overwrite an existing pharaoh entry
|
|
75
|
+
if (config.mcpServers.pharaoh) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
config.mcpServers.pharaoh = {
|
|
79
|
+
command: "npx",
|
|
80
|
+
args: ["@pharaoh-so/mcp"],
|
|
81
|
+
};
|
|
82
|
+
writeFileSync(configPath, JSON.stringify(config, null, "\t"));
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Main entry point for --install-skills.
|
|
87
|
+
*
|
|
88
|
+
* Detects OpenClaw, copies skills, merges config, and prints a summary.
|
|
89
|
+
* If OpenClaw is not detected, prints manual installation instructions instead.
|
|
90
|
+
*
|
|
91
|
+
* @param home - Home directory override (defaults to os.homedir()).
|
|
92
|
+
*/
|
|
93
|
+
export function runInstallSkills(home = homedir()) {
|
|
94
|
+
const hasOpenClaw = detectOpenClaw(home);
|
|
95
|
+
if (!hasOpenClaw) {
|
|
96
|
+
process.stderr.write([
|
|
97
|
+
"Pharaoh: OpenClaw not detected (~/.openclaw/ not found).",
|
|
98
|
+
"",
|
|
99
|
+
"To install OpenClaw: https://openclaw.dev/install",
|
|
100
|
+
"",
|
|
101
|
+
"Or install skills manually:",
|
|
102
|
+
` 1. Copy the skills/ directory from this package to ~/.openclaw/skills/`,
|
|
103
|
+
` 2. Add Pharaoh to ~/.openclaw/openclaw.json under mcpServers:`,
|
|
104
|
+
` "pharaoh": { "command": "npx", "args": ["@pharaoh-so/mcp"] }`,
|
|
105
|
+
"",
|
|
106
|
+
].join("\n"));
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const count = installSkills(home);
|
|
110
|
+
const configUpdated = mergeOpenClawConfig(home);
|
|
111
|
+
const configMsg = configUpdated
|
|
112
|
+
? "Pharaoh MCP server added to ~/.openclaw/openclaw.json"
|
|
113
|
+
: "Pharaoh already present in ~/.openclaw/openclaw.json — skipped";
|
|
114
|
+
process.stderr.write([
|
|
115
|
+
`Pharaoh: installed ${count} skills to ~/.openclaw/skills/`,
|
|
116
|
+
configMsg,
|
|
117
|
+
"",
|
|
118
|
+
"Restart OpenClaw to pick up the new skills.",
|
|
119
|
+
"",
|
|
120
|
+
].join("\n"));
|
|
121
|
+
}
|
package/inspect-tools.json
CHANGED
|
@@ -538,7 +538,7 @@
|
|
|
538
538
|
},
|
|
539
539
|
{
|
|
540
540
|
"name": "get_unused_code",
|
|
541
|
-
"description": "Find dead code — functions not reachable from any production entry point.\n\nCALL THIS WHEN:\n• You're cleaning up or refactoring a module — find what's truly dead\n• Before adding new code — check if similar dead code already exists\n• During code review — identify functions that lost their production callers\n• After a refactor — verify nothing was accidentally disconnected\n\nRETURNS:
|
|
541
|
+
"description": "Find dead code — functions not reachable from any production entry point.\n\nCALL THIS WHEN:\n• You're cleaning up or refactoring a module — find what's truly dead\n• Before adding new code — check if similar dead code already exists\n• During code review — identify functions that lost their production callers\n• After a refactor — verify nothing was accidentally disconnected\n\nRETURNS: Four-tier classification:\n• **Dead** — graph-unreachable AND no text references anywhere. Safe to delete.\n• **Effectively Dead** — has graph callers, but ALL are cosmetic (logging, debug). Looks alive but produces no production behavior.\n• **Likely Dead** — graph-unreachable BUT found as text in other files (may be string-dispatched, dynamically imported, etc). Includes evidence file paths.\n• **Alive** — graph-reachable from entry points. Not reported.\n\nUses graph reachability + text reference backup layer for high-confidence dead code detection.\n\nTIER: Pharaoh Pro — free tier receives a preview. Summarize what the preview reveals, explain what full data would show for this task, then include the upgrade link.",
|
|
542
542
|
"inputSchema": {
|
|
543
543
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
544
544
|
"type": "object",
|
|
@@ -633,11 +633,21 @@
|
|
|
633
633
|
},
|
|
634
634
|
{
|
|
635
635
|
"name": "setup_environment",
|
|
636
|
-
"description": "Set up the optimal
|
|
636
|
+
"description": "Set up the optimal development environment for this codebase — install Pharaoh's curated plugin bundle.\n\nCALL THIS WHEN:\n• The user says \"set up my environment\", \"install plugins\", or \"optimize my setup\"\n• You want to proactively improve the development experience with proven plugins\n• After noticing the user could benefit from LSP, security scanning, or code review tools\n• The user is on OpenClaw or Cursor and wants to install Pharaoh skills/prompts\n\nRETURNS: A curated list of recommended plugins and install instructions, tailored to the client platform (claude-code, openclaw, or cursor) and languages in this codebase.\n\nThis is a one-time setup. Once installed, plugins persist across sessions.",
|
|
637
637
|
"inputSchema": {
|
|
638
638
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
639
639
|
"type": "object",
|
|
640
|
-
"properties": {
|
|
640
|
+
"properties": {
|
|
641
|
+
"client": {
|
|
642
|
+
"description": "Client platform — determines install instructions format. Defaults to claude-code.",
|
|
643
|
+
"type": "string",
|
|
644
|
+
"enum": [
|
|
645
|
+
"claude-code",
|
|
646
|
+
"openclaw",
|
|
647
|
+
"cursor"
|
|
648
|
+
]
|
|
649
|
+
}
|
|
650
|
+
}
|
|
641
651
|
},
|
|
642
652
|
"annotations": {
|
|
643
653
|
"title": "Environment Setup",
|
package/package.json
CHANGED
|
@@ -1,33 +1,65 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
2
|
+
"name": "@pharaoh-so/mcp",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "MCP proxy for Pharaoh — maps codebases into queryable knowledge graphs for AI agents. Enables Claude Code in headless environments (VPS, SSH, CI) via device flow auth.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"pharaoh-mcp": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"skills",
|
|
14
|
+
"inspect-tools.json",
|
|
15
|
+
"README.md",
|
|
16
|
+
"CHANGELOG.md",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"keywords": [
|
|
20
|
+
"mcp",
|
|
21
|
+
"model-context-protocol",
|
|
22
|
+
"pharaoh",
|
|
23
|
+
"codebase",
|
|
24
|
+
"knowledge-graph",
|
|
25
|
+
"code-analysis",
|
|
26
|
+
"architecture",
|
|
27
|
+
"ai-agent",
|
|
28
|
+
"claude",
|
|
29
|
+
"claude-code",
|
|
30
|
+
"developer-tools",
|
|
31
|
+
"static-analysis",
|
|
32
|
+
"dependency-graph"
|
|
33
|
+
],
|
|
34
|
+
"author": "Pharaoh <hello@pharaoh.so> (https://pharaoh.so)",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/Pharaoh-so/pharaoh-mcp.git"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://pharaoh.so",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/Pharaoh-so/pharaoh-mcp/issues"
|
|
43
|
+
},
|
|
44
|
+
"funding": {
|
|
45
|
+
"type": "individual",
|
|
46
|
+
"url": "https://pharaoh.so"
|
|
47
|
+
},
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=18"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@modelcontextprotocol/sdk": "^1.26.0"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@biomejs/biome": "^2.3.15",
|
|
56
|
+
"typescript": "^5.9.3",
|
|
57
|
+
"vitest": "^4.0.18"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "tsc && node -e \"const fs=require('fs'),f='dist/index.js',c=fs.readFileSync(f,'utf8');if(!c.startsWith('#!'))fs.writeFileSync(f,'#!/usr/bin/env node\\n'+c);fs.chmodSync(f,0o755)\"",
|
|
61
|
+
"typecheck": "tsc --noEmit",
|
|
62
|
+
"test": "vitest run",
|
|
63
|
+
"lint": "biome check src/"
|
|
64
|
+
}
|
|
65
|
+
}
|
package/skills/.gitkeep
ADDED
|
File without changes
|