pi-mcp-client 0.5.0 → 0.7.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 +8 -4
- package/dist/index.js +1916 -322
- package/docs/authentication.md +87 -15
- package/docs/behavior.md +42 -6
- package/docs/commands.md +124 -2
- package/docs/configuration.md +14 -5
- package/docs/tool-reference.md +14 -4
- package/docs/troubleshooting.md +16 -1
- package/package.json +3 -2
package/docs/authentication.md
CHANGED
|
@@ -12,10 +12,14 @@ For externally managed bearer tokens, use
|
|
|
12
12
|
Add the HTTP server, then log in:
|
|
13
13
|
|
|
14
14
|
```text
|
|
15
|
-
/mcp add --scope global
|
|
16
|
-
/mcp login
|
|
15
|
+
/mcp add --scope global example https://mcp.example.com/mcp
|
|
16
|
+
/mcp login example
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
Replace the example URL with your server's URL. This flow requires dynamic
|
|
20
|
+
client registration or a [pre-registered public client](#use-a-pre-registered-client).
|
|
21
|
+
Adding a URL alone isn't enough for servers such as Slack.
|
|
22
|
+
|
|
19
23
|
Login uses the effective server definition (the trusted project override, if
|
|
20
24
|
present; otherwise the global definition) and starts the SDK's OAuth discovery
|
|
21
25
|
and authorization flow. It doesn't change configuration files. Adding a server
|
|
@@ -51,17 +55,53 @@ Client** and asks you to return to Pi; receiving a callback doesn't yet mean the
|
|
|
51
55
|
token exchange succeeded.
|
|
52
56
|
|
|
53
57
|
OAuth tokens and client registrations are stored in the operating system
|
|
54
|
-
credential store, bound to the server URL,
|
|
55
|
-
authorization-server issuer. There is no plaintext credential fallback. PKCE
|
|
58
|
+
credential store, bound to the configured server name, URL, client ID (if any),
|
|
59
|
+
and authorization-server issuer. There is no plaintext credential fallback. PKCE
|
|
56
60
|
verifiers and callback state stay in memory. Linux requires a working Secret
|
|
57
61
|
Service/keyring session.
|
|
58
62
|
|
|
59
63
|
### Upgrade from earlier versions
|
|
60
64
|
|
|
61
|
-
Credentials now
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
Credentials now include the configured server name in their identity. Earlier
|
|
66
|
+
entries keyed only by URL and client ID aren't migrated or deleted: assigning a
|
|
67
|
+
shared grant to a name could select the wrong account. Run `/mcp login <server>`
|
|
68
|
+
again for each named connection after upgrading. Revoke old grants at the service
|
|
69
|
+
if needed; the new logout command doesn't remove those earlier keyring entries.
|
|
70
|
+
Changing scopes or the callback port doesn't select a different store.
|
|
71
|
+
|
|
72
|
+
## Use multiple accounts
|
|
73
|
+
|
|
74
|
+
Each named server has its own OAuth login, even when multiple definitions use
|
|
75
|
+
the same endpoint and client ID. No profile setting is required:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"mcpServers": {
|
|
80
|
+
"cloudflare-personal": { "url": "https://mcp.cloudflare.com/mcp" },
|
|
81
|
+
"cloudflare-work": { "url": "https://mcp.cloudflare.com/mcp" }
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Log in to each connection separately:
|
|
87
|
+
|
|
88
|
+
```text
|
|
89
|
+
/mcp login cloudflare-personal
|
|
90
|
+
/mcp login cloudflare-work
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Choose the intended account in the browser for each login. Names are local
|
|
94
|
+
labels, not verified account identities, and don't change browser cookies. Use
|
|
95
|
+
`--no-browser` to open the authorization URL in a different browser profile if
|
|
96
|
+
needed. Both connections can remain active; tool names identify their server.
|
|
97
|
+
|
|
98
|
+
Definitions with the same name, URL, and client ID reuse credentials across
|
|
99
|
+
projects. Global and trusted project definitions still resolve to one effective
|
|
100
|
+
definition per name. Use different names when you need separate accounts.
|
|
101
|
+
|
|
102
|
+
Renaming a server or changing its URL or client ID requires a new login. Log out
|
|
103
|
+
before making these changes if you want to remove the old credentials. Removing
|
|
104
|
+
a server definition alone doesn't delete its credentials.
|
|
65
105
|
|
|
66
106
|
## Use a pre-registered client
|
|
67
107
|
|
|
@@ -91,6 +131,35 @@ credentials. After the first successful grant, a pre-registered client is pinned
|
|
|
91
131
|
to its authorization-server issuer. If that issuer changes, verify the server
|
|
92
132
|
configuration before logging out and logging in again to trust the replacement.
|
|
93
133
|
|
|
134
|
+
### Slack setup requirements
|
|
135
|
+
|
|
136
|
+
[Slack doesn't support dynamic client registration](https://docs.slack.dev/ai/slack-mcp-server/).
|
|
137
|
+
Without a registered client, login fails before opening a browser. Configure
|
|
138
|
+
`oauthClientId` with your Slack app's client ID, and ensure the app supports
|
|
139
|
+
public-client PKCE. Apps requiring a client secret aren't supported by this
|
|
140
|
+
extension. Slack also requires an eligible internal or Marketplace-published
|
|
141
|
+
app and any workspace administrator approval required by your workspace.
|
|
142
|
+
|
|
143
|
+
Register the exact callback URL shown by `/mcp get slack` in the app settings
|
|
144
|
+
(default: `http://127.0.0.1:19847/callback`). For example:
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"mcpServers": {
|
|
149
|
+
"slack": {
|
|
150
|
+
"url": "https://mcp.slack.com/mcp",
|
|
151
|
+
"oauthClientId": "${SLACK_OAUTH_CLIENT_ID}"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Set the environment variable before starting Pi. Run `/mcp reload`, then
|
|
158
|
+
`/mcp login slack`. A configured ID appears as **OAuth (pre-registered public
|
|
159
|
+
client)** in `/mcp get slack`; the ID itself stays hidden. A client ID alone
|
|
160
|
+
doesn't guarantee that the app permits this login flow or callback address.
|
|
161
|
+
`--no-browser` doesn't fix registration or app-approval problems.
|
|
162
|
+
|
|
94
163
|
## Set scopes and callback ports
|
|
95
164
|
|
|
96
165
|
Configure scopes and a callback port in the server definition:
|
|
@@ -127,7 +196,7 @@ granted permissions or a per-tool permission policy.
|
|
|
127
196
|
After changing these options, run `/mcp reload`, then `/mcp login example`.
|
|
128
197
|
Changing configuration never starts authorization or revokes existing grants.
|
|
129
198
|
Scopes and callback ports don't select separate credential stores: definitions
|
|
130
|
-
sharing a URL and client ID still share credentials. Explicit login renews a
|
|
199
|
+
sharing a name, URL, and client ID still share credentials. Explicit login renews a
|
|
131
200
|
dynamic registration when its requested options change. `/mcp get example` shows
|
|
132
201
|
the requested scopes and callback address without connecting.
|
|
133
202
|
|
|
@@ -159,17 +228,20 @@ clients requiring a client secret aren't supported yet.
|
|
|
159
228
|
|
|
160
229
|
## Sign out
|
|
161
230
|
|
|
162
|
-
Run `/mcp logout <server>` to remove stored tokens and client
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
231
|
+
Run `/mcp logout <server>` to remove that named server's stored tokens and client
|
|
232
|
+
registrations, close its connection, and deactivate its tools. Other named
|
|
233
|
+
servers keep their local credentials, connections, and active tools, even when
|
|
234
|
+
they use the same URL and client ID. Configuration and enabled state stay
|
|
235
|
+
unchanged. Disabled servers accept logout too. Header and server-managed
|
|
236
|
+
credentials remain untouched.
|
|
167
237
|
|
|
168
238
|
Local removal happens before a bounded attempt to revoke tokens at the original
|
|
169
239
|
authorization server. The result distinguishes accepted revocation, unsupported
|
|
170
240
|
revocation, and unconfirmed revocation. When revocation isn't confirmed, remove the
|
|
171
241
|
grant at the service if needed. Repeating logout is safe. Other running Pi sessions
|
|
172
|
-
may need to reconnect; logout cannot recall
|
|
242
|
+
using the same named credentials may need to reconnect; logout cannot recall
|
|
243
|
+
requests already sent to a server. Remote revocation behavior depends on the
|
|
244
|
+
service and can affect related grants beyond this local connection.
|
|
173
245
|
|
|
174
246
|
Removing a server definition doesn't remove its credentials. Log out before
|
|
175
247
|
[removing the definition](commands.md#add-and-remove-servers) if you want both.
|
package/docs/behavior.md
CHANGED
|
@@ -30,6 +30,27 @@ Resource content and selected metadata, including URIs, become session data and
|
|
|
30
30
|
may be sensitive. [Private spill files](troubleshooting.md#large-results) can also
|
|
31
31
|
contain sensitive data and aren't automatically deleted.
|
|
32
32
|
|
|
33
|
+
## Prompt snapshots
|
|
34
|
+
|
|
35
|
+
Prompt discovery fetches metadata only. You explicitly enter arguments and fetch a
|
|
36
|
+
preview through `/mcp prompt`. Only **Use prompt** adds the
|
|
37
|
+
reviewed snapshot to the conversation and starts a model turn. Cancelling a
|
|
38
|
+
preview adds no message and doesn't write a spill file. Arguments already sent to
|
|
39
|
+
the server can't be recalled.
|
|
40
|
+
|
|
41
|
+
The transcript labels accepted snapshots **mcp prompt** with their server, name,
|
|
42
|
+
and message count. Expand the entry to inspect its contents. Server-provided
|
|
43
|
+
`user` and `assistant` roles remain fields in source-labeled data, not fabricated
|
|
44
|
+
conversation history or system instructions. Terminal control sequences are
|
|
45
|
+
removed before previewing and sending text. Selecting a prompt grants no additional
|
|
46
|
+
tool permissions and never activates tools.
|
|
47
|
+
|
|
48
|
+
Previously accepted snapshots don't change or refetch on catalog notifications,
|
|
49
|
+
resume, or branch navigation. Session replacement, tree navigation, and
|
|
50
|
+
configuration reload invalidate pending selections. The agent must be idle when
|
|
51
|
+
you choose **Use prompt**; another active turn is never silently interrupted.
|
|
52
|
+
Accepted content becomes session data and may contain sensitive information.
|
|
53
|
+
|
|
33
54
|
## Discovery and caching
|
|
34
55
|
|
|
35
56
|
Connections start on demand, never while the extension factory loads. A search
|
|
@@ -45,14 +66,22 @@ They contain tool metadata, not configured credentials. Cached tool-only discove
|
|
|
45
66
|
and activation need no connection; invocation refreshes the live catalog before
|
|
46
67
|
calling the tool.
|
|
47
68
|
|
|
48
|
-
Resource metadata, including template catalogs,
|
|
49
|
-
five minutes, not written to the tool catalog cache. Mixed
|
|
50
|
-
may connect even when tools are cached on disk. Resource-list notifications,
|
|
69
|
+
Resource metadata, including template catalogs, and prompt metadata are held only
|
|
70
|
+
in memory for up to five minutes, not written to the tool catalog cache. Mixed
|
|
71
|
+
discovery therefore may connect even when tools are cached on disk. Resource-list notifications,
|
|
51
72
|
disconnection, and explicit refresh invalidate resource metadata without reading
|
|
52
73
|
content. Tool and resource catalog failures are reported independently; healthy
|
|
53
74
|
candidates remain available. The SDK handles pagination. Resource catalogs are
|
|
54
75
|
limited to 10,000 entries and 4 MiB of descriptor data; oversized catalogs fail
|
|
55
76
|
rather than silently returning a partial list. Reads bypass the SDK content cache.
|
|
77
|
+
|
|
78
|
+
Prompt-list notifications invalidate only prompt metadata; they never fetch prompt
|
|
79
|
+
content or change a pending preview. Disconnection and explicit refresh also
|
|
80
|
+
invalidate prompt metadata. Prompt catalog failures don't suppress healthy
|
|
81
|
+
tool or resource candidates. The SDK handles prompt pagination. Prompt catalogs
|
|
82
|
+
share the 10,000-entry and 4 MiB limits and reject invalid or duplicate descriptors
|
|
83
|
+
rather than presenting a partial catalog.
|
|
84
|
+
|
|
56
85
|
Connections remain open until shutdown or an explicit lifecycle action such as
|
|
57
86
|
reconnection or configuration reload.
|
|
58
87
|
|
|
@@ -98,17 +127,24 @@ Only load configuration you trust. Server executables and secret commands run
|
|
|
98
127
|
with your user permissions; trusted project configuration can replace global
|
|
99
128
|
connections and settings.
|
|
100
129
|
|
|
101
|
-
|
|
130
|
+
Configuration imports require an explicit file, scope, selection, and final
|
|
131
|
+
confirmation. Import previews hide connection values; review the source file
|
|
132
|
+
before trusting it. Inline credentials are copied only with the selected whole
|
|
133
|
+
server definitions. Importing doesn't run or authenticate servers, but enabled
|
|
134
|
+
imports can execute programs or send credentials when used afterward.
|
|
135
|
+
|
|
136
|
+
Server metadata, resource content, and prompt content are untrusted data. Discovery never
|
|
102
137
|
activates tools. Explicit activation exposes schemas but doesn't approve tool
|
|
103
138
|
side effects or provide per-call confirmation. Use tool filters and Pi permission
|
|
104
139
|
extensions for additional controls. Cancelling a call doesn't guarantee that the
|
|
105
140
|
server rolled back its effects. The extension doesn't retry failed tool
|
|
106
141
|
invocations; verify an interrupted operation's outcome before trying again.
|
|
107
142
|
|
|
108
|
-
`includeTools` and `excludeTools` apply only to tools, not resources. Keeping
|
|
143
|
+
`includeTools` and `excludeTools` apply only to tools, not resources or prompts. Keeping
|
|
109
144
|
`mcp_tools` available permits resource reads from enabled servers, subject to the
|
|
110
145
|
server's authorization. `kind: "tools"` filters one search; it isn't an access
|
|
111
146
|
restriction. Disable a server to prevent all access, or exclude `mcp_tools` through
|
|
112
147
|
Pi's tool restrictions to prevent discovery and resource operations. Already active
|
|
113
148
|
native tools have their own tool restrictions. Per-resource permission policies
|
|
114
|
-
aren't implemented.
|
|
149
|
+
aren't implemented. Prompt selection uses explicit user commands, not the
|
|
150
|
+
model-facing tool allowlist; disable the server to prevent prompt access.
|
package/docs/commands.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[Back to the README](../README.md)
|
|
4
4
|
|
|
5
5
|
These are commands **you run in Pi**, not tools the assistant calls. Use them to
|
|
6
|
-
manage servers, inspect capabilities, and watch resource changes. The assistant's
|
|
6
|
+
manage servers, inspect capabilities, use prompts, and watch resource changes. The assistant's
|
|
7
7
|
separate interface is documented in the [tool reference](tool-reference.md).
|
|
8
8
|
|
|
9
9
|
## Command reference
|
|
@@ -13,15 +13,17 @@ separate interface is documented in the [tool reference](tool-reference.md).
|
|
|
13
13
|
| `/mcp`, `/mcp list`, `/mcp status` | Show a server status matrix with catalog and loaded-tool counts. |
|
|
14
14
|
| `/mcp add --scope <scope> [options] <server> <url>` | Save an HTTP server without connecting. For stdio, use `<server> -- <command> [args...]`. |
|
|
15
15
|
| `/mcp remove --scope <scope> <server>` | Remove a definition from the selected scope, retaining credentials. |
|
|
16
|
+
| `/mcp import --scope <scope> <path>` | Preview and select servers from Claude/Cursor JSON or Codex TOML, then confirm a scoped import. |
|
|
16
17
|
| `/mcp get <server>` | Inspect status and configuration, including disabled servers. Connection values are hidden. |
|
|
17
18
|
| `/mcp tools <server>` | Browse the server's tools and inspect descriptions without activating tools. |
|
|
19
|
+
| `/mcp prompt <server> [name] [argument=value ...]` | Browse prompts or open a named prompt with prefilled arguments, then fetch and review a preview. |
|
|
18
20
|
| `/mcp reload` | Apply configuration changes without restarting Pi. |
|
|
19
21
|
| `/mcp enable <server>` | Enable a server in its effective configuration file. |
|
|
20
22
|
| `/mcp disable <server>` | Disable a server, close its connection, and deactivate its tools. |
|
|
21
23
|
| `/mcp login <server> [--no-browser]` | Authenticate an HTTP server without changing its configuration; optionally paste the callback URL in an interactive dialog. |
|
|
22
24
|
| `/mcp logout <server>` | Remove local OAuth credentials and attempt remote revocation, including for disabled servers. |
|
|
23
25
|
| `/mcp reconnect <server>` | Replace a connection and refresh its catalog. |
|
|
24
|
-
| `/mcp refresh <server>` | Refresh tool and
|
|
26
|
+
| `/mcp refresh <server>` | Refresh tool, resource, and prompt metadata without fetching content or loading additional tools. |
|
|
25
27
|
| `/mcp subscribe <server> <uri>` | Watch changes to one exact resource URI without fetching content. |
|
|
26
28
|
| `/mcp unsubscribe <server> <uri>` | Stop watching one resource. |
|
|
27
29
|
| `/mcp subscriptions` | List active resource watches and their change markers. |
|
|
@@ -59,6 +61,40 @@ change, ask the assistant to activate the exact tool again. See
|
|
|
59
61
|
aren't retried automatically; verify whether an interrupted operation completed
|
|
60
62
|
before trying again.
|
|
61
63
|
|
|
64
|
+
## Use server prompts
|
|
65
|
+
|
|
66
|
+
Prompts are server-maintained task instructions that **you** choose to use. For a
|
|
67
|
+
server that provides an `explain` prompt, browse or open it directly:
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
/mcp prompt docs
|
|
71
|
+
/mcp prompt docs explain topic="OAuth flows"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
1. Select a prompt. Browsing fetches metadata only and doesn't add anything to the
|
|
75
|
+
conversation.
|
|
76
|
+
2. Select an argument to edit its string value. Required arguments must be supplied;
|
|
77
|
+
optional arguments can remain omitted. An empty string is distinct from an
|
|
78
|
+
omitted value. Inline `argument=value` pairs prefill the editor. Quoting follows
|
|
79
|
+
the configuration commands' rules, without shell or environment expansion.
|
|
80
|
+
3. Choose **Fetch preview** to send the arguments to the selected MCP server.
|
|
81
|
+
Your conversation and local files aren't automatically shared. Argument values
|
|
82
|
+
are limited to 4,096 characters each and 64 KiB in total.
|
|
83
|
+
4. Review the source-labeled messages using **Next page** and **Previous page**.
|
|
84
|
+
Choose **Back** to change arguments, or **Cancel** to discard the preview.
|
|
85
|
+
5. Choose **Use prompt** to send exactly the reviewed snapshot to the model and
|
|
86
|
+
start a turn. This saves the content in the session. No second fetch occurs.
|
|
87
|
+
|
|
88
|
+
Text and embedded text resources are supported. Images, audio, binary resources,
|
|
89
|
+
and other unsupported blocks are identified in the preview and prevent use of the
|
|
90
|
+
whole prompt; they aren't silently omitted. Prompts exceeding 2,000 lines or
|
|
91
|
+
50 KiB are refused, not truncated or written to spill files. Links aren't followed.
|
|
92
|
+
|
|
93
|
+
These commands require an interactive TUI or RPC session. In the TUI, press Escape
|
|
94
|
+
to cancel a pending fetch. Cancelling doesn't undo arguments already sent to the
|
|
95
|
+
server. Using a prompt doesn't activate tools or approve their side effects. See
|
|
96
|
+
[prompt snapshots](behavior.md#prompt-snapshots) for trust and lifecycle behavior.
|
|
97
|
+
|
|
62
98
|
## Enable and disable servers
|
|
63
99
|
|
|
64
100
|
Use `/mcp disable <server>` or `/mcp enable <server>` to change the `disabled`
|
|
@@ -142,6 +178,92 @@ atomically. New files are private; existing file permissions are preserved. If
|
|
|
142
178
|
global and project configuration point to the same file, scoped edits are refused
|
|
143
179
|
until you separate them. Empty configuration files are retained rather than deleted.
|
|
144
180
|
|
|
181
|
+
## Import server definitions
|
|
182
|
+
|
|
183
|
+
Import directly from an explicitly named local file. JSON and TOML are detected
|
|
184
|
+
automatically; no conversion file is needed:
|
|
185
|
+
|
|
186
|
+
```text
|
|
187
|
+
/mcp import --scope global ~/.codex/config.toml
|
|
188
|
+
/mcp import --scope global ~/.claude.json
|
|
189
|
+
/mcp import --scope project "/path with spaces/mcp.json"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
The command requires an interactive TUI or RPC session and an explicit
|
|
193
|
+
`--scope global` or `--scope project`. Project scope requires a trusted project.
|
|
194
|
+
Relative source paths resolve against Pi's current directory; `~/` is supported.
|
|
195
|
+
The path isn't evaluated by a shell, and no application settings are scanned.
|
|
196
|
+
|
|
197
|
+
1. If the source contains other top-level settings, confirm that only MCP server
|
|
198
|
+
definitions should be considered. Model, permission, and credential-store
|
|
199
|
+
settings aren't imported.
|
|
200
|
+
2. For a Claude file containing `projects.<path>.mcpServers`, choose a source
|
|
201
|
+
group or **All groups**. Global and project definitions remain separate during
|
|
202
|
+
review. A source project doesn't select or authorize the destination scope.
|
|
203
|
+
3. Review each server's name, transport, enabled state, and any validation or
|
|
204
|
+
unsupported-field problems. Commands, arguments, URLs, headers, and environment
|
|
205
|
+
values stay hidden. Review the original file before importing connections you
|
|
206
|
+
don't already trust. Unsupported entries can only be skipped; their fields
|
|
207
|
+
aren't silently dropped.
|
|
208
|
+
4. Choose **Skip**, add the definition, or **Choose a different name**. Name
|
|
209
|
+
conflicts require an explicit replacement or override choice. A replacement
|
|
210
|
+
replaces the entire definition, including headers and environment variables;
|
|
211
|
+
credentials and other fields aren't merged. A global import shadowed by a
|
|
212
|
+
project definition is labeled as such and doesn't change the effective server.
|
|
213
|
+
5. Review the selected destination names and actions, then confirm the import.
|
|
214
|
+
The confirmation warns that inline credentials are copied with the selected
|
|
215
|
+
definitions. Existing Pi OAuth credentials are retained, but no external
|
|
216
|
+
credential store is read or migrated.
|
|
217
|
+
|
|
218
|
+
Nothing is saved until the final confirmation. Cancellation, a session or trust
|
|
219
|
+
change, or a changed destination configuration prevents saving the preview. All
|
|
220
|
+
selected definitions are validated and written together using one atomic file
|
|
221
|
+
replacement, then applied through the normal configuration reconciliation.
|
|
222
|
+
The source snapshot isn't reread after confirmation, and the source and
|
|
223
|
+
destination cannot be the same file. No server starts, secret command runs,
|
|
224
|
+
login opens, or tool activates during import. Enabled connections become
|
|
225
|
+
available on demand afterward; imported disabled servers stay disabled.
|
|
226
|
+
|
|
227
|
+
### Supported formats
|
|
228
|
+
|
|
229
|
+
Files must be UTF-8 and are limited to 1 MiB and 100 servers across all source
|
|
230
|
+
groups. Only stdio and Streamable HTTP are supported. JSON comments, JSON trailing
|
|
231
|
+
commas, SSE, VS Code, and MCPorter formats aren't supported. TOML comments,
|
|
232
|
+
multiline strings, quoted keys, and trailing commas follow TOML syntax.
|
|
233
|
+
|
|
234
|
+
**Claude/Cursor JSON:** Read a top-level `mcpServers` object and, for Claude,
|
|
235
|
+
`projects.<path>.mcpServers` groups. Supported server fields are `type`, `command`,
|
|
236
|
+
`args`, `cwd`, `env`, `url`, `headers`, `disabled`, and `description`.
|
|
237
|
+
`${VAR}` references are preserved and must resolve in Pi before import. Default
|
|
238
|
+
expressions and client-specific variables such as `${env:TOKEN}` or
|
|
239
|
+
`${workspaceFolder}` are refused rather than translated. In environment and
|
|
240
|
+
header values, bare `$VAR` and leading `!` remain literal: the importer escapes
|
|
241
|
+
them so they don't become Pi variable expansions or secret commands.
|
|
242
|
+
|
|
243
|
+
**Codex TOML:** Read the `mcp_servers` table, with these mappings:
|
|
244
|
+
|
|
245
|
+
| Codex setting | Imported setting |
|
|
246
|
+
| --- | --- |
|
|
247
|
+
| `command`, `args`, `cwd`, `url` | Copied without resolving values. Literal `${...}` in these fields is refused because Pi would interpolate it. |
|
|
248
|
+
| `enabled` | Inverted to `disabled`. |
|
|
249
|
+
| `env`, `http_headers` | Literal environment/header values, including literal `${VAR}`, `$VAR`, and `!`. |
|
|
250
|
+
| `env_vars`, `env_http_headers`, `bearer_token_env_var` | Unresolved environment references, not copies of their current values. Overlapping entries are refused. |
|
|
251
|
+
| `startup_timeout_sec` or `startup_timeout_ms` | `startupTimeoutMs`, defaulting to Codex's 10 seconds. Both source options together are refused. |
|
|
252
|
+
| `tool_timeout_sec` | `toolTimeoutMs`, defaulting to Codex's 60 seconds. |
|
|
253
|
+
| `enabled_tools`, `disabled_tools` | `includeTools`, `excludeTools`. Names containing `*` are refused rather than converted into wildcard patterns. |
|
|
254
|
+
| `scopes` | `oauthScopes`. |
|
|
255
|
+
|
|
256
|
+
Timeouts must fit Pi's 100–600000 ms range. Startup and tool deadlines stay
|
|
257
|
+
separate; they don't replace the timeout for metadata or resource requests.
|
|
258
|
+
Only local execution is supported. `required = true`, remote environment
|
|
259
|
+
placement, remote `env_vars` entries, and per-server/tool approval policies are
|
|
260
|
+
refused rather than dropped. `required = false` and
|
|
261
|
+
`experimental_environment = "local"` are accepted.
|
|
262
|
+
|
|
263
|
+
For either format, relative executable, argument, and working-directory paths
|
|
264
|
+
retain Pi's path semantics, not the source application's or import file's
|
|
265
|
+
directory; verify them before importing.
|
|
266
|
+
|
|
145
267
|
## Watch resource changes
|
|
146
268
|
|
|
147
269
|
Subscriptions are explicit user commands, not model-facing tool operations:
|
package/docs/configuration.md
CHANGED
|
@@ -4,15 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
You configure which servers the assistant can access. Add connections to
|
|
6
6
|
`~/.pi/agent/mcp.json`, or `.mcp.json` in a trusted project. For command-based
|
|
7
|
-
setup, see [Add and remove servers](commands.md#add-and-remove-servers).
|
|
7
|
+
setup, see [Add and remove servers](commands.md#add-and-remove-servers). To reuse
|
|
8
|
+
an existing Claude/Cursor JSON or Codex TOML file, see
|
|
9
|
+
[Import server definitions](commands.md#import-server-definitions).
|
|
8
10
|
|
|
9
11
|
## Files and transports
|
|
10
12
|
|
|
11
13
|
The files use the common Claude/Cursor-style `mcpServers` format, not a universal
|
|
12
|
-
MCP configuration standard.
|
|
13
|
-
|
|
14
|
+
MCP configuration standard. Live configuration must use JSON, not VS Code's
|
|
15
|
+
`servers` format or Codex TOML. The import command can translate Codex TOML into
|
|
16
|
+
this format. `PI_CODING_AGENT_DIR` overrides the global Pi directory.
|
|
14
17
|
Project definitions replace same-named global definitions in full; fields and
|
|
15
|
-
filters aren't merged. Untrusted project
|
|
18
|
+
filters aren't merged. Untrusted project definitions aren't loaded or edited.
|
|
19
|
+
An explicitly named import source is read as data for review; saving into project
|
|
20
|
+
scope still requires project trust.
|
|
16
21
|
|
|
17
22
|
```json
|
|
18
23
|
{
|
|
@@ -122,6 +127,8 @@ server definition:
|
|
|
122
127
|
| `includeTools` | Optional allowlist of original MCP tool names; `*` matches any sequence. An empty list exposes no tools. |
|
|
123
128
|
| `excludeTools` | Denylist applied after `includeTools`. |
|
|
124
129
|
| `timeoutMs` | Request timeout, from 100 to 600000 ms. Defaults: 15 seconds for discovery/HTTP requests, 30 seconds for stdio tool calls. |
|
|
130
|
+
| `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. |
|
|
125
132
|
| `protocol` | `auto` (default) for SDK protocol-version negotiation, or `legacy` for an explicit legacy handshake. |
|
|
126
133
|
|
|
127
134
|
OAuth client IDs, scopes, and callback ports require HTTP without an Authorization
|
|
@@ -130,7 +137,9 @@ existing definitions. See [authentication](authentication.md).
|
|
|
130
137
|
|
|
131
138
|
Every definition must include a `url` or `command`, even when `disabled` is true.
|
|
132
139
|
These options are specific to Pi MCP Client, not standardized MCP connection
|
|
133
|
-
fields. Other clients may reject them when you copy a definition.
|
|
140
|
+
fields. Other clients may reject them when you copy a definition. The import command
|
|
141
|
+
accepts only its documented subset of server fields and refuses unsupported
|
|
142
|
+
entries rather than dropping options.
|
|
134
143
|
|
|
135
144
|
Tool filters don't restrict resource reads. See
|
|
136
145
|
[trust and permissions](behavior.md#trust-and-permissions) for access boundaries
|
package/docs/tool-reference.md
CHANGED
|
@@ -11,7 +11,7 @@ The `mcp_tools` tool supports four mutually exclusive operations:
|
|
|
11
11
|
|
|
12
12
|
| Operation | What the assistant can do | What it doesn't do |
|
|
13
13
|
| --- | --- | --- |
|
|
14
|
-
| `query` | Discover tool and
|
|
14
|
+
| `query` | Discover tool, resource, and prompt metadata. | Read content or activate tools. |
|
|
15
15
|
| `activate` | Load full schemas for exact tool identifiers. | Invoke tools. |
|
|
16
16
|
| `read` | Fetch one resource as conversation context. | Activate tools or follow links automatically. |
|
|
17
17
|
| `complete` | Request server suggestions for a template variable. | Read resources, activate tools, or select a value. |
|
|
@@ -30,8 +30,8 @@ mcp_tools({ query: "database schema", server: "warehouse", limit: 5 })
|
|
|
30
30
|
mcp_tools({ query: "list teams", server: "linear", kind: "tools" })
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
`kind` defaults to `all`, or accepts `tools` and `
|
|
34
|
-
to five candidates by default, or up to 50 with `limit`, across
|
|
33
|
+
`kind` defaults to `all`, or accepts `tools`, `resources`, and `prompts`. Discovery
|
|
34
|
+
returns up to five candidates by default, or up to 50 with `limit`, across all kinds.
|
|
35
35
|
|
|
36
36
|
Tool candidates show an exact activation identifier, a short description,
|
|
37
37
|
required parameter names only, and `[loaded]` if already active. Resource
|
|
@@ -39,9 +39,19 @@ candidates show the owning server, title or name, exact URI, description, and
|
|
|
39
39
|
content type when supplied. Concrete resources and tools include exact next-call
|
|
40
40
|
arguments; templates include a read-call shape and variable names.
|
|
41
41
|
|
|
42
|
+
Prompt candidates show the owning server, name, description, argument metadata,
|
|
43
|
+
and a user-only command such as `/mcp prompt docs explain`. The assistant can
|
|
44
|
+
recommend this command but can't retrieve or run prompts through `mcp_tools`.
|
|
45
|
+
Only you can [select, preview, and use a prompt](commands.md#use-server-prompts).
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
// Discover prompt metadata without fetching the prompt content.
|
|
49
|
+
mcp_tools({ query: "explain authentication", server: "docs", kind: "prompts" })
|
|
50
|
+
```
|
|
51
|
+
|
|
42
52
|
Search uses local BM25-based ranking of metadata, with names and resource titles
|
|
43
53
|
weighted more strongly than descriptions, and support for prefix matching.
|
|
44
|
-
Resource content isn't fetched or searched. See
|
|
54
|
+
Resource and prompt content isn't fetched or searched. See
|
|
45
55
|
[discovery and caching](behavior.md#discovery-and-caching) for connection behavior.
|
|
46
56
|
|
|
47
57
|
## Activate and call tools
|
package/docs/troubleshooting.md
CHANGED
|
@@ -37,13 +37,28 @@ unavailable server isn't an empty catalog.
|
|
|
37
37
|
| `subscriptions_unsupported` | Choose a server with subscription support, or ask the assistant 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 assistant to retry discovery after the server catalog settles. |
|
|
40
|
-
| `oauth_failed` |
|
|
40
|
+
| `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
|
+
| `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
|
+
| `oauth_registration_rejected` | The server rejected dynamic registration. Check public/native client eligibility and the callback URL, or configure an approved public client ID. |
|
|
43
|
+
| `oauth_client_rejected` | Check the client ID, app approval, and public-client authentication (token endpoint method `none`). A rejected client doesn't necessarily mean a client secret is required. |
|
|
44
|
+
| `oauth_pkce_unsupported` | The authorization server must support S256 PKCE. Login without PKCE isn't supported. |
|
|
45
|
+
| `oauth_scope_rejected` | Check `oauthScopes` against the service's allowed scopes and app permissions. Reload after changes, then log in again. |
|
|
46
|
+
| `oauth_grant_rejected` | Log in again for a fresh code. If it still fails, check the client and exact callback URL. |
|
|
47
|
+
| `oauth_redirect_rejected` | Register the exact callback host, port, and `/callback` path shown by `/mcp get <server>`. Manual login uses the same callback URL. |
|
|
48
|
+
| `oauth_endpoint_insecure` | The token endpoint must use HTTPS unless it is on loopback. Don't disable TLS verification. |
|
|
41
49
|
| `oauth_issuer_changed` | Verify the authorization-server change before logging out and logging in again. |
|
|
42
50
|
| `callback_unavailable` | Another process using the configured loopback port (default 19847). Change `oauthCallbackPort` or use `/mcp login <server> --no-browser`. |
|
|
43
51
|
| `busy` | Wait for discovery to finish before reconnecting. |
|
|
44
52
|
| `cancelled` | Retry when ready; verify any interrupted tool operation first. |
|
|
45
53
|
| `operation_failed` | An unclassified failure; inspect server status and configuration. |
|
|
46
54
|
|
|
55
|
+
If login fails before opening a browser, check client registration first.
|
|
56
|
+
For Slack, see [Slack setup requirements](authentication.md#slack-setup-requirements).
|
|
57
|
+
Use `--no-browser` for browser launch or callback reachability problems, not
|
|
58
|
+
registration failures. Diagnostics use known failure categories rather than
|
|
59
|
+
printing server error descriptions, which can contain credentials or private URLs.
|
|
60
|
+
An unknown error remains `oauth_failed`; it doesn't prove a callback problem.
|
|
61
|
+
|
|
47
62
|
For setup details, see [Configuration](configuration.md),
|
|
48
63
|
[Authentication](authentication.md), and [Commands](commands.md).
|
|
49
64
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-mcp-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "MCP tools for Pi, discovered on demand and called natively through the official SDK.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@modelcontextprotocol/client": "2.0.0",
|
|
43
43
|
"@napi-rs/keyring": "^1.3.0",
|
|
44
|
-
"minisearch": "^7.2.0"
|
|
44
|
+
"minisearch": "^7.2.0",
|
|
45
|
+
"smol-toml": "^1.8.0"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@earendil-works/pi-ai": "^0.85.1",
|