@mcpfn/core 0.0.5 → 0.0.7
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 +23 -4
- package/dist/index.cjs +4714 -1286
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +59 -6
- package/dist/index.d.ts +59 -6
- package/dist/index.js +4731 -1282
- package/dist/index.js.map +1 -1
- package/package.json +28 -13
package/README.md
CHANGED
|
@@ -167,7 +167,7 @@ events. It is observational: a sink failure cannot fail or change a request.
|
|
|
167
167
|
|
|
168
168
|
Use `registerResource`, `registerResourceTemplate`, and `registerPrompt` on the same registry. Resource-template and prompt completers advertise the completions capability automatically. Resource subscription handlers advertise `resources.subscribe`. List calls use stable `mcpfn:<offset>` cursors and a configurable server page size.
|
|
169
169
|
|
|
170
|
-
Task support is declared with `execution.taskSupport` and a `taskHandler`; a task-capable server must receive an official SDK `TaskStore`. `server.listRoots()`, `server.sample()`, and `server.elicit()` invoke matching client capabilities. Declare required client features in `clientRequirements` so manifests and host-profile tests can reject incompatible hosts before deployment.
|
|
170
|
+
Task support is declared with `execution.taskSupport` and a `taskHandler`; a task-capable server must receive an official SDK `TaskStore`. `server.listRoots()`, `server.sample()`, and `server.elicit()` invoke matching client capabilities over a transport connected with `server.connect()`. Behind `createWebStandardHandler()`, each request or session is served by its own isolated server, so tool handlers call `server.listRootsForRequest(extra)`, `server.sampleForRequest(extra, ...)` and `server.elicitForRequest(extra, ...)` with the handler's `extra`; the plain methods throw `MCPFN_CLIENT_REQUEST_NEEDS_REQUEST` there. Server notifications never leak one client's data to other sessions: `sendLoggingMessage(params)` reaches only the transport connected with `server.connect()`, and `sendLoggingMessage(params, sessionId)` reaches only the client with that session id (tool handlers pass `extra.sessionId`; stateless handlers log through `extra.sendNotification`). `sendResourceUpdated()` reaches the directly connected transport and only those `createWebStandardHandler()` sessions that hold a successful `resources/subscribe` for that exact URI, until they unsubscribe or the session closes (an unsubscribe also cancels a subscribe for that URI that is still running). `sendToolListChanged()`, `sendResourceListChanged()` and `sendPromptListChanged()` carry no data and reach every connected client. Declare required client features in `clientRequirements` so manifests and host-profile tests can reject incompatible hosts before deployment.
|
|
171
171
|
|
|
172
172
|
`createWebStandardHandler()` accepts the official SDK `HandleRequestOptions`, including validated `authInfo`. Use `@mcpfn/auth` to publish OAuth protected-resource metadata and produce that trusted value. In stateless mode, McpFn creates and disposes an isolated SDK server and transport for every request. Attach protocol instrumentation with `configureRequestServer`; it receives the live isolated server before transport connection and runs once per request, or once per session initialization attempt. Because configuration precedes SDK request validation, a rejected attempt can invoke the hook without retaining a session. Supply a cryptographically secure `sessionIdGenerator` when the server uses sampling, elicitation, or another server-to-client request that must be correlated across HTTP requests; session-enabled handlers retain their transport across the session.
|
|
173
173
|
|
|
@@ -208,9 +208,12 @@ The MCP-required root `type: "object"` is permitted; place other assertions on
|
|
|
208
208
|
the referenced target. Later-draft keywords and unknown extensions ignored by
|
|
209
209
|
the registry's draft-07 Ajv may remain beside `$ref`.
|
|
210
210
|
|
|
211
|
-
Structural diagnostics
|
|
212
|
-
|
|
213
|
-
|
|
211
|
+
Structural diagnostics are bounded: a result carries at most 100 issues;
|
|
212
|
+
property names, keywords and messages are cut to 256 characters; and instance or
|
|
213
|
+
schema paths longer than 256 characters are reported as the root (`/`, `#`).
|
|
214
|
+
Any issue shortened this way has `truncated: true`, so consumers can tell an
|
|
215
|
+
exact name or path from a bounded one. Report sinks that aggregate many issues
|
|
216
|
+
should still apply their own size cap.
|
|
214
217
|
|
|
215
218
|
Task profile evidence distinguishes the creation handler from result persistence.
|
|
216
219
|
`handler` reports the creation callback's outcome; `task-result-storage: failed`
|
|
@@ -220,3 +223,19 @@ not reverse handler success or claim a final task status. Output validation stil
|
|
|
220
223
|
runs for each attempted result before persistence.
|
|
221
224
|
|
|
222
225
|
Lifecycle evidence retains only recognized framework error codes; application-defined codes become `MCPFN_TOOL_ERROR`. Protocol error responses preserve the original application code and details.
|
|
226
|
+
|
|
227
|
+
## Supported Node runtimes
|
|
228
|
+
|
|
229
|
+
Core supports Node 18.18 and later. The SDK's web-standard HTTP transport requires
|
|
230
|
+
`globalThis.crypto.randomUUID`; on Node 18 enable global WebCrypto before starting
|
|
231
|
+
HTTP handlers, for example `NODE_OPTIONS=--experimental-global-webcrypto node app.mjs`.
|
|
232
|
+
Node 20 provides this global by default. This prerequisite also applies to the
|
|
233
|
+
previous SDK version; schema validation and in-memory transport do not require it.
|
|
234
|
+
`@superfunctions/admin` requires Node 20 or later.
|
|
235
|
+
|
|
236
|
+
After building core and shared admin, run
|
|
237
|
+
`node mcpfn/core/scripts/packed-runtime-acceptance.mjs` from the repository root to
|
|
238
|
+
pack both packages, install them in a disposable consumer, audit production
|
|
239
|
+
dependencies, and exercise ESM/CJS validation and MCP transport. Set `NODE18` and
|
|
240
|
+
`NODE20` to additional runtime executables. Set the WebCrypto `NODE_OPTIONS` flag
|
|
241
|
+
when testing Node 18 HTTP. The consumer directory is removed afterward.
|