@agimon-ai/po-mcp 0.0.0-alpha.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/LICENSE +21 -0
- package/README.md +223 -0
- package/dist/apiContracts.cjs +269 -0
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/apiContracts.d.mts +137 -0
- package/dist/apiContracts.d.mts.map +1 -0
- package/dist/apiContracts.mjs +258 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/extensions/mcp-ui.mjs +31 -0
- package/dist/extensions/mcp-ui.mjs.map +1 -0
- package/dist/extensions/mcp.cjs +104 -0
- package/dist/extensions/mcp.cjs.map +1 -0
- package/dist/extensions/mcp.d.mts +5 -0
- package/dist/extensions/mcp.d.mts.map +1 -0
- package/dist/extensions/mcp.mjs +99 -0
- package/dist/extensions/mcp.mjs.map +1 -0
- package/dist/extensions/server.cjs +2852 -0
- package/dist/extensions/server.cjs.map +1 -0
- package/dist/extensions/server.d.mts +5 -0
- package/dist/extensions/server.d.mts.map +1 -0
- package/dist/extensions/server.mjs +2839 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/extensions/web.mjs +2200 -0
- package/dist/extensions/web.mjs.map +1 -0
- package/dist/index.cjs +18 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +89 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +9 -0
- package/dist/index.mjs.map +1 -0
- package/dist/mcpCatalog-6Tpt6Gqn.cjs +900 -0
- package/dist/mcpCatalog-6Tpt6Gqn.cjs.map +1 -0
- package/dist/mcpCatalog-SlqWS-sb.mjs +806 -0
- package/dist/mcpCatalog-SlqWS-sb.mjs.map +1 -0
- package/dist/mcpConfig-BYESy-zP.d.mts +57 -0
- package/dist/mcpConfig-BYESy-zP.d.mts.map +1 -0
- package/dist/projection-gyAA2jRB.mjs +43 -0
- package/dist/projection-gyAA2jRB.mjs.map +1 -0
- package/dist/projection-w3XxXmVi.cjs +51 -0
- package/dist/projection-w3XxXmVi.cjs.map +1 -0
- package/dist/projection.cjs +17 -0
- package/dist/projection.d.mts +12 -0
- package/dist/projection.d.mts.map +1 -0
- package/dist/projection.mjs +4 -0
- package/dist/rolldown-runtime-C0BPl7ul.cjs +43 -0
- package/llms.txt +9 -0
- package/package.json +157 -0
- package/src/prompts/po-use-mcp/SKILL.md +79 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# @agimon-ai/po-mcp
|
|
2
|
+
|
|
3
|
+
Domain-aware MCP selection for Po.
|
|
4
|
+
|
|
5
|
+
Part of the [Po distribution](https://www.npmjs.com/package/@agimon-ai/po).
|
|
6
|
+
|
|
7
|
+
The package removes disallowed servers before any stdio process is spawned. A filtered server is
|
|
8
|
+
absent rather than merely hidden from the model.
|
|
9
|
+
|
|
10
|
+
> **Alpha:** configuration and adapter contracts may change between releases.
|
|
11
|
+
|
|
12
|
+
## Requirements
|
|
13
|
+
|
|
14
|
+
- Node.js 24 or newer
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
`po init` and `dpi init` include this adapter in `default.packages` in `.po/modes.yaml`.
|
|
19
|
+
Remove it or move it to a named layer to change which major modes load it. When loaded in Po,
|
|
20
|
+
domain selection controls server access.
|
|
21
|
+
|
|
22
|
+
| Entry | Purpose |
|
|
23
|
+
| ------------------------------ | --------------------------------------------------------- |
|
|
24
|
+
| `@agimon-ai/po-mcp` | Library API |
|
|
25
|
+
| `@agimon-ai/po-mcp/projection` | Neutral projection adapter and Agent Plugin normalization |
|
|
26
|
+
|
|
27
|
+
## Configure direct servers
|
|
28
|
+
|
|
29
|
+
Repository `.mcp.json` entries describe direct MCP servers:
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"mcpServers": {
|
|
34
|
+
"filesystem": {
|
|
35
|
+
"command": "npx",
|
|
36
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Selected legacy plugins may also provide root `.mcp.json`. A schema-gated Agent Plugin v1 instead
|
|
43
|
+
provides root `mcp.json`. Doom validates its portable contract, supplies private persistent
|
|
44
|
+
`PLUGIN_DATA`, and resolves plugin-relative stdio commands and working directories. It also
|
|
45
|
+
normalizes `streamable-http` for the embedded runtime. Invalid portable server entries are isolated
|
|
46
|
+
from the other entries in that plugin.
|
|
47
|
+
|
|
48
|
+
Proxy upstreams are read from `mcp-config.yaml`. Domains can select direct `servers` and proxy
|
|
49
|
+
upstreams separately in `.po/domains.yaml`:
|
|
50
|
+
|
|
51
|
+
```yaml
|
|
52
|
+
# .po/domains.yaml
|
|
53
|
+
domains:
|
|
54
|
+
development:
|
|
55
|
+
description: Repository development tools.
|
|
56
|
+
mcp:
|
|
57
|
+
servers: [filesystem]
|
|
58
|
+
proxy: [github]
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
An absent or empty allowlist retains configured entries. Use `po --no-mcp` when no MCP server
|
|
62
|
+
should load.
|
|
63
|
+
|
|
64
|
+
Within Po, this package consumes the immutable `doomMcpProjection` service published on the
|
|
65
|
+
session Cordis root.
|
|
66
|
+
Downstream clients run in-process through `@agimon-ai/mcp-proxy`; this adapter does not start its
|
|
67
|
+
Hono server.
|
|
68
|
+
|
|
69
|
+
## Direct tools and configured identity
|
|
70
|
+
|
|
71
|
+
Main sessions and native child agents receive permitted named MCP tools with their descriptions
|
|
72
|
+
and complete input schemas. Names use the configured entry prefix, not the downstream-reported
|
|
73
|
+
server name: `personal/search` is exposed as `personal_search` and `work/search` as `work_search`.
|
|
74
|
+
Non-alphanumeric prefix characters become underscores, preserving existing names and collision
|
|
75
|
+
diagnostics.
|
|
76
|
+
|
|
77
|
+
Two configured entries may point to the same URL with different accounts. Each uses its own
|
|
78
|
+
configured-name connection and credential slot. Requests retain the exact configured name and
|
|
79
|
+
original downstream tool name; tool prefixes are not parsed to route calls.
|
|
80
|
+
|
|
81
|
+
Children borrow the parent runtime. Requested `mcp` or `mcp_use` groups expand into permitted
|
|
82
|
+
direct tools; `mcpDirectTools` selectors (`*`, a configured server, or `server/tool`) narrow that
|
|
83
|
+
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.
|
|
86
|
+
|
|
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.
|
|
90
|
+
|
|
91
|
+
## Inline Apps (development)
|
|
92
|
+
|
|
93
|
+
The conversation renderer recognizes standard `_meta.ui.resourceUri`, deprecated
|
|
94
|
+
`ui/resourceUri`, and ChatGPT `openai/outputTemplate` declarations. HTML stays inside
|
|
95
|
+
an opaque, sandboxed inline frame; ordinary text results remain available. Browsers
|
|
96
|
+
without iframe CSP enforcement use the text fallback.
|
|
97
|
+
|
|
98
|
+
Apps open read-only, including replayed history. Enable interactions to authorize a
|
|
99
|
+
fresh connection-bound lease. Each tool call and attributed follow-up requires host
|
|
100
|
+
confirmation and the existing session admission checks. Calls are limited to current,
|
|
101
|
+
app-visible tools on the original configured server. Visibility is not consent.
|
|
102
|
+
Private result metadata and bounded widget state are not injected into model content.
|
|
103
|
+
Reopening a widget reads its retained result and state, never reruns the original tool.
|
|
104
|
+
|
|
105
|
+
`window.openai` is present in every widget, beside the MCP Apps bridge, so standard Apps
|
|
106
|
+
built on the ChatGPT SDK work too. Only ChatGPT widgets receive `toolOutput` globals updates
|
|
107
|
+
after their own `callTool`. Each App root gets a `light`/`dark` class, `data-theme` and
|
|
108
|
+
`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.
|
|
110
|
+
|
|
111
|
+
The ChatGPT adapter implements tool input/output and private metadata globals, globals
|
|
112
|
+
updates, `callTool`, `setWidgetState`, `sendFollowUpMessage`, inline display mode, height,
|
|
113
|
+
close, and confirmed external links. File libraries, checkout, accounts, modal/fullscreen
|
|
114
|
+
modes, stable custom origins, sampling, and automatic model-context updates are unsupported.
|
|
115
|
+
|
|
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.
|
|
120
|
+
|
|
121
|
+
Run from the repository root:
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
pnpm --filter @agimon-ai/po-mcp test
|
|
125
|
+
pnpm --filter @agimon-ai/po exec playwright test --config playwright.app.config.ts inlineMcpSandbox.spec.ts
|
|
126
|
+
pnpm nx run @agimon-ai/po:test:app
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The stdio fixture verifies discovery, visibility, resource reads, pre-guard private
|
|
130
|
+
results, and upstream cancellation. Browser tests cover sandbox/bootstrap isolation
|
|
131
|
+
and standalone exported widgets. The production conversation fixture uses an isolated
|
|
132
|
+
home and a local scripted model to verify standard and ChatGPT Apps, confirmed callbacks
|
|
133
|
+
and attributed follow-ups, private metadata exclusion, saved state, read-only replay
|
|
134
|
+
without rerunning tools, and a real Po-exported session widget.
|
|
135
|
+
|
|
136
|
+
## Commands
|
|
137
|
+
|
|
138
|
+
```text
|
|
139
|
+
/mcp
|
|
140
|
+
/mcp status
|
|
141
|
+
/mcp auth <server>
|
|
142
|
+
/mcp reload
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The web Context panel lists
|
|
146
|
+
configured servers and their named tools, including authorization and management actions. Open a
|
|
147
|
+
tool to inspect its description, full input schema, warnings and estimated schema tokens.
|
|
148
|
+
Authorization sends one `/mcp auth <server>` prompt frame; headless hosts never open a desktop
|
|
149
|
+
browser automatically.
|
|
150
|
+
|
|
151
|
+
The compact `doom-mcp-session-auth` status carries configured names, states, safe authorization
|
|
152
|
+
URLs and tool identities/estimates. It excludes credentials and credential-store data. Repository
|
|
153
|
+
catalog and authorization APIs remain separate from this live-session view.
|
|
154
|
+
|
|
155
|
+
## Credentials and trust
|
|
156
|
+
|
|
157
|
+
Allowed stdio entries execute their configured commands with the Pi process environment and
|
|
158
|
+
operating system privileges. Review configuration as executable code.
|
|
159
|
+
|
|
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.
|
|
164
|
+
|
|
165
|
+
The default OAuth callback is `http://127.0.0.1:19876/callback`. Authorization therefore requires the
|
|
166
|
+
browser and Po runtime to share that loopback network namespace. A remote browser cannot complete
|
|
167
|
+
the callback when its `127.0.0.1` resolves to another machine or container.
|
|
168
|
+
|
|
169
|
+
## Public API
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
import { buildMcpConfigGroups, readCachedCatalog, toPiToolName } from '@agimon-ai/po-mcp';
|
|
173
|
+
import type { McpAllowlist, McpSessionConfig } from '@agimon-ai/po-mcp';
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
`po --emit-mcp <directory>` emits the resolved MCP configuration to the target directory
|
|
177
|
+
without launching a model.
|
|
178
|
+
|
|
179
|
+
## Development
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
pnpm build
|
|
183
|
+
pnpm typecheck
|
|
184
|
+
pnpm test
|
|
185
|
+
pnpm lint
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Maintained by [Agimon](https://agimon.ai/about).
|
|
189
|
+
|
|
190
|
+
## License
|
|
191
|
+
|
|
192
|
+
MIT
|
|
193
|
+
|
|
194
|
+
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
|
+
|
|
196
|
+
### Remote file transfer
|
|
197
|
+
|
|
198
|
+
Session MCP always exposes `share_file` and `save_file`, both marked with
|
|
199
|
+
`_meta['doompi/fileTransfer']=true`, subject to the connection's capability grants.
|
|
200
|
+
`share_file({path})` uses session-bound host sharing without a consent prompt. Its
|
|
201
|
+
structured result contains `url`, `fileName`, `mimeType`, `size`, `expiresAt` (epoch
|
|
202
|
+
milliseconds), and `maxDownloads` (3). Links expire after 10 minutes and require
|
|
203
|
+
remote access. Outbound file parameters sent to other MCP servers still require
|
|
204
|
+
consent.
|
|
205
|
+
|
|
206
|
+
`save_file` declares `openai/fileParams=['file']` and accepts exactly one file form:
|
|
207
|
+
`{download_url,file_name,file_id?,mime_type?}` or `{name,data_base64}`. HTTPS downloads
|
|
208
|
+
accept only public addresses, pin DNS for each request, revalidate up to three
|
|
209
|
+
redirects, and have a 30-second deadline and 25 MiB cap. Base64 is validated before
|
|
210
|
+
decoding and capped at 5 MiB. Without `path`, files become private session
|
|
211
|
+
attachments using the bound session environment. Optional `path` is relative to
|
|
212
|
+
the bound cwd, requires existing non-symlink parents, and creates a private file
|
|
213
|
+
exclusively, never overwriting. Results contain `path`, `name`, `size`, and
|
|
214
|
+
`mimeType`; supplied MIME hints are not trusted as content detection.
|
|
215
|
+
|
|
216
|
+
Workspace containment uses portable identity and realpath rechecks, not atomic
|
|
217
|
+
descriptor-relative operations. This mode assumes no hostile concurrent workspace
|
|
218
|
+
mutation: ancestor swaps can create a file outside cwd or expose bytes before a
|
|
219
|
+
later check rejects the write. Failed cwd writes truncate the exclusively created
|
|
220
|
+
descriptor but may leave an empty private file. Cleanup never unlinks a mutable
|
|
221
|
+
pathname, which could delete an unrelated replacement. Remove any empty artifact
|
|
222
|
+
before retrying the same destination. Session attachments retain their normal
|
|
223
|
+
temporary-file cleanup.
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
let _agimon_ai_po_core_apiContracts = require("@agimon-ai/po-core/apiContracts");
|
|
6
|
+
let typebox = require("typebox");
|
|
7
|
+
let _agimon_ai_po_core_pluginProtocol = require("@agimon-ai/po-core/pluginProtocol");
|
|
8
|
+
//#region src/schemas/apiContracts.ts
|
|
9
|
+
const S = typebox.Type.String();
|
|
10
|
+
const N = typebox.Type.Number();
|
|
11
|
+
const B = typebox.Type.Boolean();
|
|
12
|
+
const O = typebox.Type.Optional;
|
|
13
|
+
const literals = (values) => typebox.Type.Union(values.map((value) => typebox.Type.Literal(value)));
|
|
14
|
+
const RepositoryId = typebox.Type.String({ pattern: "^(?:[a-f0-9]{32}|repo-[A-Za-z0-9_-]{24}|[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})$" });
|
|
15
|
+
const RepositoryQuery = [{
|
|
16
|
+
name: "repositoryId",
|
|
17
|
+
in: "query",
|
|
18
|
+
required: true,
|
|
19
|
+
schema: RepositoryId
|
|
20
|
+
}];
|
|
21
|
+
const McpCatalogSchema = typebox.Type.Object({
|
|
22
|
+
repositoryId: S,
|
|
23
|
+
sync: typebox.Type.Object({
|
|
24
|
+
fresh: B,
|
|
25
|
+
reasons: typebox.Type.Array(S)
|
|
26
|
+
}),
|
|
27
|
+
servers: typebox.Type.Array(typebox.Type.Object({
|
|
28
|
+
name: S,
|
|
29
|
+
state: literals([
|
|
30
|
+
"not-connected",
|
|
31
|
+
"connecting",
|
|
32
|
+
"connected",
|
|
33
|
+
"degraded",
|
|
34
|
+
"needs-auth",
|
|
35
|
+
"failed",
|
|
36
|
+
"closed"
|
|
37
|
+
]),
|
|
38
|
+
source: literals([
|
|
39
|
+
"cached",
|
|
40
|
+
"live",
|
|
41
|
+
"configured"
|
|
42
|
+
]),
|
|
43
|
+
credentialPresent: B,
|
|
44
|
+
tools: typebox.Type.Array(typebox.Type.Object({
|
|
45
|
+
name: S,
|
|
46
|
+
piName: S,
|
|
47
|
+
description: O(S)
|
|
48
|
+
})),
|
|
49
|
+
error: O(S)
|
|
50
|
+
})),
|
|
51
|
+
droppedServers: typebox.Type.Array(S),
|
|
52
|
+
diagnostics: typebox.Type.Array(S)
|
|
53
|
+
});
|
|
54
|
+
const McpAuthorizationSchema = typebox.Type.Object({
|
|
55
|
+
id: S,
|
|
56
|
+
repositoryId: S,
|
|
57
|
+
serverName: S,
|
|
58
|
+
status: literals([
|
|
59
|
+
"starting",
|
|
60
|
+
"waiting",
|
|
61
|
+
"completed",
|
|
62
|
+
"failed",
|
|
63
|
+
"cancelled",
|
|
64
|
+
"expired"
|
|
65
|
+
]),
|
|
66
|
+
authorizationUrl: O(S),
|
|
67
|
+
error: O(S),
|
|
68
|
+
expiresAt: N
|
|
69
|
+
});
|
|
70
|
+
const McpSessionToolSchema = typebox.Type.Object({
|
|
71
|
+
server: S,
|
|
72
|
+
tool: S,
|
|
73
|
+
description: O(S),
|
|
74
|
+
inputSchema: typebox.Type.Record(S, typebox.Type.Unknown()),
|
|
75
|
+
tokens: N
|
|
76
|
+
});
|
|
77
|
+
const SessionToolQuery = [{
|
|
78
|
+
name: "server",
|
|
79
|
+
in: "query",
|
|
80
|
+
required: true,
|
|
81
|
+
schema: typebox.Type.String({
|
|
82
|
+
minLength: 1,
|
|
83
|
+
maxLength: 160
|
|
84
|
+
})
|
|
85
|
+
}, {
|
|
86
|
+
name: "tool",
|
|
87
|
+
in: "query",
|
|
88
|
+
required: true,
|
|
89
|
+
schema: typebox.Type.String({
|
|
90
|
+
minLength: 1,
|
|
91
|
+
maxLength: 256
|
|
92
|
+
})
|
|
93
|
+
}];
|
|
94
|
+
const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
|
|
95
|
+
version: 1,
|
|
96
|
+
sockets: [],
|
|
97
|
+
dynamic: [],
|
|
98
|
+
http: [{
|
|
99
|
+
id: "mcp.session.tool",
|
|
100
|
+
scope: "session",
|
|
101
|
+
basePath: "mcp-session",
|
|
102
|
+
path: "/tool",
|
|
103
|
+
method: "GET",
|
|
104
|
+
authentication: "owner",
|
|
105
|
+
description: "Read one tool the session reaches through mcp_use: its description, schema, and token cost.",
|
|
106
|
+
parameters: SessionToolQuery,
|
|
107
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(McpSessionToolSchema)
|
|
108
|
+
}, ...["global", "workspace"].flatMap((scope) => [
|
|
109
|
+
{
|
|
110
|
+
id: "mcp.catalog",
|
|
111
|
+
scope,
|
|
112
|
+
basePath: "mcp",
|
|
113
|
+
path: "/repository",
|
|
114
|
+
method: "GET",
|
|
115
|
+
authentication: "owner",
|
|
116
|
+
description: "Read the synced MCP repository catalog.",
|
|
117
|
+
parameters: RepositoryQuery,
|
|
118
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(McpCatalogSchema)
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: "mcp.discover",
|
|
122
|
+
scope,
|
|
123
|
+
basePath: "mcp",
|
|
124
|
+
path: "/repository/discover",
|
|
125
|
+
method: "POST",
|
|
126
|
+
authentication: "owner",
|
|
127
|
+
description: "Discover repository MCP servers.",
|
|
128
|
+
body: {
|
|
129
|
+
required: true,
|
|
130
|
+
contentType: "application/json",
|
|
131
|
+
schema: typebox.Type.Object({ repositoryId: RepositoryId })
|
|
132
|
+
},
|
|
133
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(McpCatalogSchema)
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: "mcp.authorize",
|
|
137
|
+
scope,
|
|
138
|
+
basePath: "mcp",
|
|
139
|
+
path: "/repository/authorize",
|
|
140
|
+
method: "POST",
|
|
141
|
+
authentication: "owner",
|
|
142
|
+
description: "Start MCP authorization.",
|
|
143
|
+
body: {
|
|
144
|
+
required: true,
|
|
145
|
+
contentType: "application/json",
|
|
146
|
+
schema: typebox.Type.Object({
|
|
147
|
+
repositoryId: RepositoryId,
|
|
148
|
+
serverName: typebox.Type.String({
|
|
149
|
+
minLength: 1,
|
|
150
|
+
maxLength: 160
|
|
151
|
+
})
|
|
152
|
+
})
|
|
153
|
+
},
|
|
154
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(McpAuthorizationSchema, 202)
|
|
155
|
+
},
|
|
156
|
+
...["GET", "DELETE"].map((method) => ({
|
|
157
|
+
id: `mcp.authorization.${method}`,
|
|
158
|
+
scope,
|
|
159
|
+
basePath: "mcp",
|
|
160
|
+
path: "/repository/authorize/{flowId}",
|
|
161
|
+
method,
|
|
162
|
+
authentication: "owner",
|
|
163
|
+
description: method === "GET" ? "Read an authorization flow." : "Cancel an authorization flow.",
|
|
164
|
+
parameters: RepositoryQuery,
|
|
165
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(McpAuthorizationSchema)
|
|
166
|
+
}))
|
|
167
|
+
])]
|
|
168
|
+
});
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/schemas/mcpApps.ts
|
|
171
|
+
const Lease = typebox.Type.String({
|
|
172
|
+
minLength: 1,
|
|
173
|
+
maxLength: 128
|
|
174
|
+
});
|
|
175
|
+
const JsonObject = typebox.Type.Record(typebox.Type.String(), typebox.Type.Unknown());
|
|
176
|
+
const Empty = typebox.Type.Object({}, { additionalProperties: false });
|
|
177
|
+
const Result = typebox.Type.Object({
|
|
178
|
+
content: typebox.Type.Array(typebox.Type.Unknown()),
|
|
179
|
+
structuredContent: typebox.Type.Optional(typebox.Type.Unknown()),
|
|
180
|
+
_meta: typebox.Type.Optional(JsonObject),
|
|
181
|
+
isError: typebox.Type.Optional(typebox.Type.Boolean())
|
|
182
|
+
});
|
|
183
|
+
const Address = {
|
|
184
|
+
service: "mcp.apps",
|
|
185
|
+
scope: "session",
|
|
186
|
+
direction: "client-to-server"
|
|
187
|
+
};
|
|
188
|
+
const mcpAppOpenMethod = (0, _agimon_ai_po_core_pluginProtocol.defineDoomPluginMethod)({
|
|
189
|
+
...Address,
|
|
190
|
+
method: "open",
|
|
191
|
+
input: typebox.Type.Object({ toolCallId: typebox.Type.String({
|
|
192
|
+
minLength: 1,
|
|
193
|
+
maxLength: 512
|
|
194
|
+
}) }, { additionalProperties: false }),
|
|
195
|
+
output: typebox.Type.Object({
|
|
196
|
+
leaseId: Lease,
|
|
197
|
+
html: typebox.Type.String(),
|
|
198
|
+
resourceUri: typebox.Type.String(),
|
|
199
|
+
protocol: typebox.Type.Union([typebox.Type.Literal("mcp"), typebox.Type.Literal("openai")]),
|
|
200
|
+
resourceMeta: JsonObject,
|
|
201
|
+
tool: typebox.Type.Object({
|
|
202
|
+
name: typebox.Type.String(),
|
|
203
|
+
description: typebox.Type.String(),
|
|
204
|
+
inputSchema: typebox.Type.Object({ type: typebox.Type.Literal("object") }, { additionalProperties: true }),
|
|
205
|
+
_meta: JsonObject
|
|
206
|
+
}),
|
|
207
|
+
args: JsonObject,
|
|
208
|
+
result: Result,
|
|
209
|
+
state: typebox.Type.Unknown(),
|
|
210
|
+
readOnly: typebox.Type.Boolean()
|
|
211
|
+
})
|
|
212
|
+
});
|
|
213
|
+
const mcpAppActivateMethod = (0, _agimon_ai_po_core_pluginProtocol.defineDoomPluginMethod)({
|
|
214
|
+
...Address,
|
|
215
|
+
method: "activate",
|
|
216
|
+
input: typebox.Type.Object({ leaseId: Lease }, { additionalProperties: false }),
|
|
217
|
+
output: typebox.Type.Object({ readOnly: typebox.Type.Literal(false) })
|
|
218
|
+
});
|
|
219
|
+
const mcpAppCallToolMethod = (0, _agimon_ai_po_core_pluginProtocol.defineDoomPluginMethod)({
|
|
220
|
+
...Address,
|
|
221
|
+
method: "callTool",
|
|
222
|
+
input: typebox.Type.Object({
|
|
223
|
+
leaseId: Lease,
|
|
224
|
+
name: typebox.Type.String({
|
|
225
|
+
minLength: 1,
|
|
226
|
+
maxLength: 256
|
|
227
|
+
}),
|
|
228
|
+
arguments: JsonObject
|
|
229
|
+
}, { additionalProperties: false }),
|
|
230
|
+
output: Result
|
|
231
|
+
});
|
|
232
|
+
const mcpAppSetStateMethod = (0, _agimon_ai_po_core_pluginProtocol.defineDoomPluginMethod)({
|
|
233
|
+
...Address,
|
|
234
|
+
method: "setState",
|
|
235
|
+
input: typebox.Type.Object({
|
|
236
|
+
leaseId: Lease,
|
|
237
|
+
state: typebox.Type.Unknown()
|
|
238
|
+
}, { additionalProperties: false }),
|
|
239
|
+
output: Empty
|
|
240
|
+
});
|
|
241
|
+
const mcpAppFollowUpMethod = (0, _agimon_ai_po_core_pluginProtocol.defineDoomPluginMethod)({
|
|
242
|
+
...Address,
|
|
243
|
+
method: "followUp",
|
|
244
|
+
input: typebox.Type.Object({
|
|
245
|
+
leaseId: Lease,
|
|
246
|
+
prompt: typebox.Type.String({
|
|
247
|
+
minLength: 1,
|
|
248
|
+
maxLength: 16e3
|
|
249
|
+
})
|
|
250
|
+
}, { additionalProperties: false }),
|
|
251
|
+
output: Empty
|
|
252
|
+
});
|
|
253
|
+
const mcpAppCloseMethod = (0, _agimon_ai_po_core_pluginProtocol.defineDoomPluginMethod)({
|
|
254
|
+
...Address,
|
|
255
|
+
method: "close",
|
|
256
|
+
input: typebox.Type.Object({ leaseId: Lease }, { additionalProperties: false }),
|
|
257
|
+
output: Empty
|
|
258
|
+
});
|
|
259
|
+
//#endregion
|
|
260
|
+
exports.apiContracts = apiContracts;
|
|
261
|
+
exports.default = apiContracts;
|
|
262
|
+
exports.mcpAppActivateMethod = mcpAppActivateMethod;
|
|
263
|
+
exports.mcpAppCallToolMethod = mcpAppCallToolMethod;
|
|
264
|
+
exports.mcpAppCloseMethod = mcpAppCloseMethod;
|
|
265
|
+
exports.mcpAppFollowUpMethod = mcpAppFollowUpMethod;
|
|
266
|
+
exports.mcpAppOpenMethod = mcpAppOpenMethod;
|
|
267
|
+
exports.mcpAppSetStateMethod = mcpAppSetStateMethod;
|
|
268
|
+
|
|
269
|
+
//# sourceMappingURL=apiContracts.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.cjs","names":["Type","defineApiContract","jsonApiResponses","Type","defineDoomPluginMethod"],"sources":["../src/schemas/apiContracts.ts","../src/schemas/mcpApps.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst S = Type.String();\nconst N = Type.Number();\nconst B = Type.Boolean();\nconst O = Type.Optional;\nconst literals = <T extends string>(values: T[]) => Type.Union(values.map((value) => Type.Literal(value)));\nconst RepositoryId = Type.String({\n pattern: '^(?:[a-f0-9]{32}|repo-[A-Za-z0-9_-]{24}|[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})$',\n});\nconst RepositoryQuery = [{ name: 'repositoryId', in: 'query' as const, required: true, schema: RepositoryId }];\nexport const McpCatalogSchema = Type.Object({\n repositoryId: S,\n sync: Type.Object({ fresh: B, reasons: Type.Array(S) }),\n servers: Type.Array(\n Type.Object({\n name: S,\n state: literals(['not-connected', 'connecting', 'connected', 'degraded', 'needs-auth', 'failed', 'closed']),\n source: literals(['cached', 'live', 'configured']),\n credentialPresent: B,\n tools: Type.Array(Type.Object({ name: S, piName: S, description: O(S) })),\n error: O(S),\n }),\n ),\n droppedServers: Type.Array(S),\n diagnostics: Type.Array(S),\n});\nexport const McpAuthorizationSchema = Type.Object({\n id: S,\n repositoryId: S,\n serverName: S,\n status: literals(['starting', 'waiting', 'completed', 'failed', 'cancelled', 'expired']),\n authorizationUrl: O(S),\n error: O(S),\n expiresAt: N,\n});\nexport const McpSessionToolSchema = Type.Object({\n server: S,\n tool: S,\n description: O(S),\n inputSchema: Type.Record(S, Type.Unknown()),\n tokens: N,\n});\nconst SessionToolQuery = [\n { name: 'server', in: 'query' as const, required: true, schema: Type.String({ minLength: 1, maxLength: 160 }) },\n { name: 'tool', in: 'query' as const, required: true, schema: Type.String({ minLength: 1, maxLength: 256 }) },\n];\ntype HttpContract = Parameters<typeof defineApiContract>[0]['http'][number];\nexport const apiContracts = defineApiContract({\n version: 1,\n sockets: [],\n dynamic: [],\n http: [\n {\n id: 'mcp.session.tool',\n scope: 'session',\n basePath: 'mcp-session',\n path: '/tool',\n method: 'GET',\n authentication: 'owner',\n description: 'Read one tool the session reaches through mcp_use: its description, schema, and token cost.',\n parameters: SessionToolQuery,\n responses: jsonApiResponses(McpSessionToolSchema),\n },\n ...(['global', 'workspace'] as const).flatMap((scope): HttpContract[] => [\n {\n id: 'mcp.catalog',\n scope,\n basePath: 'mcp',\n path: '/repository',\n method: 'GET',\n authentication: 'owner',\n description: 'Read the synced MCP repository catalog.',\n parameters: RepositoryQuery,\n responses: jsonApiResponses(McpCatalogSchema),\n },\n {\n id: 'mcp.discover',\n scope,\n basePath: 'mcp',\n path: '/repository/discover',\n method: 'POST',\n authentication: 'owner',\n description: 'Discover repository MCP servers.',\n body: { required: true, contentType: 'application/json', schema: Type.Object({ repositoryId: RepositoryId }) },\n responses: jsonApiResponses(McpCatalogSchema),\n },\n {\n id: 'mcp.authorize',\n scope,\n basePath: 'mcp',\n path: '/repository/authorize',\n method: 'POST',\n authentication: 'owner',\n description: 'Start MCP authorization.',\n body: {\n required: true,\n contentType: 'application/json',\n schema: Type.Object({\n repositoryId: RepositoryId,\n serverName: Type.String({ minLength: 1, maxLength: 160 }),\n }),\n },\n responses: jsonApiResponses(McpAuthorizationSchema, 202),\n },\n ...(['GET', 'DELETE'] as const).map((method) => ({\n id: `mcp.authorization.${method}`,\n scope,\n basePath: 'mcp',\n path: '/repository/authorize/{flowId}',\n method,\n authentication: 'owner' as const,\n description: method === 'GET' ? 'Read an authorization flow.' : 'Cancel an authorization flow.',\n parameters: RepositoryQuery,\n responses: jsonApiResponses(McpAuthorizationSchema),\n })),\n ]),\n ],\n});\nexport default apiContracts;\n","import { defineDoomPluginMethod } from '@agimon-ai/po-core/pluginProtocol';\nimport { Type } from 'typebox';\n\nexport type { McpAppOpenResult } from '../types/webMcp';\n\nconst Lease = Type.String({ minLength: 1, maxLength: 128 });\nconst JsonObject = Type.Record(Type.String(), Type.Unknown());\nconst Empty = Type.Object({}, { additionalProperties: false });\nconst Result = Type.Object({\n content: Type.Array(Type.Unknown()),\n structuredContent: Type.Optional(Type.Unknown()),\n _meta: Type.Optional(JsonObject),\n isError: Type.Optional(Type.Boolean()),\n});\nconst Address = { service: 'mcp.apps', scope: 'session', direction: 'client-to-server' } as const;\n\nexport const mcpAppOpenMethod = defineDoomPluginMethod({\n ...Address,\n method: 'open',\n input: Type.Object({ toolCallId: Type.String({ minLength: 1, maxLength: 512 }) }, { additionalProperties: false }),\n output: Type.Object({\n leaseId: Lease,\n html: Type.String(),\n resourceUri: Type.String(),\n protocol: Type.Union([Type.Literal('mcp'), Type.Literal('openai')]),\n resourceMeta: JsonObject,\n tool: Type.Object({\n name: Type.String(),\n description: Type.String(),\n inputSchema: Type.Object({ type: Type.Literal('object') }, { additionalProperties: true }),\n _meta: JsonObject,\n }),\n args: JsonObject,\n result: Result,\n state: Type.Unknown(),\n readOnly: Type.Boolean(),\n }),\n});\n\nexport const mcpAppActivateMethod = defineDoomPluginMethod({\n ...Address,\n method: 'activate',\n input: Type.Object({ leaseId: Lease }, { additionalProperties: false }),\n output: Type.Object({ readOnly: Type.Literal(false) }),\n});\nexport const mcpAppCallToolMethod = defineDoomPluginMethod({\n ...Address,\n method: 'callTool',\n input: Type.Object(\n { leaseId: Lease, name: Type.String({ minLength: 1, maxLength: 256 }), arguments: JsonObject },\n { additionalProperties: false },\n ),\n output: Result,\n});\nexport const mcpAppSetStateMethod = defineDoomPluginMethod({\n ...Address,\n method: 'setState',\n input: Type.Object({ leaseId: Lease, state: Type.Unknown() }, { additionalProperties: false }),\n output: Empty,\n});\nexport const mcpAppFollowUpMethod = defineDoomPluginMethod({\n ...Address,\n method: 'followUp',\n input: Type.Object(\n { leaseId: Lease, prompt: Type.String({ minLength: 1, maxLength: 16000 }) },\n { additionalProperties: false },\n ),\n output: Empty,\n});\nexport const mcpAppCloseMethod = defineDoomPluginMethod({\n ...Address,\n method: 'close',\n input: Type.Object({ leaseId: Lease }, { additionalProperties: false }),\n output: Empty,\n});\nexport const mcpAppMethods = [\n mcpAppOpenMethod,\n mcpAppActivateMethod,\n mcpAppCallToolMethod,\n mcpAppSetStateMethod,\n mcpAppFollowUpMethod,\n mcpAppCloseMethod,\n] as const;\n"],"mappings":";;;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OAAO;EAAE,SAAS;EAAO,OAAOA,QAAAA,KAAK,QAAQ;CAAE,GAAG,EAAE,sBAAsB,MAAM,CAAC;CAC7F,QAAQ;AACV,CAAC;AACD,MAAa,wBAAA,GAAuBC,kCAAAA,uBAAAA,CAAuB;CACzD,GAAG;CACH,QAAQ;CACR,OAAOD,QAAAA,KAAK,OACV;EAAE,SAAS;EAAO,QAAQA,QAAAA,KAAK,OAAO;GAAE,WAAW;GAAG,WAAW;EAAM,CAAC;CAAE,GAC1E,EAAE,sBAAsB,MAAM,CAChC;CACA,QAAQ;AACV,CAAC;AACD,MAAa,qBAAA,GAAoBC,kCAAAA,uBAAAA,CAAuB;CACtD,GAAG;CACH,QAAQ;CACR,OAAOD,QAAAA,KAAK,OAAO,EAAE,SAAS,MAAM,GAAG,EAAE,sBAAsB,MAAM,CAAC;CACtE,QAAQ;AACV,CAAC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { Type } from "typebox";
|
|
2
|
+
import "@agimon-ai/po-core/contextApi";
|
|
3
|
+
import "@modelcontextprotocol/server";
|
|
4
|
+
//#region src/schemas/apiContracts.d.ts
|
|
5
|
+
export declare const apiContracts: {
|
|
6
|
+
version: 1;
|
|
7
|
+
protocols?: Record<string, string> | undefined;
|
|
8
|
+
schemas?: Record<string, boolean | object> | undefined;
|
|
9
|
+
http: {
|
|
10
|
+
id: string;
|
|
11
|
+
scope: "global" | "session" | "workspace";
|
|
12
|
+
basePath?: string | undefined;
|
|
13
|
+
path: string;
|
|
14
|
+
method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
|
|
15
|
+
description: string;
|
|
16
|
+
availability?: string | undefined;
|
|
17
|
+
authentication: "device" | "none" | "owner";
|
|
18
|
+
parameters?: {
|
|
19
|
+
name: string;
|
|
20
|
+
in: "header" | "path" | "query";
|
|
21
|
+
required: boolean;
|
|
22
|
+
schema: boolean | object;
|
|
23
|
+
}[] | undefined;
|
|
24
|
+
body?: {
|
|
25
|
+
contentType: string;
|
|
26
|
+
contentTypes?: string[] | undefined;
|
|
27
|
+
required: boolean;
|
|
28
|
+
schema: boolean | object;
|
|
29
|
+
} | undefined;
|
|
30
|
+
responses: Record<string, {
|
|
31
|
+
description: string;
|
|
32
|
+
contentType?: string | undefined;
|
|
33
|
+
schema?: boolean | object | undefined;
|
|
34
|
+
events?: Record<string, boolean | object> | undefined;
|
|
35
|
+
}>;
|
|
36
|
+
}[];
|
|
37
|
+
sockets: {
|
|
38
|
+
id: string;
|
|
39
|
+
scope: "global" | "session" | "workspace";
|
|
40
|
+
description: string;
|
|
41
|
+
availability?: string | undefined;
|
|
42
|
+
service: string;
|
|
43
|
+
member: string;
|
|
44
|
+
direction: "client-to-server" | "server-to-client";
|
|
45
|
+
kind: "channel" | "method" | "state";
|
|
46
|
+
input: boolean | object;
|
|
47
|
+
output?: boolean | object | undefined;
|
|
48
|
+
errors?: boolean | object | undefined;
|
|
49
|
+
}[];
|
|
50
|
+
dynamic: string[];
|
|
51
|
+
gaps?: string[] | undefined;
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/types/webMcp.d.ts
|
|
55
|
+
/** Shared browser/server payload validated by the mcp.apps.open wire schema. */
|
|
56
|
+
interface McpAppOpenResult {
|
|
57
|
+
leaseId: string;
|
|
58
|
+
html: string;
|
|
59
|
+
resourceUri: string;
|
|
60
|
+
protocol: 'mcp' | 'openai';
|
|
61
|
+
resourceMeta: Record<string, unknown>;
|
|
62
|
+
tool: {
|
|
63
|
+
name: string;
|
|
64
|
+
description: string;
|
|
65
|
+
inputSchema: {
|
|
66
|
+
type: 'object';
|
|
67
|
+
[key: string]: unknown;
|
|
68
|
+
};
|
|
69
|
+
_meta: Record<string, unknown>;
|
|
70
|
+
};
|
|
71
|
+
args: Record<string, unknown>;
|
|
72
|
+
result: {
|
|
73
|
+
content: unknown[];
|
|
74
|
+
structuredContent?: unknown;
|
|
75
|
+
_meta?: Record<string, unknown>;
|
|
76
|
+
isError?: boolean;
|
|
77
|
+
};
|
|
78
|
+
state: unknown;
|
|
79
|
+
readOnly: boolean;
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/schemas/mcpApps.d.ts
|
|
83
|
+
export declare const mcpAppOpenMethod: import("@agimon-ai/po-core/pluginProtocol").DoomPluginMethod<Type.TObject<{
|
|
84
|
+
toolCallId: Type.TString;
|
|
85
|
+
}>, Type.TObject<{
|
|
86
|
+
leaseId: Type.TString;
|
|
87
|
+
html: Type.TString;
|
|
88
|
+
resourceUri: Type.TString;
|
|
89
|
+
protocol: Type.TUnion<[Type.TLiteral<"mcp">, Type.TLiteral<"openai">]>;
|
|
90
|
+
resourceMeta: Type.TRecord<"^.*$", Type.TUnknown>;
|
|
91
|
+
tool: Type.TObject<{
|
|
92
|
+
name: Type.TString;
|
|
93
|
+
description: Type.TString;
|
|
94
|
+
inputSchema: Type.TObject<{
|
|
95
|
+
type: Type.TLiteral<"object">;
|
|
96
|
+
}>;
|
|
97
|
+
_meta: Type.TRecord<"^.*$", Type.TUnknown>;
|
|
98
|
+
}>;
|
|
99
|
+
args: Type.TRecord<"^.*$", Type.TUnknown>;
|
|
100
|
+
result: Type.TObject<{
|
|
101
|
+
content: Type.TArray<Type.TUnknown>;
|
|
102
|
+
structuredContent: Type.TOptional<Type.TUnknown>;
|
|
103
|
+
_meta: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
|
|
104
|
+
isError: Type.TOptional<Type.TBoolean>;
|
|
105
|
+
}>;
|
|
106
|
+
state: Type.TUnknown;
|
|
107
|
+
readOnly: Type.TBoolean;
|
|
108
|
+
}>>;
|
|
109
|
+
export declare const mcpAppActivateMethod: import("@agimon-ai/po-core/pluginProtocol").DoomPluginMethod<Type.TObject<{
|
|
110
|
+
leaseId: Type.TString;
|
|
111
|
+
}>, Type.TObject<{
|
|
112
|
+
readOnly: Type.TLiteral<false>;
|
|
113
|
+
}>>;
|
|
114
|
+
export declare const mcpAppCallToolMethod: import("@agimon-ai/po-core/pluginProtocol").DoomPluginMethod<Type.TObject<{
|
|
115
|
+
leaseId: Type.TString;
|
|
116
|
+
name: Type.TString;
|
|
117
|
+
arguments: Type.TRecord<"^.*$", Type.TUnknown>;
|
|
118
|
+
}>, Type.TObject<{
|
|
119
|
+
content: Type.TArray<Type.TUnknown>;
|
|
120
|
+
structuredContent: Type.TOptional<Type.TUnknown>;
|
|
121
|
+
_meta: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
|
|
122
|
+
isError: Type.TOptional<Type.TBoolean>;
|
|
123
|
+
}>>;
|
|
124
|
+
export declare const mcpAppSetStateMethod: import("@agimon-ai/po-core/pluginProtocol").DoomPluginMethod<Type.TObject<{
|
|
125
|
+
leaseId: Type.TString;
|
|
126
|
+
state: Type.TUnknown;
|
|
127
|
+
}>, Type.TObject<{}>>;
|
|
128
|
+
export declare const mcpAppFollowUpMethod: import("@agimon-ai/po-core/pluginProtocol").DoomPluginMethod<Type.TObject<{
|
|
129
|
+
leaseId: Type.TString;
|
|
130
|
+
prompt: Type.TString;
|
|
131
|
+
}>, Type.TObject<{}>>;
|
|
132
|
+
export declare const mcpAppCloseMethod: import("@agimon-ai/po-core/pluginProtocol").DoomPluginMethod<Type.TObject<{
|
|
133
|
+
leaseId: Type.TString;
|
|
134
|
+
}>, Type.TObject<{}>>;
|
|
135
|
+
//#endregion
|
|
136
|
+
export { type McpAppOpenResult, apiContracts as default };
|
|
137
|
+
//# sourceMappingURL=apiContracts.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts","../src/types/webMcp.ts","../src/schemas/mcpApps.ts"],"mappings":";;;;qBAiDa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UCvCI;EACf;EACA;EACA;EACA;EACA,cAAc;EACd;IACE;IACA;IACA;MAAe;OAAiB;;IAChC,OAAO;;EAET,MAAM;EACN;IAAU;IAAoB;IAA6B,QAAQ;IAAyB;;EAC5F;EACA;;;;qBCTW,8DAAgB,iBAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;qBAuBhB,kEAAoB,iBAAA,KAAA;;;;;qBAMpB,kEAAoB,iBAAA,KAAA;;;;;;;;;;qBASpB,kEAAoB,iBAAA,KAAA;;;IAK/B,KAAA;qBACW,kEAAoB,iBAAA,KAAA;;;IAQ/B,KAAA;qBACW,+DAAiB,iBAAA,KAAA;;IAK5B,KAAA"}
|