@corbits/mcp 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +162 -28
- package/dist/auth/callback.d.ts +14 -0
- package/dist/auth/callback.js +79 -0
- package/dist/auth/challenge.d.ts +9 -0
- package/dist/auth/challenge.js +52 -0
- package/dist/auth/contracts.d.ts +18 -0
- package/dist/auth/contracts.js +19 -0
- package/dist/auth/http.d.ts +2 -0
- package/dist/auth/http.js +2 -0
- package/dist/auth/index.d.ts +6 -0
- package/dist/auth/index.js +6 -0
- package/dist/auth/login.d.ts +62 -0
- package/dist/auth/login.js +175 -0
- package/dist/auth/oauth-http.d.ts +6 -0
- package/dist/auth/oauth-http.js +32 -0
- package/dist/auth/resource-server.d.ts +25 -0
- package/dist/auth/resource-server.js +94 -0
- package/dist/auth/url-policy.d.ts +10 -0
- package/dist/auth/url-policy.js +35 -0
- package/dist/client/resource-budget.d.ts +1 -0
- package/dist/client/resource-budget.js +1 -0
- package/dist/client/transport.d.ts +10 -0
- package/dist/client/transport.js +1 -0
- package/dist/client.d.ts +208 -26
- package/dist/client.js +1128 -90
- package/dist/extensions/apps.d.ts +58 -0
- package/dist/extensions/apps.js +55 -0
- package/dist/extensions/elicitation.d.ts +18 -0
- package/dist/extensions/elicitation.js +55 -0
- package/dist/extensions/index.d.ts +5 -0
- package/dist/extensions/index.js +5 -0
- package/dist/extensions/maturity.d.ts +44 -0
- package/dist/extensions/maturity.js +24 -0
- package/dist/extensions/skills/contracts.d.ts +53 -0
- package/dist/extensions/skills/contracts.js +1 -0
- package/dist/extensions/skills/index.d.ts +52 -0
- package/dist/extensions/skills/index.js +402 -0
- package/dist/extensions/tasks/contracts.d.ts +39 -0
- package/dist/extensions/tasks/contracts.js +1 -0
- package/dist/extensions/tasks/file-store.d.ts +12 -0
- package/dist/extensions/tasks/file-store.js +152 -0
- package/dist/extensions/tasks/index.d.ts +82 -0
- package/dist/extensions/tasks/index.js +221 -0
- package/dist/extensions/tasks/record.d.ts +3 -0
- package/dist/extensions/tasks/record.js +37 -0
- package/dist/hub/discover.d.ts +5 -1
- package/dist/hub/discover.js +36 -13
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -2
- package/dist/interchange/client/capabilities.d.ts +4 -0
- package/dist/interchange/client/capabilities.js +53 -0
- package/dist/interchange/client/catalog.d.ts +14 -0
- package/dist/interchange/client/catalog.js +52 -0
- package/dist/interchange/client/contracts.d.ts +47 -0
- package/dist/interchange/client/contracts.js +1 -0
- package/dist/interchange/client/projection.d.ts +6 -0
- package/dist/interchange/client/projection.js +92 -0
- package/dist/interchange/client/skills.d.ts +16 -0
- package/dist/interchange/client/skills.js +87 -0
- package/dist/interchange/client.d.ts +8 -0
- package/dist/interchange/client.js +6 -0
- package/dist/interchange/server/contracts.d.ts +65 -0
- package/dist/interchange/server/contracts.js +1 -0
- package/dist/interchange/server.d.ts +5 -0
- package/dist/interchange/server.js +172 -0
- package/dist/naming.d.ts +2 -0
- package/dist/naming.js +7 -0
- package/dist/oauth-discovery.d.ts +107 -1
- package/dist/oauth-discovery.js +292 -56
- package/dist/protocol/content.d.ts +35 -0
- package/dist/protocol/content.js +64 -0
- package/dist/protocol/envelopes.d.ts +14 -0
- package/dist/protocol/envelopes.js +22 -0
- package/dist/protocol/errors.d.ts +26 -0
- package/dist/protocol/errors.js +31 -0
- package/dist/protocol/extensions.d.ts +34 -0
- package/dist/protocol/extensions.js +86 -0
- package/dist/protocol/headers.d.ts +12 -0
- package/dist/protocol/headers.js +128 -0
- package/dist/protocol/index.d.ts +11 -0
- package/dist/protocol/index.js +11 -0
- package/dist/protocol/json-schema.d.ts +8 -0
- package/dist/protocol/json-schema.js +152 -0
- package/dist/protocol/legacy.d.ts +12 -0
- package/dist/protocol/legacy.js +18 -0
- package/dist/protocol/methods.d.ts +116 -0
- package/dist/protocol/methods.js +78 -0
- package/dist/protocol/resource-budget.d.ts +9 -0
- package/dist/protocol/resource-budget.js +206 -0
- package/dist/protocol/schemas.d.ts +115 -0
- package/dist/protocol/schemas.js +553 -0
- package/dist/protocol/types.d.ts +295 -0
- package/dist/protocol/types.js +3 -0
- package/dist/protocol/ui.d.ts +3 -0
- package/dist/protocol/ui.js +18 -0
- package/dist/server/contracts.d.ts +67 -0
- package/dist/server/contracts.js +1 -0
- package/dist/server/errors.d.ts +6 -0
- package/dist/server/errors.js +21 -0
- package/dist/server/extensions.d.ts +7 -0
- package/dist/server/extensions.js +61 -0
- package/dist/server/fixtures.d.ts +2 -0
- package/dist/server/fixtures.js +34 -0
- package/dist/server/legacy.d.ts +9 -0
- package/dist/server/legacy.js +435 -0
- package/dist/server/tools.d.ts +17 -0
- package/dist/server/tools.js +93 -0
- package/dist/server.d.ts +14 -0
- package/dist/server.js +406 -0
- package/dist/sidecar-bundle.d.ts +7 -7
- package/dist/sidecar-bundle.js +36 -29
- package/dist/test-server.js +12 -3
- package/dist/tool.d.ts +8 -0
- package/dist/tool.js +35 -19
- package/dist/url.js +8 -3
- package/docs/conformance.md +135 -0
- package/docs/integration-status.md +100 -0
- package/docs/legacy-server.md +58 -0
- package/docs/migration.md +143 -0
- package/docs/public-api.md +105 -0
- package/examples/README.md +28 -0
- package/examples/standalone-client.ts +14 -0
- package/examples/standalone-server.ts +37 -0
- package/package.json +44 -9
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Public extension and authorization API
|
|
2
|
+
|
|
3
|
+
Status: integration followup, 2026-10-25. Factory exports are implemented and
|
|
4
|
+
installed behavior is tested; OAuth-core is an optional host peer.
|
|
5
|
+
|
|
6
|
+
| Entry | Public API |
|
|
7
|
+
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
8
|
+
| `@corbits/mcp/client` | Standalone client functions and wire types |
|
|
9
|
+
| `@corbits/mcp/server` | Server/provider factories, `createSkillPublisher`, skill contracts, `createTaskRuntime`, `validateTaskRecord`, task contracts, `createMcpResourceServerAuth`, auth policy/identity/options types |
|
|
10
|
+
| `@corbits/mcp/server/task-store` | `createFileTaskStore` (explicit filesystem entry only) |
|
|
11
|
+
| `@corbits/mcp/interchange/client` | Existing tool/server/host APIs plus `createSkillLoader`, `parseSkillFrontmatter`, `SKILL_LIMITS`, skill contracts |
|
|
12
|
+
| `@corbits/mcp/interchange/server` | Explicit selected host exposure contracts and providers |
|
|
13
|
+
| `@corbits/mcp` | Historical facade and guarded authorization APIs |
|
|
14
|
+
|
|
15
|
+
Facade changes add reexports only. No filesystem store is exported through a
|
|
16
|
+
neutral barrel. The file store requires a private host-owned directory and one
|
|
17
|
+
writer; stale-lock recovery requires proof the previous writer is dead.
|
|
18
|
+
|
|
19
|
+
## Dependency boundary and setup
|
|
20
|
+
|
|
21
|
+
OAuth-core is an optional peer (`^0.3.3`) and pinned development dependency
|
|
22
|
+
(0.3.3). Neutral client/server entries do not require it. Root and guarded OAuth
|
|
23
|
+
login users must explicitly install OAuth-core plus the root's agent/harness
|
|
24
|
+
peers (`@intx/harness` `^0.5.0`); this is a breaking change from automatic OAuth installation. Host/auth
|
|
25
|
+
packed fixtures explicitly install these dependencies. OAuth-core itself still
|
|
26
|
+
transitively installs DB/hub/Hono; that cost belongs to the opt-in host setup.
|
|
27
|
+
|
|
28
|
+
Resource-server URL validation now uses the neutral auth URL-policy seam. Its
|
|
29
|
+
errors retain the diagnostic `OAuthDiscoveryError` name/message/detail but are
|
|
30
|
+
not instances of OAuth-core's error class. OAuth-facing helpers translate to the
|
|
31
|
+
actual OAuth-core `OAuthDiscoveryError` class. Neutral consumers must not import
|
|
32
|
+
the optional OAuth implementation merely to perform an `instanceof` check.
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
npm install @corbits/mcp @corbits/oauth-core@0.3.3 @intx/agent@0.5.0 @intx/harness@0.5.0
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`@corbits/credential-http` is an optional peer (`^0.1.3`). Install
|
|
39
|
+
`@corbits/credential-http@0.1.3`. That release accepts `@intx/harness` and
|
|
40
|
+
`@intx/types` `^0.5.0`.
|
|
41
|
+
|
|
42
|
+
## Installed evidence
|
|
43
|
+
|
|
44
|
+
The final optional-peer tarball fixtures pass on Bun 1.4.2 and Node 24.22.1:
|
|
45
|
+
publisher bytes/metadata, task close/reopen/recovery without replay and principal
|
|
46
|
+
isolation, injected resource-auth verifier/challenge/metadata, skill verification
|
|
47
|
+
and refusal to activate without policy, historical facade identity, and guarded
|
|
48
|
+
OAuth PKCE/resource/cancellation. These are scoped fixture assertions, not live
|
|
49
|
+
OAuth interoperability, cryptographic-verifier certification or full conformance.
|
|
50
|
+
|
|
51
|
+
Package tests use ordinary npm installs (no peer omission), reject absent public
|
|
52
|
+
exports, assert unwanted dependencies are absent, and check both neutral module
|
|
53
|
+
graphs. These checks validate the dependency boundary; see [integration status](integration-status.md) for command evidence.
|
|
54
|
+
|
|
55
|
+
## Legacy public options and Apps gate
|
|
56
|
+
|
|
57
|
+
The server entry exposes `McpLegacyOptions` / `McpLegacyRevision`; the installed
|
|
58
|
+
legacy smoke exercises `createMcpServer({ legacy: ... })` for all three 2025
|
|
59
|
+
revisions. See [legacy-server.md](legacy-server.md) for bounds and deployment
|
|
60
|
+
requirements. Modern mode stays session-free by default.
|
|
61
|
+
|
|
62
|
+
Interchange Apps advertisement requires explicit `apps` bridge/support and
|
|
63
|
+
presentation, including sandbox renderer, CSP enforcement and authenticated
|
|
64
|
+
bridge support. Metadata-only presentation does not advertise Apps. The host
|
|
65
|
+
must implement the renderer and enforce these commitments.
|
|
66
|
+
|
|
67
|
+
## Guarded path versus external companion defects
|
|
68
|
+
|
|
69
|
+
**CL11479:** OAuth-core 0.3.0 stock BaseTokens/conversion/storage requires refresh
|
|
70
|
+
material even for valid access-token-only grants. Stock token POST follows
|
|
71
|
+
redirects and exposes raw response error bodies, and authorization extras can
|
|
72
|
+
overwrite protected state/PKCE. The guarded MCP login/session path supports
|
|
73
|
+
access-only tokens through honest host persistence, refuses redirects, sanitizes
|
|
74
|
+
errors and rejects protected overrides; it does not fix stock helpers.
|
|
75
|
+
|
|
76
|
+
Additional documented stock hub limits are DCR-only registration selection and
|
|
77
|
+
present-but-unadvertised `iss` not being checked on the stock callback path.
|
|
78
|
+
These integration limits are distinct from the exact CL11479 issue acceptance.
|
|
79
|
+
Use guarded preparation/session/callback seams rather than assuming the stock
|
|
80
|
+
provider/hub path has equivalent checks. OAuth-core already propagates resource
|
|
81
|
+
on code exchange and refresh; the local config-builder omission was fixed, not
|
|
82
|
+
an absent upstream feature.
|
|
83
|
+
|
|
84
|
+
**CL11480:** credential-http 0.1.0 ignored Request+init overrides in its Request
|
|
85
|
+
branch and permitted insecure configured credential destination schemes. Peer
|
|
86
|
+
`^0.1.3` accepts `@intx/harness` and `@intx/types` `^0.5.0`. Local hub
|
|
87
|
+
endpoint/redirect checks do not fix standalone external provider handles.
|
|
88
|
+
Upstream correction and host transport policy remain required; no external
|
|
89
|
+
package was patched here.
|
|
90
|
+
|
|
91
|
+
The source audit is recorded in `src/auth/INTEGRATION.md`; this public summary
|
|
92
|
+
keeps the relevant limits available in the packed docs. Production encrypted
|
|
93
|
+
storage/authority, live callback listeners, consent, actual cryptographic token
|
|
94
|
+
verification, egress/DNS policy and distributed durability remain host obligations.
|
|
95
|
+
|
|
96
|
+
## Verified Skills supported shapes
|
|
97
|
+
|
|
98
|
+
The verified Skills loader declines dynamic manifests. This refusal is permitted
|
|
99
|
+
by the pinned Skills specification; dynamic consumption is not a newly missing
|
|
100
|
+
mandatory capability or an expansion of this adapter's implementation scope.
|
|
101
|
+
The adapter requires a complete resource read containing exactly one text or
|
|
102
|
+
blob item whose URI matches the requested resource. Resource-read MRTR
|
|
103
|
+
(`input_required`) is unsupported by this verified adapter; generic client MRTR
|
|
104
|
+
support does not imply that the Skills adapter can fulfill it. These supported-
|
|
105
|
+
shape limits are separate from the approved decoded-size and integrity bounds.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
These examples use public entry points after building/installing the package.
|
|
4
|
+
|
|
5
|
+
- `standalone-client.ts`: discover and call an explicitly named remote tool.
|
|
6
|
+
- `standalone-server.ts`: intentionally public loopback echo server. Do not expose
|
|
7
|
+
sensitive operations with `auth: "public"`; install a validated auth policy and
|
|
8
|
+
explicit allowed origins when deploying an authenticated service.
|
|
9
|
+
- `../e2e/interchange.test.ts`: executable bidirectional example using installed
|
|
10
|
+
Interchange `defineTool`, `createToolRunner`, HTTP credential provider and
|
|
11
|
+
credential capability. It exposes one selected tool (not the entire bundle),
|
|
12
|
+
calls it through standalone MCP, consumes it back into a real tool factory,
|
|
13
|
+
and asserts schema/authorization/approval failures do not execute it. It does
|
|
14
|
+
not simulate an inference reactor or certify workflow/task lifecycle support.
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
bun run build
|
|
18
|
+
bun examples/standalone-server.ts
|
|
19
|
+
# In another terminal:
|
|
20
|
+
bun examples/standalone-client.ts http://127.0.0.1:3000/mcp echo
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
For an authenticated host, compose `createInterchangeProviders({ auth, exposures })`
|
|
24
|
+
into `createMcpServer({ serverInfo, auth, providers })`. Each exposure supplies a
|
|
25
|
+
host-bound tenant, operation resource/action, explicit approval callback and a
|
|
26
|
+
selected tool/agent/HTTP/workflow binding. Never derive identity or fixed tenant
|
|
27
|
+
paths from model arguments. See the [migration guide](../docs/migration.md) for
|
|
28
|
+
required host services and cancellation/durability limits.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { mcpCallTool, mcpConnect, mcpListTools } from "@corbits/mcp/client";
|
|
2
|
+
|
|
3
|
+
const url = process.argv[2];
|
|
4
|
+
const name = process.argv[3];
|
|
5
|
+
if (!url || !name) throw new Error("Usage: standalone-client.ts <url> <tool>");
|
|
6
|
+
const session = await mcpConnect(url);
|
|
7
|
+
console.log(await mcpListTools(url, { session }));
|
|
8
|
+
const result = await mcpCallTool(url, name, { text: "hello" }, { session });
|
|
9
|
+
if (result.resultType === "input_required" || result.resultType === "task") {
|
|
10
|
+
throw new Error(
|
|
11
|
+
"This minimal example has no elicitation or task host services",
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
console.log(result.content);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createMcpServer, createToolProviders } from "@corbits/mcp/server";
|
|
2
|
+
|
|
3
|
+
const server = createMcpServer({
|
|
4
|
+
serverInfo: { name: "public-loopback-echo", version: "1" },
|
|
5
|
+
auth: "public",
|
|
6
|
+
providers: createToolProviders(
|
|
7
|
+
[
|
|
8
|
+
{
|
|
9
|
+
definition: {
|
|
10
|
+
name: "echo",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: "object",
|
|
13
|
+
properties: { text: { type: "string" } },
|
|
14
|
+
required: ["text"],
|
|
15
|
+
additionalProperties: false,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
resource: "example:echo",
|
|
19
|
+
action: "invoke",
|
|
20
|
+
execute: (args) => ({
|
|
21
|
+
content: [{ type: "text", text: String(args.text) }],
|
|
22
|
+
}),
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
"public",
|
|
26
|
+
),
|
|
27
|
+
});
|
|
28
|
+
const http = Bun.serve({
|
|
29
|
+
hostname: "127.0.0.1",
|
|
30
|
+
port: 3000,
|
|
31
|
+
fetch: server.fetch,
|
|
32
|
+
});
|
|
33
|
+
console.log(new URL("/mcp", http.url).href);
|
|
34
|
+
process.once("SIGINT", () => {
|
|
35
|
+
http.stop(true);
|
|
36
|
+
void server.close();
|
|
37
|
+
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corbits/mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "MCP client
|
|
3
|
+
"version": "0.4.1",
|
|
4
|
+
"description": "MCP client, stateless server, and Interchange bridge over streamable HTTP.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"corbits",
|
|
7
7
|
"interchange",
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
"files": [
|
|
23
23
|
"dist",
|
|
24
24
|
"README.md",
|
|
25
|
-
"LICENSE"
|
|
25
|
+
"LICENSE",
|
|
26
|
+
"docs",
|
|
27
|
+
"examples"
|
|
26
28
|
],
|
|
27
29
|
"type": "module",
|
|
28
30
|
"sideEffects": false,
|
|
@@ -38,6 +40,26 @@
|
|
|
38
40
|
"./hub": {
|
|
39
41
|
"types": "./dist/hub/index.d.ts",
|
|
40
42
|
"default": "./dist/hub/index.js"
|
|
43
|
+
},
|
|
44
|
+
"./client": {
|
|
45
|
+
"types": "./dist/client.d.ts",
|
|
46
|
+
"default": "./dist/client.js"
|
|
47
|
+
},
|
|
48
|
+
"./server": {
|
|
49
|
+
"types": "./dist/server.d.ts",
|
|
50
|
+
"default": "./dist/server.js"
|
|
51
|
+
},
|
|
52
|
+
"./interchange/client": {
|
|
53
|
+
"types": "./dist/interchange/client.d.ts",
|
|
54
|
+
"default": "./dist/interchange/client.js"
|
|
55
|
+
},
|
|
56
|
+
"./interchange/server": {
|
|
57
|
+
"types": "./dist/interchange/server.d.ts",
|
|
58
|
+
"default": "./dist/interchange/server.js"
|
|
59
|
+
},
|
|
60
|
+
"./server/task-store": {
|
|
61
|
+
"types": "./dist/extensions/tasks/file-store.d.ts",
|
|
62
|
+
"default": "./dist/extensions/tasks/file-store.js"
|
|
41
63
|
}
|
|
42
64
|
},
|
|
43
65
|
"publishConfig": {
|
|
@@ -52,15 +74,18 @@
|
|
|
52
74
|
"format:check": "oxfmt --check",
|
|
53
75
|
"test": "bun test src --pass-with-no-tests",
|
|
54
76
|
"test:e2e": "bun test e2e",
|
|
55
|
-
"check": "bun run typecheck && bun run lint && bun run format:check && bun run test"
|
|
77
|
+
"check": "bun run typecheck && bun run lint && bun run format:check && bun run test",
|
|
78
|
+
"test:package": "bun test e2e/package.test.ts"
|
|
56
79
|
},
|
|
57
80
|
"dependencies": {
|
|
58
|
-
"@corbits/oauth-core": "^0.3.0",
|
|
59
81
|
"@intx/types": "^0.5.0",
|
|
60
|
-
"
|
|
82
|
+
"ajv": "^8.17.1",
|
|
83
|
+
"arktype": "^2.2.3",
|
|
84
|
+
"yaml": "2.8.1"
|
|
61
85
|
},
|
|
62
86
|
"devDependencies": {
|
|
63
|
-
"@corbits/credential-http": "0.1.
|
|
87
|
+
"@corbits/credential-http": "0.1.3",
|
|
88
|
+
"@corbits/oauth-core": "0.3.3",
|
|
64
89
|
"@intx/agent": "0.5.0",
|
|
65
90
|
"@intx/authz": "0.5.0",
|
|
66
91
|
"@intx/db": "0.5.0",
|
|
@@ -76,10 +101,11 @@
|
|
|
76
101
|
"zod": "4.6.5"
|
|
77
102
|
},
|
|
78
103
|
"peerDependencies": {
|
|
79
|
-
"@corbits/credential-http": "^0.1.
|
|
104
|
+
"@corbits/credential-http": "^0.1.3",
|
|
105
|
+
"@corbits/oauth-core": "^0.3.3",
|
|
80
106
|
"@intx/agent": "^0.5.0",
|
|
81
107
|
"@intx/db": "^0.5.0",
|
|
82
|
-
"@intx/harness": "^0.
|
|
108
|
+
"@intx/harness": "^0.5.0",
|
|
83
109
|
"@intx/hub-api": "^0.5.0",
|
|
84
110
|
"drizzle-orm": "^0.45.2",
|
|
85
111
|
"hono": "^4.11.9"
|
|
@@ -99,6 +125,15 @@
|
|
|
99
125
|
},
|
|
100
126
|
"hono": {
|
|
101
127
|
"optional": true
|
|
128
|
+
},
|
|
129
|
+
"@intx/agent": {
|
|
130
|
+
"optional": true
|
|
131
|
+
},
|
|
132
|
+
"@intx/harness": {
|
|
133
|
+
"optional": true
|
|
134
|
+
},
|
|
135
|
+
"@corbits/oauth-core": {
|
|
136
|
+
"optional": true
|
|
102
137
|
}
|
|
103
138
|
},
|
|
104
139
|
"engines": {
|