pi-mcp-client 0.8.0 → 0.9.0
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/README.md +6 -2
- package/dist/index.js +732 -155
- package/docs/behavior.md +62 -1
- package/docs/commands.md +5 -3
- package/docs/configuration.md +21 -7
- package/docs/tool-reference.md +7 -0
- package/docs/troubleshooting.md +18 -0
- package/package.json +1 -1
package/docs/behavior.md
CHANGED
|
@@ -51,6 +51,41 @@ configuration reload invalidate pending selections. The agent must be idle when
|
|
|
51
51
|
you choose **Use prompt**; another active turn is never silently interrupted.
|
|
52
52
|
Accepted content becomes session data and may contain sensitive information.
|
|
53
53
|
|
|
54
|
+
## Server requests for input
|
|
55
|
+
|
|
56
|
+
During a tool call, a server can ask you for information or send you to a web
|
|
57
|
+
page. Pi shows each request in a dialog that names the requesting server. The
|
|
58
|
+
model never sees or answers these dialogs, and the tool call waits until you
|
|
59
|
+
respond. Time spent answering doesn't count against the
|
|
60
|
+
[tool timeout](configuration.md#pi-specific-options).
|
|
61
|
+
|
|
62
|
+
Form requests list the requested fields with their current values, including
|
|
63
|
+
server defaults. Select a field to change it; Pi validates each value against
|
|
64
|
+
the field's type and constraints. Only **Submit** sends values to the server.
|
|
65
|
+
**Decline** refuses the request, and **Cancel** or Esc dismisses it; the server
|
|
66
|
+
receives no values either way. Don't enter passwords, API keys, or payment
|
|
67
|
+
details in a form. Servers must use a web page for sensitive information.
|
|
68
|
+
|
|
69
|
+
Web page requests show the site and the full URL before anything opens.
|
|
70
|
+
**Open in browser** launches your default browser. **I'll open it myself**
|
|
71
|
+
confirms without launching one, which is useful over SSH; copy the URL first.
|
|
72
|
+
Pi opens only HTTPS pages, or HTTP pages on this computer, and refuses URLs with
|
|
73
|
+
embedded credentials. Site names with internationalized characters appear in
|
|
74
|
+
their encoded `xn--` form with a warning. Information you enter on the page goes
|
|
75
|
+
to that site, not to Pi.
|
|
76
|
+
|
|
77
|
+
Some servers refuse to run a tool until you complete a step on a web page. After
|
|
78
|
+
you open the page, Pi waits until the server confirms completion or you choose
|
|
79
|
+
**Done**. The tool doesn't run again automatically: the model receives the
|
|
80
|
+
outcome and can call the tool again after you complete the step.
|
|
81
|
+
|
|
82
|
+
Pi accepts server requests only in interactive sessions and only while a tool
|
|
83
|
+
call to that server is running. Requests at other times, including during
|
|
84
|
+
resource reads and prompt previews, are refused without a dialog. Headless
|
|
85
|
+
sessions don't offer this capability to servers, so servers that support it
|
|
86
|
+
fall back to their non-interactive behavior. Dialogs appear one at a time.
|
|
87
|
+
Stopping the tool call or ending the session closes any open request.
|
|
88
|
+
|
|
54
89
|
## Discovery and caching
|
|
55
90
|
|
|
56
91
|
Connections start on demand, never while the extension factory loads. A search
|
|
@@ -125,7 +160,8 @@ see [large results](troubleshooting.md#large-results) for size limits.
|
|
|
125
160
|
|
|
126
161
|
Only load configuration you trust. Server executables and secret commands run
|
|
127
162
|
with your user permissions; trusted project configuration can replace global
|
|
128
|
-
connections and settings.
|
|
163
|
+
connections and settings. See [project trust](#project-trust) for when a
|
|
164
|
+
project's `.mcp.json` loads.
|
|
129
165
|
|
|
130
166
|
Configuration imports require an explicit file, scope, selection, and final
|
|
131
167
|
confirmation. Import previews hide connection values; review the source file
|
|
@@ -148,3 +184,28 @@ Pi's tool restrictions to prevent discovery and resource operations. Already act
|
|
|
148
184
|
native tools have their own tool restrictions. Per-resource permission policies
|
|
149
185
|
aren't implemented. Prompt selection uses explicit user commands, not the
|
|
150
186
|
model-facing tool allowlist; disable the server to prevent prompt access.
|
|
187
|
+
|
|
188
|
+
## Project trust
|
|
189
|
+
|
|
190
|
+
A project's `.mcp.json` can start local commands, so it loads only after an
|
|
191
|
+
explicit trust decision for the folder. Pi asks for trust only in folders with Pi
|
|
192
|
+
project resources, such as `.pi/settings.json` or `.agents/skills`, and trusts
|
|
193
|
+
other folders implicitly. The extension doesn't rely on that implicit trust:
|
|
194
|
+
|
|
195
|
+
- **Folders with Pi project resources:** Pi's decision applies, including
|
|
196
|
+
`--approve` and session-only trust.
|
|
197
|
+
- **Other folders:** a saved decision for the folder or a parent folder applies.
|
|
198
|
+
Without one, Pi's `defaultProjectTrust` setting applies: `always` loads project
|
|
199
|
+
servers and `never` ignores them. With the default `ask`, interactive sessions
|
|
200
|
+
ask when a `.mcp.json` exists, and headless sessions ignore the file.
|
|
201
|
+
- **Untrusted folders:** `--no-approve` or a refusal in Pi always ignores project
|
|
202
|
+
servers.
|
|
203
|
+
|
|
204
|
+
Saved answers go to Pi's project trust store, so they also apply to Pi project
|
|
205
|
+
resources. Use Pi's `/trust` command to save or change a decision, then run
|
|
206
|
+
`/mcp reload`; MCP servers don't require a restart. In folders without Pi project
|
|
207
|
+
resources, `--approve` doesn't trust `.mcp.json`; save a decision instead.
|
|
208
|
+
|
|
209
|
+
Only session start and `/mcp reload` ask. Other configuration commands, such as
|
|
210
|
+
`/mcp add` and `/mcp import`, use the current decision. Untrusted project files
|
|
211
|
+
are neither read nor changed.
|
package/docs/commands.md
CHANGED
|
@@ -120,8 +120,9 @@ capabilities you need.
|
|
|
120
120
|
Both commands require an explicit `--scope global` or `--scope project`:
|
|
121
121
|
|
|
122
122
|
- **Global:** `~/.pi/agent/mcp.json`.
|
|
123
|
-
- **Project:** `.mcp.json` in the current
|
|
124
|
-
|
|
123
|
+
- **Project:** `.mcp.json` in the current
|
|
124
|
+
[trusted project](behavior.md#project-trust). Untrusted project files are
|
|
125
|
+
neither read nor changed.
|
|
125
126
|
|
|
126
127
|
Add an HTTP server by URL, or a stdio server after `--`:
|
|
127
128
|
|
|
@@ -194,7 +195,8 @@ automatically; no conversion file is needed:
|
|
|
194
195
|
```
|
|
195
196
|
|
|
196
197
|
The command requires an interactive TUI or RPC session and an explicit
|
|
197
|
-
`--scope global` or `--scope project`. Project scope requires a
|
|
198
|
+
`--scope global` or `--scope project`. Project scope requires a
|
|
199
|
+
[trusted project](behavior.md#project-trust).
|
|
198
200
|
Relative source paths resolve against Pi's current directory; `~/` is supported.
|
|
199
201
|
The path isn't evaluated by a shell, and no application settings are scanned.
|
|
200
202
|
|
package/docs/configuration.md
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
[Back to the README](../README.md)
|
|
4
4
|
|
|
5
5
|
You configure which servers the model can access. Add connections to
|
|
6
|
-
`~/.pi/agent/mcp.json`, or `.mcp.json` in a
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
`~/.pi/agent/mcp.json`, or `.mcp.json` in a
|
|
7
|
+
[trusted project](behavior.md#project-trust). For command-based setup, see
|
|
8
|
+
[Add and remove servers](commands.md#add-and-remove-servers). To reuse an
|
|
9
|
+
existing Claude/Cursor JSON or Codex TOML file, see
|
|
9
10
|
[Import server definitions](commands.md#import-server-definitions).
|
|
10
11
|
|
|
11
12
|
## Files and transports
|
|
@@ -16,8 +17,10 @@ MCP configuration standard. Live configuration must use JSON, not VS Code's
|
|
|
16
17
|
this format. `PI_CODING_AGENT_DIR` overrides the global Pi directory.
|
|
17
18
|
Project definitions replace same-named global definitions in full; fields and
|
|
18
19
|
filters aren't merged. Untrusted project definitions aren't loaded or edited.
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
Project servers need an explicit trust decision even in folders that Pi trusts
|
|
21
|
+
implicitly; see [project trust](behavior.md#project-trust). An explicitly named
|
|
22
|
+
import source is read as data for review; saving into project scope still
|
|
23
|
+
requires project trust.
|
|
21
24
|
|
|
22
25
|
```json
|
|
23
26
|
{
|
|
@@ -44,13 +47,24 @@ scope still requires project trust.
|
|
|
44
47
|
| `type` | Optional `stdio` or `http`. If omitted, inferred from `command` or `url`. A conflicting type is rejected. |
|
|
45
48
|
| `command`, `args` | Executable and arguments for a stdio server. No shell is used. |
|
|
46
49
|
| `cwd` | Working directory for stdio; defaults to Pi's current directory. Relative paths resolve there. |
|
|
47
|
-
| `env` |
|
|
50
|
+
| `env` | Environment variables for stdio, in addition to a minimal inherited set. |
|
|
48
51
|
| `url` | Streamable HTTP endpoint; mutually exclusive with `command`. |
|
|
49
52
|
| `headers` | HTTP request headers, including optional bearer authentication. |
|
|
50
53
|
|
|
51
54
|
Strings in `command`, `args`, `cwd`, `env`, `url`, and `headers` support `${VAR}`
|
|
52
55
|
interpolation. Missing variables prevent that server from connecting.
|
|
53
56
|
|
|
57
|
+
Stdio servers don't inherit Pi's environment. They receive only the MCP SDK's
|
|
58
|
+
default set (`HOME`, `LOGNAME`, `PATH`, `SHELL`, `TERM`, and `USER` on Unix, and
|
|
59
|
+
similar system variables on Windows) plus `env`. Pass other variables a server
|
|
60
|
+
needs explicitly, for example a custom browser location:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
"env": {
|
|
64
|
+
"PLAYWRIGHT_BROWSERS_PATH": "${PLAYWRIGHT_BROWSERS_PATH}"
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
54
68
|
Only stdio and Streamable HTTP are supported. The extension rejects `type: "sse"`
|
|
55
69
|
and unsupported connection fields rather than silently changing their meaning.
|
|
56
70
|
|
|
@@ -128,7 +142,7 @@ server definition:
|
|
|
128
142
|
| `excludeTools` | Denylist applied after `includeTools`. |
|
|
129
143
|
| `timeoutMs` | Request timeout, from 100 to 600000 ms. Defaults: 15 seconds for discovery/HTTP requests, 30 seconds for stdio tool calls. |
|
|
130
144
|
| `startupTimeoutMs` | Optional timeout for SDK connection setup and protocol negotiation, from 100 to 600000 ms. Defaults to `timeoutMs` or 15 seconds. |
|
|
131
|
-
| `toolTimeoutMs` | Optional timeout for tool calls only, from 100 to 600000 ms. Overrides `timeoutMs` for calls without changing metadata or resource deadlines. |
|
|
145
|
+
| `toolTimeoutMs` | Optional timeout for tool calls only, from 100 to 600000 ms. Overrides `timeoutMs` for calls without changing metadata or resource deadlines. Time spent answering [server requests](behavior.md#server-requests-for-input) doesn't count. |
|
|
132
146
|
| `protocol` | `auto` (default) for SDK protocol-version negotiation, or `legacy` for an explicit legacy handshake. |
|
|
133
147
|
|
|
134
148
|
OAuth client IDs, scopes, and callback ports require HTTP without an Authorization
|
package/docs/tool-reference.md
CHANGED
|
@@ -71,6 +71,13 @@ is needed, first use follows three steps: discover, activate, then call the nati
|
|
|
71
71
|
tool. There is no invocation proxy. Previously loaded tools remain available;
|
|
72
72
|
[session behavior](behavior.md#sessions) describes restoration and tool restrictions.
|
|
73
73
|
|
|
74
|
+
A call can pause while the user answers a
|
|
75
|
+
[server request for input](behavior.md#server-requests-for-input); the model
|
|
76
|
+
never sees the dialog or its values unless the server includes them in its
|
|
77
|
+
result. When a server requires a browser step first, the call fails with an
|
|
78
|
+
`elicitation_*` diagnostic and isn't replayed. After `elicitation_completed`,
|
|
79
|
+
the model can call the tool again.
|
|
80
|
+
|
|
74
81
|
## Read resources as context
|
|
75
82
|
|
|
76
83
|
For a request such as “Use the authentication guide to explain this API,” the
|
package/docs/troubleshooting.md
CHANGED
|
@@ -37,6 +37,9 @@ unavailable server isn't an empty catalog.
|
|
|
37
37
|
| `subscriptions_unsupported` | Choose a server with subscription support, or ask the model to read when needed. |
|
|
38
38
|
| `subscription_limit` | Remove a watch before adding another; the limit is 50 per connection. |
|
|
39
39
|
| `catalog_changed` | Ask the model to retry discovery after the server catalog settles. |
|
|
40
|
+
| `elicitation_required` | The server needs you to complete a step on a web page before the tool runs. Use an interactive session, then ask the model to retry. |
|
|
41
|
+
| `elicitation_declined` | You declined or dismissed the server's web page request, so the tool didn't run. Ask the model to retry when you're ready. |
|
|
42
|
+
| `elicitation_completed` | You completed the server's web page step. The tool didn't run yet; the model can call it again. |
|
|
40
43
|
| `oauth_failed` | An unclassified OAuth failure. Check the service's requirements and `/mcp get <server>` for the client type, scopes, and callback URL. Only public/PKCE clients are supported, not clients requiring a secret. |
|
|
41
44
|
| `oauth_client_required` | The server doesn't support dynamic registration. Configure `oauthClientId` for a registered public/PKCE client and register the exact callback URL. Reload, then log in again. |
|
|
42
45
|
| `oauth_registration_rejected` | The server rejected dynamic registration. Check public/native client eligibility and the callback URL, or configure an approved public client ID. |
|
|
@@ -69,6 +72,21 @@ remain visible as content, even when the tool reports an error; they aren't
|
|
|
69
72
|
sanitized transport diagnostics. Tool-call failures aren't replayed automatically;
|
|
70
73
|
verify the outcome before retrying.
|
|
71
74
|
|
|
75
|
+
## Missing project servers
|
|
76
|
+
|
|
77
|
+
A project's `.mcp.json` loads only after an explicit trust decision, even in
|
|
78
|
+
folders that Pi otherwise trusts implicitly. Headless sessions ignore it when no
|
|
79
|
+
decision exists. Run Pi's `/trust` command to save a decision, then run
|
|
80
|
+
`/mcp reload`. See [project trust](behavior.md#project-trust).
|
|
81
|
+
|
|
82
|
+
## Missing server dependencies
|
|
83
|
+
|
|
84
|
+
If a stdio server reports a missing browser, SDK, credential, or configuration
|
|
85
|
+
file that works in your shell, it probably reads an environment variable that
|
|
86
|
+
it doesn't receive. Servers don't inherit Pi's environment; pass the variable
|
|
87
|
+
through `env`, for example `PLAYWRIGHT_BROWSERS_PATH`. See
|
|
88
|
+
[files and transports](configuration.md#files-and-transports).
|
|
89
|
+
|
|
72
90
|
## Large results
|
|
73
91
|
|
|
74
92
|
Text output is limited to 2,000 lines or 50 KiB, including resource reads and
|