@sammorrowdrums/mcpi-ext 0.1.0 → 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.
Files changed (68) hide show
  1. package/README.md +109 -139
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +23 -3
  4. package/dist/index.js.map +1 -1
  5. package/dist/tool-cli/index.d.ts +2 -2
  6. package/dist/tool-cli/index.d.ts.map +1 -1
  7. package/dist/tool-cli/index.js +1 -2
  8. package/dist/tool-cli/index.js.map +1 -1
  9. package/package.json +9 -7
  10. package/.dockerignore +0 -6
  11. package/.github/dependabot.yml +0 -25
  12. package/.github/workflows/ci.yml +0 -50
  13. package/.hadolint.yaml +0 -6
  14. package/.prettierignore +0 -4
  15. package/.prettierrc +0 -7
  16. package/AGENTS.md +0 -118
  17. package/DECISIONS.md +0 -99
  18. package/Dockerfile +0 -39
  19. package/aube-lock.yaml +0 -4146
  20. package/eslint.config.js +0 -27
  21. package/images/banner.webp +0 -0
  22. package/images/code-c-maude.webp +0 -0
  23. package/images/nuclear-mcp-football.webp +0 -0
  24. package/images/the-skill-dealer.webp +0 -0
  25. package/mise.toml +0 -65
  26. package/scripts/docker-entrypoint.sh +0 -29
  27. package/scripts/test-echo-server.mjs +0 -28
  28. package/scripts/test-mcp-integration.mjs +0 -59
  29. package/scripts/test-tool-cli-smoke.mjs +0 -62
  30. package/src/code-mode/code-mode-integration.test.ts +0 -135
  31. package/src/code-mode/eligibility.test.ts +0 -60
  32. package/src/code-mode/eligibility.ts +0 -16
  33. package/src/code-mode/executor.test.ts +0 -168
  34. package/src/code-mode/executor.ts +0 -163
  35. package/src/code-mode/index.ts +0 -208
  36. package/src/code-mode/tools.ts +0 -110
  37. package/src/code-mode/type-hints.test.ts +0 -187
  38. package/src/code-mode/type-hints.ts +0 -249
  39. package/src/docker-e2e.test.ts +0 -195
  40. package/src/docker-e2e.ts +0 -277
  41. package/src/index.test.ts +0 -8
  42. package/src/index.ts +0 -158
  43. package/src/mcp/client-manager.test.ts +0 -250
  44. package/src/mcp/client-manager.ts +0 -199
  45. package/src/mcp/config-loader.test.ts +0 -115
  46. package/src/mcp/config-loader.ts +0 -46
  47. package/src/mcp/config.ts +0 -40
  48. package/src/mcp/index.ts +0 -4
  49. package/src/skills/discover.ts +0 -81
  50. package/src/skills/format.test.ts +0 -70
  51. package/src/skills/format.ts +0 -42
  52. package/src/skills/index.ts +0 -9
  53. package/src/skills/load-skill-tool.ts +0 -136
  54. package/src/skills/mcp-tool-proxy.ts +0 -143
  55. package/src/skills/skill-integration.test.ts +0 -139
  56. package/src/skills/skill-registry.test.ts +0 -83
  57. package/src/skills/skill-registry.ts +0 -69
  58. package/src/test-servers/weather-server.ts +0 -171
  59. package/src/test-servers/weather-stdio.ts +0 -11
  60. package/src/tool-cli/cli.ts +0 -232
  61. package/src/tool-cli/constants.ts +0 -15
  62. package/src/tool-cli/format.test.ts +0 -33
  63. package/src/tool-cli/format.ts +0 -56
  64. package/src/tool-cli/index.ts +0 -3
  65. package/src/tool-cli/rpc-client.ts +0 -39
  66. package/src/tool-cli/rpc-server.test.ts +0 -193
  67. package/src/tool-cli/rpc-server.ts +0 -287
  68. package/tsconfig.json +0 -21
package/README.md CHANGED
@@ -1,6 +1,16 @@
1
1
  # mcpi-ext
2
2
 
3
- > **Experimental.** This extension implements progressive MCP tool discovery via skills for [mcpi](https://github.com/SamMorrowDrums/mcpi) (an experimental pi fork). Please only use this to try out the experiment on skills over MCP. See [progressive tool discovery docs](https://github.com/SamMorrowDrums/mcpi/blob/main/docs/progressive-tool-discovery.md) for details.
3
+ > **Experimental.** This extension implements progressive MCP tool discovery via skills for [mcpi](https://github.com/SamMorrowDrums/mcpi) (an experimental pi fork). See the [skills-as-groups proposal](https://github.com/modelcontextprotocol/experimental-ext-grouping/pull/13) for the proposed MCP spec addition, and the [progressive tool discovery docs](https://github.com/SamMorrowDrums/mcpi/blob/main/docs/progressive-tool-discovery.md) for implementation details.
4
+
5
+ ```sh
6
+ npm install -g @sammorrowdrums/mcpi@latest @sammorrowdrums/mcpi-ext@latest @sammorrowdrums/tool-cli@latest
7
+ mcpi --extension $(npm root -g)/@sammorrowdrums/mcpi-ext/dist/index.js \
8
+ --mcp-config ~/.config/mcpi-ext/mcp.json
9
+ ```
10
+
11
+ See [Quick Start](#quick-start) for MCP server configuration.
12
+
13
+ ---
4
14
 
5
15
  ![Three figures in a dark, Sandman-esque realm — The Skill Dealer, The Nuclear Football, and Codey C. Maude — standing before swirling constellations of MCP tool connections](images/banner.webp)
6
16
 
@@ -30,143 +40,85 @@ Building custom [MCP](https://modelcontextprotocol.io/) support as [mcpi](https:
30
40
 
31
41
  > _The Skill Dealer does not give you what you ask for. The Skill Dealer gives you what you need — and nothing more._
32
42
 
33
- MCP servers can ship `skill://` resources: SKILL.md files with frontmatter declaring which tools a skill gates. On connection, the extension discovers all skills and registers their tools with `deferred: true` present in pi's tool registry but excluded from both the tools array sent to the model and the system prompt.
34
-
35
- This approach is **cache-preserving**: the tools array and system prompt stay constant throughout the conversation, so prompt cache is never invalidated by skill activation.
43
+ MCP servers ship `skill://` resources SKILL.md files declaring which tools a skill gates. The extension discovers skills on connection and registers their tools with `deferred: true`: present in the registry for dispatch but hidden from the model and the prompt. **Cache is preserved** — neither the tools array nor the system prompt ever changes.
36
44
 
37
- ### How deferred tool gating works
45
+ When the model calls `load_skill`, the skill's instructions arrive and its tools are unblocked. The model discovers tools from the skill body and can call them immediately. The MCP server itself declares how its tools should be discovered.
38
46
 
39
- Three mechanisms work together:
47
+ 📖 [**How it works →**](docs/skills.md) — deferred gating, `defer_loading` provider support, `tool_call` hook enforcement.
40
48
 
41
- 1. **`deferred: true`** MCP tool proxies are registered with this flag. Pi's runtime keeps them in the internal registry for execution dispatch (via `resolveTool`) but excludes them from the tools array and system prompt sent to the model.
49
+ > _"What you do not need to know," said the Skill Dealer, shuffling the deck, "you will not be burdened with knowing."_
42
50
 
43
- 2. **Provider-native `defer_loading`**Pi's providers map `deferred: true` to the native API parameter. Both Anthropic and OpenAI support this (tested with Claude Opus 4.7 and GPT-5.4). On Anthropic, `defer_loading` keeps the tool in the grammar but hidden from the model's view the skill body naming the tools is sufficient for the model to call them. On OpenAI Responses, pi-mono auto-injects `{"type": "tool_search"}` and the model searches/loads deferred tools server-side.
51
+ ![Skills enabling MCP tools — the model loads a skill and gains access to gated tools](images/skills-enabling-mcp-tools.png)
44
52
 
45
- 3. **`tool_call` hook gating** — The extension registers a `tool_call` event handler that blocks premature calls to skill-gated tools. If the model tries to call a gated tool before loading its skill, the handler returns an error: _"Tool X requires loading a skill first. Call load_skill with: Y"_. This creates a natural feedback loop and serves as the provider-agnostic enforcement layer.
53
+ ---
46
54
 
47
- When the model invokes `load_skill`:
55
+ ## II. The Nuclear Football
48
56
 
49
- 1. The skill's SKILL.md is read from the MCP server and returned as workflow instructions
50
- 2. The skill's `allowedTools` are added to the `enabledTools` set, unblocking the `tool_call` gate
51
- 3. The model can now call the tools — it discovers them from the skill body (which names them) and the provider's grammar
57
+ ![A glowing briefcase marked 'tool-cli' being passed between hands in a dark corridor, trailing sparks of shell commands](images/nuclear-mcp-football.webp)
52
58
 
53
- ```mermaid
54
- sequenceDiagram
55
- participant Model
56
- participant load_skill
57
- participant SkillRegistry
58
- participant MCP Server
59
- participant tool_call gate
60
-
61
- Model->>load_skill: load_skill("github-pr")
62
- load_skill->>SkillRegistry: Look up skill
63
- SkillRegistry-->>load_skill: skill metadata + allowed-tools
64
- load_skill->>MCP Server: Read skill://github-pr
65
- MCP Server-->>load_skill: SKILL.md body
66
- load_skill->>tool_call gate: Enable allowed-tools
67
- load_skill-->>Model: Return workflow instructions
68
- Note over Model: Skill body names the tools.<br/>Model calls them via tool_use.
69
- Model->>tool_call gate: create_pull_request(...)
70
- tool_call gate-->>Model: ✓ Allowed (skill loaded)
71
- ```
59
+ > _The Football is not a weapon. The Football is the authority to use weapons. Whoever holds it can reach any server, call any tool, chain any result — but they must do so deliberately, one command at a time._
72
60
 
73
- This is self-referential enablement: **the MCP server itself declares how its tools should be discovered**. The harness holds all the tools as deferred. The skill decides which ones the model can access. The model gets instructions in one atomic operation, paying only the tokens for the skills it actually loads — and the prompt cache stays intact.
61
+ [`tool-cli`](https://github.com/SamMorrowDrums/tool-cli) is a thin CLI binary that speaks JSON-RPC to the extension. The agent uses it like any shell command composable with pipes, grep, jq, loops. Discovery is progressive: server list tool list schema call. Each step pays only the tokens it needs.
74
62
 
75
- The context window stays clean. The tools appear exactly when the model has the context to use them well. And prompt cache is preserved because neither the tools array nor the system prompt changes.
63
+ 📖 [**How it works →**](docs/tool-cli.md) architecture, progressive discovery, shell composability.
64
+ 📦 [**Standalone package →**](https://github.com/SamMorrowDrums/tool-cli) — `ToolProvider` interface, server, and implementor guidance for other languages.
76
65
 
77
- Anthropic's [tool search](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool) solves a similar problem from the model side — deferring tool loading to avoid cache invalidation from large tool lists. Our approach uses Anthropic's native `defer_loading` parameter (when available) combined with extension-level `tool_call` gating for provider-agnostic safety. Where tool search has the model _pull_ tools on demand, skill invocation _pushes_ them: when `load_skill` fires, the skill's tools are unblocked and the model gets workflow instructions. The model doesn't search for tools the right tools arrive because the skill declared them.
66
+ > _They pass the Football from hand to hand. It is heavy with potential. Every tool on every server is one command awaybut you must type the command yourself._
78
67
 
79
- > _"What you do not need to know," said the Skill Dealer, shuffling the deck, "you will not be burdened with knowing."_
68
+ ![tool-cli in action progressive discovery piped through grep](images/tool-cli-grep.png)
80
69
 
81
70
  ---
82
71
 
83
- ## II. The Nuclear Football
84
-
85
- ![A glowing briefcase marked 'tool-cli' being passed between hands in a dark corridor, trailing sparks of shell commands](images/nuclear-mcp-football.webp)
86
-
87
- > _The Football is not a weapon. The Football is the authority to use weapons. Whoever holds it can reach any server, call any tool, chain any result — but they must do so deliberately, one command at a time._
88
-
89
- `tool-cli` is a thin CLI binary that speaks JSON-RPC 2.0 to the extension over HTTP. The agent uses it like any shell command — composable with pipes, grep, jq, loops, and all the bash idioms it already knows.
90
-
91
- ```mermaid
92
- flowchart TD
93
- A["Agent (mcpi)"] -->|shell exec| B["tool-cli &lt;server&gt; &lt;tool&gt; '{args}'"]
94
- B -->|"HTTP JSON-RPC (localhost:7179)"| C["ToolCliRpcServer (in extension)"]
95
- C -->|"MCP protocol (stdio/HTTP)"| D["MCP Server(s)"]
96
- ```
72
+ ## III. Codey C. Maude
97
73
 
98
- Discovery is **progressive** the agent pays only the tokens it needs:
74
+ ![A luminous figure composed of flowing code, sitting cross-legged in a V8 isolate bubble, reading structured data from floating JSON schemas](images/code-c-maude.webp)
99
75
 
100
- ```sh
101
- tool-cli --help # What servers exist?
102
- tool-cli github # What tools does this server have?
103
- tool-cli github search_code # What's the schema for this tool?
104
- tool-cli github search_code '{"query":"auth"}' # Call it
105
- ```
76
+ > _Codey does not ask permission. Codey does not need to. Everything Codey touches is read-only, every result is typed, and the sandbox cannot be escaped. Codey is safe by construction._
106
77
 
107
- And because it's shell-native, the agent gets bash superpowers for free:
78
+ Code Mode targets **read-only** tools with **structured output**. The model writes JavaScript that chains MCP tool calls inside a V8 isolate — memory-limited, time-limited, no filesystem or network access. Perfect for pagination loops, aggregation, and joins across many calls.
108
79
 
109
- ```sh
110
- # Chain tool calls
111
- tool-cli myserver list_items '{}' | jq -r '.[0].id' | \
112
- xargs -I{} tool-cli myserver get_item '{"id":"{}"}'
113
-
114
- # Process collections
115
- for city in London Tokyo Paris; do
116
- echo "=== $city ==="
117
- tool-cli weather check_weather '{"city":"'"$city"'"}'
118
- done
119
-
120
- # Combine with the Unix toolbox
121
- tool-cli myserver export_csv '{"table":"users"}' | sort -t, -k2 | head -20
122
- ```
80
+ 📖 [**How it works →**](docs/code-mode.md) — sandbox isolation, eligibility, tool dispatch.
123
81
 
124
- The RPC server is the single choke point for all tool execution the natural interception point for human-in-the-loop confirmation on destructive operations.
82
+ > _"I can see everything," Codey said, eyes reflecting infinite JSON. "I just can't touch it. That's the point. That's why they trust me."_
125
83
 
126
- > _They pass the Football from hand to hand. It is heavy with potential. Every tool on every server is one command away — but you must type the command yourself._
84
+ ![Code Mode in action chaining MCP tools in a V8 sandbox to build a histogram](images/code-mode-histogram.png)
127
85
 
128
86
  ---
129
87
 
130
- ## III. Codey C. Maude
88
+ ## When to Use Each Tier
131
89
 
132
- ![A luminous figure composed of flowing code, sitting cross-legged in a V8 isolate bubble, reading structured data from floating JSON schemas](images/code-c-maude.webp)
90
+ > _They asked the three: "Why are there three of you? Isn't one enough?"_
91
+ >
92
+ > _The Skill Dealer laid down a card. "When you know the ritual — the steps, the order, the tools that belong together — you come to me. I give you the ceremony whole."_
93
+ >
94
+ > _The Football's briefcase clicked open. "When you need one answer, quickly, and you know what you're looking for — you reach for me. I'm a shell command. I compose."_
95
+ >
96
+ > _Codey smiled, cross-legged in the isolate. "And when the answer is buried in nine pages of data, when you need loops and math and joins across a thousand records — you write the code, and I run it. Safely."_
97
+ >
98
+ > _"Three is not redundancy," said the Skill Dealer. "Three is completeness."_
133
99
 
134
- > _Codey does not ask permission. Codey does not need to. Everything Codey touches is read-only, every result is typed, and the sandbox cannot be escaped. Codey is safe by construction._
100
+ **The Skill Dealer** when there's a curated workflow for the domain task. "Triage these 20 issues" means loading the triage skill, which gives you the right tools _plus_ the workflow instructions (dedup checks, labeling conventions, close criteria). Re-deriving that from raw tool calls is wasteful and error-prone.
135
101
 
136
- Code Mode is for the tools that are **read-only** (`annotations.readOnlyHint === true`) and return **structured output** (`outputSchema` defined). These two properties together make a tool safe for autonomous use — it can't modify anything, and its results are machine-parseable.
102
+ **The Nuclear Football** one-shot or exploratory calls, especially when piping through Unix tools. `tool-cli github search_code '{"query":"auth"}' | jq '.items[].path'` one call, pipe to jq, done. Also perfect for discovering what's on a server you haven't used before.
137
103
 
138
- The model writes JavaScript that chains these tools:
104
+ **Codey C. Maude** when you need real computation across many calls: pagination loops, aggregation, joining results, math. 876 issues across 9 pages, counting labels per issue, summing into a histogram — that's a loop with state. Doing it via tool-cli would mean 9 separate calls plus shell-side aggregation. Fragile. Codey does it in one sandbox execution.
139
105
 
140
- ```javascript
141
- // Executed in a V8 isolate via isolated-vm
142
- const issues = await codemode.list_issues({ repo: "owner/repo", state: "open" });
143
- const critical = issues.filter((i) => i.labels.includes("critical"));
144
- const details = await Promise.all(critical.map((i) => codemode.get_issue({ number: i.number })));
145
- return details.map((d) => ({ title: d.title, assignee: d.assignee }));
146
- ```
106
+ ### A single task using all three
147
107
 
148
- The sandbox runs in `isolated-vm` genuine V8-level isolation:
108
+ > _"Triage the backlog of github/github-mcp-server: find stale bugs older than 90 days with no recent activity, summarize patterns, and close obvious duplicates."_
149
109
 
150
- - **128MB memory limit**, 30-second timeout
151
- - **No access** to filesystem, network, or Node.js APIs
152
- - Tool calls dispatch to the host via `Reference` callbacks — MCP execution happens outside the sandbox
153
- - ~15ms overhead, negligible vs network I/O
110
+ 1. **Codey** paginated all open bug issues, filtered by `updated < 90d ago`, grouped by label and keyword to find clusters. Computation across many pages — this is what sandboxes are for.
154
111
 
155
- Two tools expose this to the model:
112
+ 2. **The Football** spot-checked suspect issues. `tool-cli github get_issue '{"number":42}'` piped through `jq` to eyeball specific fields. Quick, ad-hoc, composable.
156
113
 
157
- | Tool | Purpose |
158
- | -------------- | ---------------------------------------------------------------------------------- |
159
- | `code_search` | Discover available tools — `codemode.listTools()`, `codemode.describeTools(names)` |
160
- | `code_execute` | Chain tool calls — write JS that calls `codemode.toolName(args)` |
114
+ 3. **The Skill Dealer** loaded `triage-issues` to actually close the duplicates — following the project's triage workflow with correct labels, comment templates, and close reasons. The ceremony, performed correctly.
161
115
 
162
- > _"I can see everything," Codey said, eyes reflecting infinite JSON. "I just can't touch it. That's the point. That's why they trust me."_
116
+ > _The rule of thumb is simple: skill for workflows, tool-cli for one-shots, code_execute for computation. The three are not competing. They are collaborating._
163
117
 
164
118
  ---
165
119
 
166
120
  ## The Architecture
167
121
 
168
- The three tiers are complementary. Skills give curated access with workflow knowledge. The Football gives interactive access with safety. Code Mode gives autonomous access to safe operations at scale.
169
-
170
122
  ```mermaid
171
123
  flowchart TD
172
124
  subgraph mcpi["mcpi (agent)"]
@@ -185,66 +137,62 @@ flowchart TD
185
137
 
186
138
  The harness controls what the model sees. MCP servers just expose their tools and skills. The extension decides _when_ and _how_ to reveal them.
187
139
 
140
+ ### Every call flows through the harness
141
+
142
+ All three tiers route MCP tool calls back through the extension process. This is a subtle but important property: even when the model writes sandboxed JavaScript (Code Mode) or shells out to `tool-cli`, the actual MCP call happens in the harness. This means:
143
+
144
+ - **Every tool invocation appears in the agent log** — skills, tool-cli one-shots, and Code Mode sandbox calls alike. Full observability without instrumentation.
145
+ - **Human-in-the-loop can be added at one point** — the `McpClientManager` is the single choke point. Future work can check tool annotations (`readOnlyHint`, `destructiveHint`) and gate destructive calls through user confirmation, regardless of which tier initiated them.
146
+
188
147
  > _MCP doesn't have a context problem. It never did. It was just waiting for someone to imagine the right way to read the runes._
189
148
 
190
149
  ---
191
150
 
192
151
  ## Quick Start
193
152
 
194
- ### Install from npm
195
-
196
- ```sh
197
- npm install @sammorrowdrums/mcpi @sammorrowdrums/mcpi-ext
198
- ```
199
-
200
- Run mcpi with the extension:
153
+ ### 1. Install
201
154
 
202
155
  ```sh
203
- npx mcpi --extension node_modules/@sammorrowdrums/mcpi-ext/dist/index.js \
204
- --mcp-config ~/.config/mcpi-ext/mcp.json
156
+ npm install -g @sammorrowdrums/mcpi@latest @sammorrowdrums/mcpi-ext@latest @sammorrowdrums/tool-cli@latest
205
157
  ```
206
158
 
207
- ### Local development
159
+ ### 2. Configure MCP servers
208
160
 
209
- ```sh
210
- curl https://mise.run | sh # install mise
211
- eval "$(~/.local/bin/mise activate bash)" # activate
212
- mise install # install node
213
- npm install # install dependencies
214
- mise run build # build
215
- mise run test # test
216
- ```
217
-
218
- For local dev, override the `@sammorrowdrums/mcpi` dependency to point at your local mcpi clone:
161
+ Create `~/.config/mcpi-ext/mcp.json`:
219
162
 
220
163
  ```json
221
- // package.json overrides (not committed)
222
- "devDependencies": {
223
- "@sammorrowdrums/mcpi": "file:../path/to/mcpi/packages/coding-agent"
164
+ {
165
+ "mcpServers": {
166
+ "github": {
167
+ "type": "stdio",
168
+ "command": "docker",
169
+ "args": [
170
+ "run",
171
+ "--rm",
172
+ "-i",
173
+ "-e",
174
+ "GITHUB_PERSONAL_ACCESS_TOKEN",
175
+ "ghcr.io/github/github-mcp-server:skill-discovery",
176
+ "stdio"
177
+ ],
178
+ "env": {
179
+ "GITHUB_PERSONAL_ACCESS_TOKEN": "xxx"
180
+ }
181
+ }
182
+ }
224
183
  }
225
184
  ```
226
185
 
227
- Then load the extension from the built output:
186
+ Replace `xxx` with your [GitHub personal access token](https://github.com/settings/tokens). See [github/github-mcp-server](https://github.com/github/github-mcp-server) for the standard server.
228
187
 
229
- ```sh
230
- mcpi --extension ./dist/index.js --mcp-config ~/.config/mcpi-ext/mcp.json
231
- ```
232
-
233
- ### MCP server configuration
188
+ > **Note:** The `skill-discovery` tag includes experimental `skill://` resources that enable Tier 1 progressive discovery. The standard `ghcr.io/github/github-mcp-server` image works too — tool-cli (Tier 2) and Code Mode (Tier 3) function with any MCP server, but skill-gated tool activation requires `skill://` resources.
234
189
 
235
- Create `~/.config/mcpi-ext/mcp.json` (or pass `--mcp-config /path/to/config.json`):
190
+ You can add more servers — both `stdio` (spawns a process) and `remote` (Streamable HTTP) are supported:
236
191
 
237
192
  ```json
238
193
  {
239
194
  "mcpServers": {
240
- "github": {
241
- "type": "stdio",
242
- "command": "npx",
243
- "args": ["-y", "@modelcontextprotocol/server-github"],
244
- "env": {
245
- "GITHUB_PERSONAL_ACCESS_TOKEN": "xxx"
246
- }
247
- },
195
+ "github": { "...": "..." },
248
196
  "my-remote-server": {
249
197
  "type": "remote",
250
198
  "url": "https://my-mcp-server.example.com/mcp",
@@ -256,7 +204,28 @@ Create `~/.config/mcpi-ext/mcp.json` (or pass `--mcp-config /path/to/config.json
256
204
  }
257
205
  ```
258
206
 
259
- Each server can be `stdio` (spawns a child process) or `remote` (Streamable HTTP). The extension connects to all configured servers on startup, discovers their tools, and gates them via skills.
207
+ ### 3. Run
208
+
209
+ ```sh
210
+ mcpi --extension $(npm root -g)/@sammorrowdrums/mcpi-ext/dist/index.js \
211
+ --mcp-config ~/.config/mcpi-ext/mcp.json
212
+ ```
213
+
214
+ ### Local development
215
+
216
+ ```sh
217
+ git clone https://github.com/SamMorrowDrums/mcpi-ext.git
218
+ cd mcpi-ext
219
+ npm install
220
+ npm run build
221
+ npm test
222
+ ```
223
+
224
+ Then run with your local build:
225
+
226
+ ```sh
227
+ mcpi --extension ./dist/index.js --mcp-config ~/.config/mcpi-ext/mcp.json
228
+ ```
260
229
 
261
230
  See [AGENTS.md](AGENTS.md) for full tooling docs, dev loop, and architecture details.
262
231
 
@@ -270,7 +239,8 @@ src/
270
239
  tool-cli/ tool-cli RPC server, client, CLI binary, prompt
271
240
  code-mode/ V8 sandbox executor, eligibility, type hints
272
241
  test-servers/ Test MCP servers (weather, echo)
273
- images/ Banner and character art
242
+ docs/ Detailed mechanism documentation
243
+ images/ Banner, character art, and screenshots
274
244
  ```
275
245
 
276
246
  ## License
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,YAAY,EAIb,MAAM,sBAAsB,CAAC;AAa9B,MAAM,CAAC,OAAO,WAAW,EAAE,EAAE,YAAY,QA0IxC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,YAAY,EAIb,MAAM,sBAAsB,CAAC;AAc9B,MAAM,CAAC,OAAO,WAAW,EAAE,EAAE,YAAY,QA8JxC"}
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { CodeModeManager } from "./code-mode/index.js";
2
2
  import { dockerE2ETool } from "./docker-e2e.js";
3
3
  import { McpClientManager, loadMcpConfig } from "./mcp/index.js";
4
4
  import { SkillRegistry, createLoadSkillTool, discoverSkillsFromServer, formatMcpSkillsForPrompt, registerMcpToolProxies, } from "./skills/index.js";
5
- import { ToolCliRpcServer, formatToolCliForPrompt } from "./tool-cli/index.js";
5
+ import { ToolCliServer, formatToolCliForPrompt } from "./tool-cli/index.js";
6
6
  export default function (pi) {
7
7
  pi.registerTool(dockerE2ETool);
8
8
  pi.registerFlag("mcp-config", {
@@ -11,10 +11,26 @@ export default function (pi) {
11
11
  });
12
12
  const mcpManager = new McpClientManager();
13
13
  const skillRegistry = new SkillRegistry();
14
- const rpcServer = new ToolCliRpcServer(mcpManager);
15
14
  const codeModeManager = new CodeModeManager();
16
15
  const enabledTools = new Set();
17
16
  const gatedToolNames = new Set();
17
+ // Bridge McpClientManager to the ToolProvider interface
18
+ const toolProvider = {
19
+ getServerNames: () => mcpManager.getConnectedServers(),
20
+ getTools: (server) => mcpManager.getToolsForServer(server),
21
+ async callTool(server, tool, args) {
22
+ const client = mcpManager.getClient(server);
23
+ if (!client)
24
+ throw new Error(`No client for server "${server}"`);
25
+ const result = await client.callTool({ name: tool, arguments: args });
26
+ return {
27
+ content: result.content,
28
+ isError: result.isError === true ? true : undefined,
29
+ structuredContent: result.structuredContent,
30
+ };
31
+ },
32
+ };
33
+ const rpcServer = new ToolCliServer(toolProvider);
18
34
  // Register the load_skill tool so the model can activate MCP skills
19
35
  pi.registerTool(createLoadSkillTool({ registry: skillRegistry, mcpManager, enabledTools }));
20
36
  pi.on("session_start", async (_event, ctx) => {
@@ -64,7 +80,9 @@ export default function (pi) {
64
80
  }
65
81
  // Start the tool-cli RPC server for progressive tool discovery
66
82
  try {
67
- await rpcServer.start(log);
83
+ const { port, token } = await rpcServer.start(log);
84
+ pi.setEnv("TOOL_CLI_PORT", String(port));
85
+ pi.setEnv("TOOL_CLI_TOKEN", token);
68
86
  }
69
87
  catch (err) {
70
88
  log(`[tool-cli] Failed to start RPC server: ${err.message}`);
@@ -120,6 +138,8 @@ export default function (pi) {
120
138
  };
121
139
  });
122
140
  pi.on("session_shutdown", async () => {
141
+ pi.unsetEnv("TOOL_CLI_PORT");
142
+ pi.unsetEnv("TOOL_CLI_TOKEN");
123
143
  await rpcServer.stop();
124
144
  await mcpManager.disconnectAll();
125
145
  skillRegistry.clear();
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE/E,MAAM,CAAC,OAAO,WAAW,EAAgB;IACvC,EAAE,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IAE/B,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE;QAC5B,WAAW,EAAE,4CAA4C;QACzD,IAAI,EAAE,QAAQ;KACf,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,IAAI,gBAAgB,EAAE,CAAC;IAC1C,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;IAC1C,MAAM,SAAS,GAAG,IAAI,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACnD,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;IAC9C,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;IACvC,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;IAEzC,oEAAoE;IACpE,EAAE,CAAC,YAAY,CAAC,mBAAmB,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,YAA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Ae,CAAC,CAAC;QAC7B,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QAC9B,MAAM,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,MAAM,UAAU,CAAC,aAAa,EAAE,CAAC;QACjC,aAAa,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,4 +1,4 @@
1
- export { ToolCliRpcServer } from "./rpc-server.js";
1
+ export { ToolCliServer } from "@sammorrowdrums/tool-cli/server";
2
+ export type { ToolProvider } from "@sammorrowdrums/tool-cli/server";
2
3
  export { formatToolCliForPrompt } from "./format.js";
3
- export { DEFAULT_PORT, PORT_ENV_VAR, resolvePort } from "./constants.js";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tool-cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tool-cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC"}
@@ -1,4 +1,3 @@
1
- export { ToolCliRpcServer } from "./rpc-server.js";
1
+ export { ToolCliServer } from "@sammorrowdrums/tool-cli/server";
2
2
  export { formatToolCliForPrompt } from "./format.js";
3
- export { DEFAULT_PORT, PORT_ENV_VAR, resolvePort } from "./constants.js";
4
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tool-cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tool-cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "@sammorrowdrums/mcpi-ext",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "dependencies": {
5
5
  "@modelcontextprotocol/sdk": "^1.29.0",
6
+ "@sammorrowdrums/tool-cli": "^0.3.0",
6
7
  "isolated-vm": "^6.1.2",
7
8
  "typebox": "^1.1.31",
8
9
  "zod": "^4.3.6"
9
10
  },
10
11
  "peerDependencies": {
11
- "@sammorrowdrums/mcpi": ">=0.70.0"
12
+ "@sammorrowdrums/mcpi": ">=0.70.9"
12
13
  },
13
14
  "devDependencies": {
14
- "@sammorrowdrums/mcpi": "file:../../../repos/pi-mono/packages/coding-agent",
15
15
  "@eslint/js": "^10.0.1",
16
+ "@sammorrowdrums/mcpi": "^0.70.9",
16
17
  "@types/node": "^25.6.0",
17
18
  "eslint": "^10.2.1",
18
19
  "eslint-config-prettier": "^10.1.8",
@@ -29,6 +30,7 @@
29
30
  "format:check": "prettier --check .",
30
31
  "lint": "eslint .",
31
32
  "lint:fix": "eslint --fix .",
33
+ "prepublishOnly": "npm run build",
32
34
  "start": "node dist/index.js",
33
35
  "test": "vitest --run"
34
36
  },
@@ -36,11 +38,11 @@
36
38
  "node": ">=22.13.0"
37
39
  },
38
40
  "description": "MCP extension for mcpi — tiered progressive tool discovery",
41
+ "files": [
42
+ "dist"
43
+ ],
39
44
  "license": "MIT",
40
45
  "main": "./dist/index.js",
41
46
  "type": "module",
42
- "types": "./dist/index.d.ts",
43
- "bin": {
44
- "tool-cli": "./dist/tool-cli/cli.js"
45
- }
47
+ "types": "./dist/index.d.ts"
46
48
  }
package/.dockerignore DELETED
@@ -1,6 +0,0 @@
1
- node_modules
2
- dist
3
- .git
4
- .gitignore
5
- *.md
6
- .pi
@@ -1,25 +0,0 @@
1
- version: 2
2
-
3
- updates:
4
- - package-ecosystem: npm
5
- directory: /
6
- schedule:
7
- interval: weekly
8
- open-pull-requests-limit: 10
9
- groups:
10
- dev-dependencies:
11
- dependency-type: development
12
- update-types:
13
- - minor
14
- - patch
15
- production-dependencies:
16
- dependency-type: production
17
- update-types:
18
- - minor
19
- - patch
20
-
21
- - package-ecosystem: github-actions
22
- directory: /
23
- schedule:
24
- interval: weekly
25
- open-pull-requests-limit: 5
@@ -1,50 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- branches: [main]
6
- pull_request:
7
- branches: [main]
8
-
9
- concurrency:
10
- group: ci-${{ github.ref }}
11
- cancel-in-progress: true
12
-
13
- permissions:
14
- contents: read
15
- models: read
16
-
17
- jobs:
18
- ci:
19
- name: Lint, Build & Test
20
- runs-on: ubuntu-latest
21
- steps:
22
- - uses: actions/checkout@v6
23
-
24
- - uses: jdx/mise-action@v4
25
-
26
- - name: Install dependencies
27
- run: npm install
28
-
29
- - name: Lint
30
- run: mise run lint
31
-
32
- - name: Lint Dockerfile
33
- uses: hadolint/hadolint-action@v3.1.0
34
- with:
35
- dockerfile: Dockerfile
36
-
37
- - name: Check formatting
38
- run: mise run format:check
39
-
40
- - name: Type-check
41
- run: mise run check
42
-
43
- - name: Build
44
- run: mise run build
45
-
46
- - name: Test
47
- run: mise run test
48
-
49
- - name: MCP integration smoke test
50
- run: mise run test:integration
package/.hadolint.yaml DELETED
@@ -1,6 +0,0 @@
1
- # hadolint configuration
2
- # DL3008: Pin versions in apt-get — not practical for a dev/e2e image
3
- # SC1091: Can't follow sourced file (/etc/os-release) — false positive
4
- ignored:
5
- - DL3008
6
- - SC1091
package/.prettierignore DELETED
@@ -1,4 +0,0 @@
1
- dist/
2
- node_modules/
3
- aube-lock.yaml
4
- *.tsbuildinfo
package/.prettierrc DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "semi": true,
3
- "singleQuote": false,
4
- "trailingComma": "all",
5
- "printWidth": 100,
6
- "tabWidth": 2
7
- }