@agimon-ai/po-mcp 0.0.0-alpha.13 → 0.0.0-alpha.130

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 (83) hide show
  1. package/LICENSE +149 -21
  2. package/README.md +226 -16
  3. package/dist/apiContracts.cjs +160 -57
  4. package/dist/apiContracts.cjs.map +1 -1
  5. package/dist/apiContracts.d.mts.map +1 -1
  6. package/dist/apiContracts.mjs +160 -57
  7. package/dist/apiContracts.mjs.map +1 -1
  8. package/dist/directTools-CMtiNOwX.cjs +558 -0
  9. package/dist/directTools-CMtiNOwX.cjs.map +1 -0
  10. package/dist/directTools-Dez3RjUJ.mjs +507 -0
  11. package/dist/directTools-Dez3RjUJ.mjs.map +1 -0
  12. package/dist/extensions/mcp.cjs +29 -13
  13. package/dist/extensions/mcp.cjs.map +1 -1
  14. package/dist/extensions/mcp.mjs +29 -13
  15. package/dist/extensions/mcp.mjs.map +1 -1
  16. package/dist/extensions/native.mjs +1542 -0
  17. package/dist/extensions/native.mjs.map +1 -0
  18. package/dist/extensions/server.cjs +3995 -2433
  19. package/dist/extensions/server.cjs.map +1 -1
  20. package/dist/extensions/server.d.mts +2 -2
  21. package/dist/extensions/server.d.mts.map +1 -1
  22. package/dist/extensions/server.mjs +4176 -2613
  23. package/dist/extensions/server.mjs.map +1 -1
  24. package/dist/extensions/web.mjs +2081 -1108
  25. package/dist/extensions/web.mjs.map +1 -1
  26. package/dist/index-BJkh7lQ0.d.mts +49 -0
  27. package/dist/index-BJkh7lQ0.d.mts.map +1 -0
  28. package/dist/index-DAVKnZtv.d.mts +11 -0
  29. package/dist/index-DsAYcBeX.d.mts +51 -0
  30. package/dist/index-DsAYcBeX.d.mts.map +1 -0
  31. package/dist/index.cjs +22 -9
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.mts +18 -43
  34. package/dist/index.d.mts.map +1 -1
  35. package/dist/index.mjs +10 -1
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/localServers.cjs +4 -0
  38. package/dist/localServers.d.mts +2 -0
  39. package/dist/localServers.mjs +1 -0
  40. package/dist/mcpCatalog-DlC5mMkl.cjs +531 -0
  41. package/dist/mcpCatalog-DlC5mMkl.cjs.map +1 -0
  42. package/dist/mcpCatalog-vwwMhex1.mjs +433 -0
  43. package/dist/mcpCatalog-vwwMhex1.mjs.map +1 -0
  44. package/dist/{mcpConfig-lHsIQ2fZ.d.mts → mcpConfig-CShx27dN.d.mts} +13 -3
  45. package/dist/{mcpConfig-lHsIQ2fZ.d.mts.map → mcpConfig-CShx27dN.d.mts.map} +1 -1
  46. package/dist/mcpServerConfig-CXaIllri.mjs +1282 -0
  47. package/dist/mcpServerConfig-CXaIllri.mjs.map +1 -0
  48. package/dist/mcpServerConfig-DNTdLi70.cjs +1581 -0
  49. package/dist/mcpServerConfig-DNTdLi70.cjs.map +1 -0
  50. package/dist/projection-BH-vn29y.mjs +56 -0
  51. package/dist/projection-BH-vn29y.mjs.map +1 -0
  52. package/dist/projection-DBpXsw0W.cjs +64 -0
  53. package/dist/projection-DBpXsw0W.cjs.map +1 -0
  54. package/dist/projection.cjs +1 -1
  55. package/dist/projection.d.mts +8 -2
  56. package/dist/projection.d.mts.map +1 -1
  57. package/dist/projection.mjs +1 -1
  58. package/dist/remoteServers.cjs +96 -0
  59. package/dist/remoteServers.cjs.map +1 -0
  60. package/dist/remoteServers.d.mts +149 -0
  61. package/dist/remoteServers.d.mts.map +1 -0
  62. package/dist/remoteServers.mjs +88 -0
  63. package/dist/remoteServers.mjs.map +1 -0
  64. package/dist/sessionServers-D0OaX9tn.mjs +328 -0
  65. package/dist/sessionServers-D0OaX9tn.mjs.map +1 -0
  66. package/dist/sessionServers-D5tX54WC.cjs +357 -0
  67. package/dist/sessionServers-D5tX54WC.cjs.map +1 -0
  68. package/dist/sessionServers.cjs +4 -0
  69. package/dist/sessionServers.d.mts +2 -0
  70. package/dist/sessionServers.mjs +1 -0
  71. package/llms.txt +2 -1
  72. package/package.json +79 -18
  73. package/src/prompts/codemode-how-to-mcp/SKILL.md +56 -0
  74. package/src/prompts/help-how-to-mcp/SKILL.md +120 -0
  75. package/dist/mcpCatalog-BHoE4gfz.cjs +0 -900
  76. package/dist/mcpCatalog-BHoE4gfz.cjs.map +0 -1
  77. package/dist/mcpCatalog-Bp-mLZM1.mjs +0 -806
  78. package/dist/mcpCatalog-Bp-mLZM1.mjs.map +0 -1
  79. package/dist/projection-gyAA2jRB.mjs +0 -43
  80. package/dist/projection-gyAA2jRB.mjs.map +0 -1
  81. package/dist/projection-w3XxXmVi.cjs +0 -51
  82. package/dist/projection-w3XxXmVi.cjs.map +0 -1
  83. package/src/prompts/po-use-mcp/SKILL.md +0 -79
package/LICENSE CHANGED
@@ -1,21 +1,149 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Vuong Ngo
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.
1
+ License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
2
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
3
+
4
+ Parameters
5
+
6
+ Licensor: Agimon Pty Ltd
7
+ Licensed Work: Po, the software in the Po source repository and the
8
+ packages released from it, in each version released by
9
+ the Licensor.
10
+ The Licensed Work is (c) 2026 Agimon Pty Ltd.
11
+ Material identified as third-party in the "Third-party
12
+ components" section at the end of this file or in a
13
+ NOTICE file, and any package or directory whose own
14
+ license file grants a different license, is not part of
15
+ the Licensed Work and remains under its own license.
16
+ Additional Use Grant: You may make production use of the Licensed Work if
17
+ your use is Eligible Use. "Eligible Use" is production use that falls
18
+ within at least one of the following:
19
+
20
+ (a) Personal Use. Use by an individual for their own personal purposes,
21
+ and not on behalf of, or for the benefit of, an employer, client, or
22
+ other Organization. Use by an individual in the course of employment
23
+ or engagement by an Organization is use by that Organization.
24
+
25
+ (b) Small Organization Use. Use by or on behalf of an Organization whose
26
+ Annual Revenue is less than USD 1,000,000.
27
+
28
+ (c) Non-profit, Education and Research Use. Use, regardless of Annual
29
+ Revenue, by (i) an Organization registered or recognized as a
30
+ non-profit or charitable organization under the laws of its
31
+ jurisdiction, for its non-profit purposes; (ii) an accredited school,
32
+ college, or university, for teaching, learning, or academic research;
33
+ or (iii) a publicly funded research institution, for its research.
34
+
35
+ (d) Service Provider Use. Use by a consultant, contractor, agency, or other
36
+ service provider, regardless of its own Annual Revenue, solely to
37
+ build, deploy, host, operate, or support the Licensed Work for a client
38
+ whose own use would be Eligible Use under (a), (b), or (c). A service
39
+ provider's use for its own purposes is Eligible Use only if the service
40
+ provider itself qualifies under (b) or (c).
41
+
42
+
43
+ Hosted services. Offering the Licensed Work to third parties as a hosted
44
+ or managed service whose primary value is the Licensed Work is Eligible
45
+ Use only if each such third party's own use would be Eligible Use.
46
+
47
+ Definitions. "Organization" means any company, partnership, sole
48
+ proprietorship, trust, association, government body, or other entity, and
49
+ includes an individual acting in a business or professional capacity.
50
+ "Affiliate" means any entity that directly or indirectly controls, is
51
+ controlled by, or is under common control with an Organization, where
52
+ "control" means ownership of more than 50% of the voting interests of an
53
+ entity or the power to direct its management and policies by contract or
54
+ otherwise. "Annual Revenue" means the total gross revenue of an
55
+ Organization and all of its Affiliates combined, from all sources and
56
+ whether or not related to the Licensed Work, for its most recently
57
+ completed fiscal year, or, if it has not completed a fiscal year, for the
58
+ twelve months before the use (or since its formation, if shorter),
59
+ converted into US dollars at the average exchange rate for that period.
60
+ Proceeds of equity or debt financing are not revenue.
61
+
62
+ Threshold. If an Organization stops qualifying under (b), its existing
63
+ production use remains Eligible Use for 90 days after it stops
64
+ qualifying, after which it must obtain a commercial license or stop
65
+ production use. Use that was Eligible Use when it occurred never requires
66
+ a commercial license after the fact.
67
+ Change Date: Four years from the date a version of the Licensed Work
68
+ is first publicly released by the Licensor.
69
+ Change License: Apache License, Version 2.0
70
+
71
+ For information about alternative licensing arrangements for the Licensed
72
+ Work, please visit: https://agimon.ai/licensing
73
+
74
+ Notice
75
+
76
+ The Business Source License (this document, or the "License") is not an Open
77
+ Source license. However, the Licensed Work will eventually be made available
78
+ under an Open Source License, as stated in this License.
79
+
80
+ -----------------------------------------------------------------------------
81
+
82
+ Business Source License 1.1
83
+
84
+ Terms
85
+
86
+ The Licensor hereby grants you the right to copy, modify, create derivative
87
+ works, redistribute, and make non-production use of the Licensed Work. The
88
+ Licensor may make an Additional Use Grant, above, permitting limited
89
+ production use.
90
+
91
+ Effective on the Change Date, or the fourth anniversary of the first publicly
92
+ available distribution of a specific version of the Licensed Work under this
93
+ License, whichever comes first, the Licensor hereby grants you rights under
94
+ the terms of the Change License, and the rights granted in the paragraph
95
+ above terminate.
96
+
97
+ If your use of the Licensed Work does not comply with the requirements
98
+ currently in effect as described in this License, you must purchase a
99
+ commercial license from the Licensor, its affiliated entities, or authorized
100
+ resellers, or you must refrain from using the Licensed Work.
101
+
102
+ All copies of the original and modified Licensed Work, and derivative works
103
+ of the Licensed Work, are subject to this License. This License applies
104
+ separately for each version of the Licensed Work and the Change Date may vary
105
+ for each version of the Licensed Work released by Licensor.
106
+
107
+ You must conspicuously display this License on each original or modified copy
108
+ of the Licensed Work. If you receive the Licensed Work in original or
109
+ modified form from a third party, the terms and conditions set forth in this
110
+ License apply to your use of that work.
111
+
112
+ Any use of the Licensed Work in violation of this License will automatically
113
+ terminate your rights under this License for the current and all other
114
+ versions of the Licensed Work.
115
+
116
+ This License does not grant you any right in any trademark or logo of
117
+ Licensor or its affiliates (provided that you may use a trademark or logo of
118
+ Licensor as expressly required by this License).
119
+
120
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
121
+ AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
122
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
123
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
124
+ TITLE.
125
+
126
+ MariaDB hereby grants you permission to use this License’s text to license
127
+ your works, and to refer to it using the trademark “Business Source License”,
128
+ as long as you comply with the Covenants of Licensor below.
129
+
130
+ Covenants of Licensor
131
+
132
+ In consideration of the right to use this License’s text and the “Business
133
+ Source License” name and trademark, Licensor covenants to MariaDB, and to all
134
+ other recipients of the licensed work to be provided by Licensor:
135
+
136
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
137
+ or a license that is compatible with GPL Version 2.0 or a later version,
138
+ where “compatible” means that software provided under the Change License can
139
+ be included in a program with software provided under GPL Version 2.0 or a
140
+ later version. Licensor may specify additional Change Licenses without
141
+ limitation.
142
+
143
+ 2. To either: (a) specify an additional grant of rights to use that does not
144
+ impose any additional restriction on the right granted in this License, as
145
+ the Additional Use Grant; or (b) insert the text “None”.
146
+
147
+ 3. To specify a Change Date.
148
+
149
+ 4. Not to modify this License in any other way.
package/README.md CHANGED
@@ -39,6 +39,18 @@ Repository `.mcp.json` entries describe direct MCP servers:
39
39
  }
40
40
  ```
41
41
 
42
+ Your own servers live in `mcp.json` in your Po home (`~/.po/mcp.json`, or under `PO_HOME`), in the
43
+ same shape. Po loads them into every repository's sessions, first, so a repository, plugin or
44
+ domain entry with the same name wins.
45
+
46
+ Add a server from the cockpit without editing either file: **Add server** on a repository's MCP
47
+ servers page writes that repository's `.mcp.json`, and **Settings, MCP servers** writes your own
48
+ config. Remote servers take a URL and optional headers. A local command also needs the trust
49
+ confirmation, which the hub checks again. Adding never replaces an existing name or rewrites a
50
+ file that is not valid JSON. Named header or environment values can be kept in the Po vault
51
+ instead (`secretFields` on the add request): the vault is written first, the file gets
52
+ `${vault:<server>-<field>}` in their place, and a failed file write removes the new secrets.
53
+ Without a vault the request answers 503.
42
54
  Selected legacy plugins may also provide root `.mcp.json`. A schema-gated Agent Plugin v1 instead
43
55
  provides root `mcp.json`. Po validates its portable contract, supplies private persistent
44
56
  `PLUGIN_DATA`, and resolves plugin-relative stdio commands and working directories. It also
@@ -63,9 +75,102 @@ should load.
63
75
 
64
76
  Within Po, this package consumes the immutable `poMcpProjection` service published on the
65
77
  session Cordis root.
66
- Downstream clients run in-process through `@agimon-ai/mcp-proxy`; this adapter does not start its
78
+ Downstream clients run in-process through `@agimon-ai/po-mcp-proxy`; this adapter does not start its
67
79
  Hono server.
68
80
 
81
+ ## Temporary connections for packages
82
+
83
+ Trusted session plugins inject `PO_MCP_SERVICE` from `@agimon-ai/po-core/mcp` and call
84
+ `readPoMcp(scoped)` inside that injection on their session Cordis root. `po-mcp` provides
85
+ this portable contract through `PO_MCP_CONTRACT`. This is not a model-visible management
86
+ API or a package-identity boundary. The caller authorizes the destination, binds code-mode
87
+ calls to the owning session, and passes the run's abort signal for establishment.
88
+
89
+ ```ts
90
+ const connection = await servers.register(
91
+ {
92
+ name: 'development',
93
+ url: 'https://example.com/mcp',
94
+ apiKey: { mode: 'bearer', environmentVariable: 'DEVELOPMENT_API_KEY' },
95
+ },
96
+ signal,
97
+ );
98
+ try {
99
+ // Tools also join this session's normal MCP surface.
100
+ const tools = connection.snapshot().tools;
101
+ if (tools.includes('ping')) await connection.invoke('ping', {});
102
+ } finally {
103
+ await connection.dispose();
104
+ }
105
+ ```
106
+
107
+ `register` connects immediately and returns an identity-owned handle with `name`, live
108
+ `snapshot()`, validated `invoke(tool, args?, signal?)`, and asynchronous idempotent `dispose()`.
109
+ HTTP/SSE no-auth connections require HTTP loopback with an explicit port and never start OAuth.
110
+ API-key connections also accept HTTPS. URL userinfo, fragments, URL environment interpolation,
111
+ reserved names, and all existing or pending-removal names are rejected. Registrations never
112
+ replace a connection. Snapshot and invocation cannot observe a same-name replacement.
113
+
114
+ API keys use `{ mode: 'bearer', environmentVariable }` or
115
+ `{ mode: 'header', name: 'X-Api-Key', environmentVariable }`. Trusted server code may
116
+ instead supply `value` programmatically. Do not print keys or add credential-bearing call records.
117
+ Literal keys embedded in `exec` source still persist in saved scripts and transcripts. Environment
118
+ references read only the owning session's admitted environment.
119
+ The key stays in the session overlay, outside proxy configuration, disk caches, and the
120
+ vault. The existing proxy API-key transport pins credentials to the destination origin,
121
+ refuses redirects, and never starts OAuth.
122
+
123
+ Establishment cancellation rolls back its partial entry and connection. Once connected, normal
124
+ `exec` completion does not dispose the registration. `dispose()` remains available after run
125
+ cancellation or selection changes. Call it in `finally` when development ends, including failed
126
+ stop paths. Provider shutdown retires handles and closes connections; it does not stop external
127
+ MCP server processes. No saved MCP config is changed.
128
+
129
+ The existing `@agimon-ai/po-mcp/localServers` and `/sessionServers` APIs remain compatibility
130
+ adapters with their original name-based result and cleanup methods. New consumers use the core
131
+ contract and owned handles.
132
+
133
+ ## Private connections for plugins
134
+
135
+ Trusted session plugins resolve `PO_MCP_CONNECTIONS_CONTRACT` from `@agimon-ai/po-core/mcp`
136
+ through their server scope. Unlike `register()`, private connections never publish upstream
137
+ definitions to session tools, code mode, skills, MCP status, panels, saved config or the definitions cache.
138
+ The owner is the consuming plugin's package name, not a separate access-control boundary.
139
+
140
+ ```ts
141
+ const upstream = await connections.connect(
142
+ {
143
+ owner: '@example/plugin',
144
+ url: 'https://example.com/mcp',
145
+ auth: { credential: { kind: 'bearer', token }, saveAs: 'account' },
146
+ appTools: ['search'],
147
+ lifetime: pluginSignal,
148
+ },
149
+ signal,
150
+ );
151
+ const tools = await upstream.listTools(signal);
152
+ const result = await upstream.callTool('search', args, {
153
+ invocation: { toolCallId, toolName: 'my_search' },
154
+ signal,
155
+ });
156
+ ```
157
+
158
+ `listTools()` returns detached full MCP definitions. Only public HTTPS host names and Streamable
159
+ HTTP are accepted, with no sign-in or token refresh. Custom headers use
160
+ `{ kind: 'header', name: 'X-Api-Key', value: token }`. Saved credentials are encrypted in the
161
+ vault under the owner and pinned to the origin. Reconnect with `auth: { credentialId: 'account' }`.
162
+ `dispose()` retires the connection and its Apps but keeps credentials;
163
+ `connections.forgetCredential(owner, 'account')` explicitly deletes one.
164
+
165
+ For an App, return the result from the plugin's wrapper tool without replacing its `details`.
166
+ `invocation` identifies that wrapper's exact call. Use Po's shared MCP result card, with the wrapper's
167
+ `web-plugin-tool-renderers` ignore comment explaining that choice, rather than a custom card.
168
+ Apps start read-only. Enabling interactions is approved once per open App; each tool call still
169
+ requires confirmation. Only the fixed `appTools` allowlist and App-visible upstream tools qualify.
170
+ App records are in memory, limited to 256 per connection. After restart, old private Apps are unavailable.
171
+ On edge, the host must bind the remote MCP policy service; private discovery uses its outbound
172
+ policy and fetch, never its saved-server loader.
173
+
69
174
  ## Direct tools and configured identity
70
175
 
71
176
  Main sessions and native child agents receive permitted named MCP tools with their descriptions
@@ -81,12 +186,79 @@ original downstream tool name; tool prefixes are not parsed to route calls.
81
186
  Children borrow the parent runtime. Requested `mcp` or `mcp_use` groups expand into permitted
82
187
  direct tools; `mcpDirectTools` selectors (`*`, a configured server, or `server/tool`) narrow that
83
188
  set. Capability ceilings must explicitly allow MCP and still constrain the selected tools.
84
- Children cannot manage the parent's connections. Remote `mcp_use` remains a compatibility route,
85
- not the default native model declaration.
189
+ The direct connection-management tool is main-agent-only. Borrowed trusted `exec` still uses
190
+ parent-session bindings, including Help-only `mcpTest`. Remote `mcp_use` remains a compatibility
191
+ route, not the default native model declaration.
192
+
193
+ Select domains and child subsets to control tool availability. Keep catalogs out of prompt prose.
194
+
195
+ ## Po MCP namespace
196
+
197
+ Po's own `discover` and `exec` tools (`@agimon-ai/po-codemode`) enable the `mcp`
198
+ namespace alongside namespaces such as `browser`. Pi's internal MCP codemode and tool
199
+ search remain disabled. These are separate mechanisms, also distinct from code mode
200
+ run by a remote MCP client. While code mode is bound, the main agent's direct tool
201
+ declarations for these servers are withdrawn, since the namespace reaches every one and
202
+ their schemas would only cost context; they show as inactive in Context. A tool that carries
203
+ an MCP App keeps its direct tool for the inline UI. Without code mode every direct tool stays,
204
+ and the `mcp_use` compatibility route remains. Native child sessions still receive the
205
+ direct tools they are granted. The namespace does not change MCP access grants.
206
+
207
+ The always-active `codemode-how-to-mcp` skill teaches agents this flow and, when loaded, lists the session's servers and tool names.
208
+
209
+ Start with `discover({ namespace: 'mcp' })` to inspect the permitted catalog and typed
210
+ signatures. If the declaration output exceeds 24,000 characters, narrow discovery
211
+ with `discover({ query: 'github/search_issues' })` before calling a tool. Use only
212
+ names and argument schemas returned by discovery, never guessed names.
86
213
 
87
- Full schemas cost context tokens. Select domains and child subsets rather than hiding tool
88
- availability or repeating catalogs in prompt prose. Codemode and tool search remain disabled;
89
- the Pi 1.0.0 source review did not measure savings or justify enabling them.
214
+ Inside `exec`, call a typed wrapper such as `await mcp.github.search_issues(args)`,
215
+ where `args` matches the discovered input schema. Names are exact configured server
216
+ and original tool names, not normalized direct-tool prefixes. Use bracket access
217
+ for names that need it, for example `await mcp['work-github']['search-issues'](args)`.
218
+ The generic route is `await mcp.call(server, tool, args)`, using the exact discovered
219
+ server and tool names. Both routes use the same permitted session connections and
220
+ admission checks as direct calls.
221
+
222
+ Results expose `text`, `images`, `structuredContent`, and `blocks`. Inspect the text
223
+ or structured content in the script; use `image(result)` to emit its images from
224
+ `exec`. Upstream `isError` results reject with the upstream text rather than
225
+ returning a successful result.
226
+
227
+ Outbound file parameters still require consent. Time waiting for that consent counts
228
+ against the `exec` timeout: 30 seconds by default, with `timeoutMs` up to 120 seconds.
229
+ After a runtime swap, an old run cannot access the replacement runtime. Discover again
230
+ and retry in a new `exec`, not in the old run.
231
+
232
+ MCP Apps stay on direct tools so their inline UI and interaction lifecycle remain
233
+ available. Use a direct call when an App is needed, not the namespace route.
234
+
235
+ ## Session-only URL test servers
236
+
237
+ In Help mode, ask permission, then discover `mcpTest` and add a URL server:
238
+
239
+ ```ts
240
+ await mcpTest.add({ name: 'test', url: 'https://example.com/mcp', type: 'http' });
241
+ ```
242
+
243
+ HTTP and SSE servers accept optional headers and OAuth client settings. Sign-in links appear
244
+ in the existing MCP panel. Add waits for completion and respects cancellation. With no code
245
+ mode, the main-agent-only `mcp_test_server` tool supports `add`, `remove` and `list` instead.
246
+ These management surfaces disappear when Help turns off, but connected test servers remain.
247
+ `mcpTest.remove(name)` disconnects and forgets one while Help is on.
248
+
249
+ Test server configuration, headers and credentials stay in memory, including across MCP
250
+ reloads. They are not written to config, the Po vault, credential files or the shared tool cache,
251
+ and a new session does not inherit them. They cannot replace configured names or override
252
+ `--no-mcp`. Stdio and `/mcp add` are deliberately unsupported.
253
+
254
+ Memory-only storage does not redact tool arguments or conversation history. Never paste
255
+ literal secrets into management calls. Use `${ENV_VAR}` references from the session's
256
+ admitted environment for sensitive headers or OAuth client settings.
257
+
258
+ Configured-server credentials live in the Po vault (`po/vault`, namespace `mcp.oauth`). Without a
259
+ vault they stay in memory and the session shows a diagnostic. Near-expiry tokens refresh before
260
+ requests, with no idle timer. The vault's lease coordinates refresh across processes, so a
261
+ rotating refresh token is spent once; memory stores synchronize only within their process.
90
262
 
91
263
  ## Inline Apps (development)
92
264
 
@@ -106,17 +278,17 @@ Reopening a widget reads its retained result and state, never reruns the origina
106
278
  built on the ChatGPT SDK work too. Only ChatGPT widgets receive `toolOutput` globals updates
107
279
  after their own `callTool`. Each App root gets a `light`/`dark` class, `data-theme` and
108
280
  `color-scheme` (an App's own class or `data-theme` is kept), and theme changes sync live.
109
- A tool result that rendered an App stays behind the card toggle unless the call failed.
281
+ An MCP tool card starts collapsed; an App stays visible. Expanding the card shows the call's input, then its result.
110
282
 
111
283
  The ChatGPT adapter implements tool input/output and private metadata globals, globals
112
284
  updates, `callTool`, `setWidgetState`, `sendFollowUpMessage`, inline display mode, height,
113
285
  close, and confirmed external links. File libraries, checkout, accounts, modal/fullscreen
114
286
  modes, stable custom origins, sampling, and automatic model-context updates are unsupported.
115
287
 
116
- The runtime pins published `@agimon-ai/mcp-proxy@0.32.12` for Apps capability
117
- negotiation, private result capture before output guarding, and upstream request
118
- cancellation. Model-facing output remains guarded; retained App results are bounded
119
- separately. No local proxy dependency or spill-file reads are used.
288
+ The runtime uses workspace-owned `@agimon-ai/po-mcp-proxy` from
289
+ `packages/utils/po-mcp-proxy` for Apps capability negotiation, private result capture
290
+ before output guarding, and upstream request cancellation. Model-facing output remains
291
+ guarded; retained App results are bounded separately. No spill-file reads are used.
120
292
 
121
293
  Run from the repository root:
122
294
 
@@ -139,6 +311,9 @@ without rerunning tools, and a real Po-exported session widget.
139
311
  /mcp
140
312
  /mcp status
141
313
  /mcp auth <server>
314
+ /mcp disconnect <server>
315
+ /mcp unauthorize <server>
316
+ /mcp approve on|off|status
142
317
  /mcp reload
143
318
  ```
144
319
 
@@ -152,15 +327,50 @@ The compact `po-mcp-session-auth` status carries configured names, states, safe
152
327
  URLs and tool identities/estimates. It excludes credentials and credential-store data. Repository
153
328
  catalog and authorization APIs remain separate from this live-session view.
154
329
 
330
+ ## Approval for tools that change data
331
+
332
+ Following the MCP spec defaults, a tool is treated as changing data unless it declares
333
+ `readOnlyHint: true` or `destructiveHint: false`. Such tools ask through `@agimon-ai/po-approval`
334
+ before they run, whether called as direct tools, through `mcp_use`, from the code-mode `mcp`
335
+ namespace (typed members only; `mcp.call` refuses them) or from an MCP App. The request does not
336
+ block the agent: the call is queued and replayed once the person approves.
337
+
338
+ - `autoApproveDestructiveTools` in `<po home>/mcp-settings.json` (the hub MCP API's `GET`/`PUT /settings` route)
339
+ skips the prompt in every session and applies to live sessions at once.
340
+ - `/mcp approve on|off|status` skips it in one session until that session restarts.
341
+ - Subagents, background runs and unattended calls are not asked, as with every `ask` policy.
342
+ - `po-mcp-session-approval` carries `{ global, session }` for the session panel.
343
+
344
+ A server that is removed in settings, disconnected, signed out, closed or degraded leaves the
345
+ direct tools, the `mcp` namespace and the `codemode-how-to-mcp` listing until it reconnects. An
346
+ explicit `/mcp disconnect` survives `/mcp reload`. On the edge host, a remote server whose
347
+ connection closes or that answers 401/403 is dropped for the rest of the session.
348
+
155
349
  ## Credentials and trust
156
350
 
157
351
  Allowed stdio entries execute their configured commands with the Pi process environment and
158
352
  operating system privileges. Review configuration as executable code.
159
353
 
160
- OAuth credentials use the operating system keyring when available. The private-file fallback is
161
- stored under `~/.mcp-proxy/oauth` with owner-only permissions. Credentials remain machine-wide and
162
- keyed by server name, while their upstream URL binding prevents blind replay to another endpoint.
163
- Treat both the configuration and credential store as sensitive.
354
+ OAuth credentials are encrypted entries in the Po vault. Each is keyed by scope and server name:
355
+ `user` for your own `mcp.json`, `repository:<digest>` for a repository (keyed by its git common
356
+ directory, so worktrees share it and separate clones do not), and the plugin's source id for a
357
+ plugin. One server name at three levels therefore has three credentials. The upstream URL binding
358
+ still prevents blind replay to another endpoint. Credentials saved earlier in the OS keyring or
359
+ under `~/.mcp-proxy/oauth` are not read or migrated: authorize once more. Treat both the
360
+ configuration and the vault as sensitive.
361
+
362
+ `${vault:NAME}` references (`NAME` is 1 to 64 of `A-Z a-z 0-9 . _ -`) work in header values, env
363
+ values and `bearerToken`. They are resolved when Po connects, on a copy of the configuration, so
364
+ config files, the definitions cache and config hashes only ever hold the reference. A reference
365
+ in `url`, `command`, `args` or `cwd` fails the connection. Secrets live in vault namespace
366
+ `mcp.secret` under the same scopes as OAuth credentials, so a repository server never reads a
367
+ user-scope secret. Each secret is bound to where it goes: a URL origin (https, or plain http only
368
+ to this machine, with redirects refused), or a command plus its exact arguments. A changed origin,
369
+ command or argument list reads as missing. A missing secret shows as "needs secret NAME" in the
370
+ session MCP panel, which stores it through the session's owner-only `POST /secrets` route and
371
+ reconnects the server. Compatibility frontends that read the same config files directly get the
372
+ reference left unresolved. Literal values keep working. Any in-process plugin can read every
373
+ vault namespace.
164
374
 
165
375
  The default OAuth callback is `http://127.0.0.1:19876/callback`. Authorization therefore requires the
166
376
  browser and Po runtime to share that loopback network namespace. A remote browser cannot complete
@@ -189,7 +399,7 @@ Maintained by [Agimon](https://agimon.ai/about).
189
399
 
190
400
  ## License
191
401
 
192
- MIT
402
+ Business Source License 1.1: free for personal use, organisations under USD 1M revenue, non-profits and education. See [LICENSE](LICENSE) and https://agimon.ai/licensing.
193
403
 
194
404
  Named routed `src/extensions/` entries declare host contributions and delegate to services. MCP session state and connection behavior live in named service folders, and `src/exports/` exposes reusable public APIs.
195
405