@jini-ai/mcp 0.4.1 → 0.4.2
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/CHANGELOG.md +6 -0
- package/dist/core/oauth.d.ts +274 -0
- package/dist/core/oauth.js +667 -0
- package/dist/core/secure-write.d.ts +17 -0
- package/dist/core/secure-write.js +72 -0
- package/dist/federation/ports.d.ts +25 -0
- package/dist/federation/ports.js +19 -0
- package/dist/federation/testing/adapter.memory.d.ts +4 -3
- package/dist/federation/testing/adapter.memory.js +3 -2
- package/dist/federation/testing/tool-approvals.memory.js +8 -0
- package/dist/federation/tool-approvals.d.ts +3 -0
- package/dist/index.d.ts +4 -175
- package/dist/index.js +4 -178
- package/dist/server/daemon-client.d.ts +2 -3
- package/dist/server/daemon-client.js +8 -27
- package/dist/server/resources/active-resource.d.ts +1 -2
- package/dist/server/resources/active-resource.js +4 -24
- package/dist/server/tool-server.d.ts +5 -23
- package/dist/server/tool-server.js +1 -1
- package/dist/server/tools/run-tools.js +3 -12
- package/package.json +22 -3
|
@@ -3,8 +3,7 @@ import type { McpResourceDef } from '../resource-protocol.js';
|
|
|
3
3
|
* `jini://active` -> `GET /api/active`. Returns the raw daemon payload as formatted JSON text,
|
|
4
4
|
* unchanged — unlike `getActiveContextTool`, this does not add a conversational hint when
|
|
5
5
|
* `active:false`; a resource is meant to be raw structured data a client attaches to context, not
|
|
6
|
-
* a model-facing tool result
|
|
7
|
-
* returned the raw `/api/active` body with no special-casing).
|
|
6
|
+
* a model-facing tool result.
|
|
8
7
|
*/
|
|
9
8
|
export declare const activeContextResource: McpResourceDef;
|
|
10
9
|
/** The full set of kernel resource defs this package ships, ready to pass as `createMcpToolServer`'s `resources` option. */
|
|
@@ -1,27 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module @jini-ai/mcp/server/resources/active-resource
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* — the same underlying data `../tools/run-tools.js`'s `getActiveContextTool`
|
|
7
|
-
* already proxies as a *tool*. This is not redundant: OD's origin
|
|
8
|
-
* (`apps/daemon/src/mcp.ts`) exposed the identical `/api/active` payload
|
|
9
|
-
* both ways — as the `get_active_context` tool (already ported, see
|
|
10
|
-
* `../tools/run-tools.js`) AND as the `od://focus/active` resource (its
|
|
11
|
-
* `ListResourcesRequestSchema`/`ReadResourceRequestSchema` handlers) —
|
|
12
|
-
* because tools and resources serve different MCP client affordances: a
|
|
13
|
-
* tool is invoked by the model mid-conversation, while a resource can be
|
|
14
|
-
* listed and attached to context by the user/client without any tool call.
|
|
15
|
-
* This module is that second affordance for the same primitive. See
|
|
16
|
-
* `archived provenance ledger`'s 2026-07-21 addition for why the rest of OD's resource
|
|
17
|
-
* surface (`od://skills/...`, `od://design-systems/...`) was NOT ported the
|
|
18
|
-
* same way (both require a Skill/DesignSystem noun this kernel doesn't have).
|
|
19
|
-
*
|
|
20
|
-
* Security posture matches every other tool/resource in this package: no
|
|
21
|
-
* separate authorization mechanism here — whatever `@jini-ai/http-kit`'s
|
|
22
|
-
* same-origin guard / bearer-auth middleware already enforces on
|
|
23
|
-
* `GET /api/active` is the only gate a read of this resource passes
|
|
24
|
-
* through.
|
|
3
|
+
* Read-only active-context resource over GET /api/active. Tools let the model request data during
|
|
4
|
+
* a conversation; resources let clients list and attach that data without invoking a tool.
|
|
5
|
+
* Target-route same-origin and bearer-auth gates remain authoritative, as for the proxy tools.
|
|
25
6
|
*/
|
|
26
7
|
import { getDaemonJson } from '../daemon-client.js';
|
|
27
8
|
import { daemonCallOptions } from '../tool-protocol.js';
|
|
@@ -29,8 +10,7 @@ import { daemonCallOptions } from '../tool-protocol.js';
|
|
|
29
10
|
* `jini://active` -> `GET /api/active`. Returns the raw daemon payload as formatted JSON text,
|
|
30
11
|
* unchanged — unlike `getActiveContextTool`, this does not add a conversational hint when
|
|
31
12
|
* `active:false`; a resource is meant to be raw structured data a client attaches to context, not
|
|
32
|
-
* a model-facing tool result
|
|
33
|
-
* returned the raw `/api/active` body with no special-casing).
|
|
13
|
+
* a model-facing tool result.
|
|
34
14
|
*/
|
|
35
15
|
export const activeContextResource = {
|
|
36
16
|
uri: 'jini://active',
|
|
@@ -1,28 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module @jini-ai/mcp/server/tool-server
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* hardcoded 18-tool `TOOL_DEFS`, the `od://` resource scheme, the
|
|
9
|
-
* project/skill/plugin `instructions` prose — replaced by a caller-supplied,
|
|
10
|
-
* bounded, explicit `tools: readonly McpToolDef[]` list. A caller is the
|
|
11
|
-
* *first* user of this mechanism, not the only one it will ever support (see
|
|
12
|
-
* `archived provenance ledger`'s 2026-07-21 addition for the full design-decision note).
|
|
13
|
-
*
|
|
14
|
-
* `tools` capability is always advertised (`capabilities: {tools: {}}`).
|
|
15
|
-
* `resources` capability (`ListResourcesRequestSchema`/
|
|
16
|
-
* `ReadResourceRequestSchema`, mirroring the tools wiring one section down)
|
|
17
|
-
* is advertised only when the caller supplies at least one entry in the
|
|
18
|
-
* optional `resources` option — a 2026-07-21 addition once this package
|
|
19
|
-
* shipped its first genuinely portable resource (`../resources/
|
|
20
|
-
* active-resource.js`'s `jini://active`, see that file's module doc and
|
|
21
|
-
* `archived provenance ledger`'s 2026-07-21 addition for why the *rest* of OD's resource
|
|
22
|
-
* surface — `od://skills/...`, `od://design-systems/...` — still has no
|
|
23
|
-
* kernel equivalent and stays unported). A caller passing no `resources`
|
|
24
|
-
* gets the exact same `capabilities: {tools: {}}`-only server this module
|
|
25
|
-
* always produced.
|
|
3
|
+
* Generic stdio hosting for an explicit caller-supplied tool list. Construction validates unique
|
|
4
|
+
* names synchronously without I/O; run resolves the daemon URL, connects and serves until closure.
|
|
5
|
+
* Tools capability is always advertised; resources only when nonempty resources are supplied.
|
|
6
|
+
* Narrow object-shaped server/transport ports permit DI fakes without requiring SDK class instances
|
|
7
|
+
* with nominal private fields; default adapters translate those contracts to the real SDK.
|
|
26
8
|
*/
|
|
27
9
|
import type { Readable, Writable } from 'node:stream';
|
|
28
10
|
import type { McpTransportLike } from './ports.js';
|
|
@@ -5,7 +5,7 @@ import { CallToolRequestSchema, ListResourcesRequestSchema, ListToolsRequestSche
|
|
|
5
5
|
import { createMcpIdleExitController } from '../client/client.js';
|
|
6
6
|
import { buildResourceIndex, handleResourceRead, resourcesToList } from './resource-protocol.js';
|
|
7
7
|
import { buildToolIndex, handleToolCall, toolsToList } from './tool-protocol.js';
|
|
8
|
-
/** Auto-exit an idle server after this long
|
|
8
|
+
/** Auto-exit an idle server after this long without tool activity. */
|
|
9
9
|
const DEFAULT_IDLE_MS = 30 * 60 * 1000;
|
|
10
10
|
// SDK objects remain behind these adapters; hosts implement the object-shaped ports above.
|
|
11
11
|
function defaultCreateServer({ info, options }) {
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module @jini-ai/mcp/server/tools/run-tools
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* transport (`packages/http/src/runs.ts`) plus the generic active-resource
|
|
7
|
-
* channel (`packages/http/src/active-context.ts`) and the agent-def listing
|
|
8
|
-
* (`packages/http/src/agents.ts`). Each tool's `handler` does nothing but
|
|
9
|
-
* validate its own arguments and proxy a single HTTP call via
|
|
10
|
-
* `../daemon-client.js` — no separate authorization mechanism, no caching,
|
|
11
|
-
* no state: whatever `@jini-ai/http-kit`'s same-origin guard / bearer-auth
|
|
12
|
-
* middleware already enforces on the target route is the only gate a call
|
|
13
|
-
* here passes through (see `archived provenance ledger`'s 2026-07-21 addition for the
|
|
14
|
-
* full origin-mapping and what was deliberately not ported).
|
|
3
|
+
* Proxy tools for runs, active context and agent definitions. Each validates its arguments and
|
|
4
|
+
* delegates a single request to daemon-client; target-route same-origin and bearer-auth gates
|
|
5
|
+
* remain authoritative. See daemonCallOptions for shared auth and cancellation propagation.
|
|
15
6
|
*/
|
|
16
7
|
import { getDaemonJson, postDaemonJson } from '../daemon-client.js';
|
|
17
8
|
import { daemonCallOptions, requireString } from '../tool-protocol.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/mcp",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Model Context Protocol adapters: server config schema and IO, an MCP client, and agent-side MCP server installation.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -83,10 +83,29 @@
|
|
|
83
83
|
"registry": "https://registry.npmjs.org"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
+
"@jini-ai/core": "^0.4.2"
|
|
87
|
+
},
|
|
88
|
+
"peerDependencies": {
|
|
86
89
|
"@cfworker/json-schema": "^4.1.1",
|
|
87
|
-
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
88
90
|
"@jini-ai/platform": "^0.5.1",
|
|
89
|
-
"@
|
|
91
|
+
"@modelcontextprotocol/sdk": "^1.29.0"
|
|
92
|
+
},
|
|
93
|
+
"peerDependenciesMeta": {
|
|
94
|
+
"@cfworker/json-schema": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
97
|
+
"@jini-ai/platform": {
|
|
98
|
+
"optional": true
|
|
99
|
+
},
|
|
100
|
+
"@modelcontextprotocol/sdk": {
|
|
101
|
+
"optional": true
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"devDependencies": {
|
|
105
|
+
"@cfworker/json-schema": "^4.1.1",
|
|
106
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
107
|
+
"@jini-ai/core": "^0.4.2",
|
|
108
|
+
"@jini-ai/platform": "^0.5.2"
|
|
90
109
|
},
|
|
91
110
|
"scripts": {
|
|
92
111
|
"build": "tsc -p tsconfig.json && chmod +x dist/bin/serve.js",
|