@mcpfn/core 0.0.1 → 0.0.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/README.md +11 -0
- package/dist/index.cjs +2228 -2145
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +49 -23
- package/dist/index.d.ts +49 -23
- package/dist/index.js +2239 -2159
- package/dist/index.js.map +1 -1
- package/package.json +3 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ServerCapabilities, ToolAnnotations, ToolExecution, Icon, Resource, ResourceTemplate, PromptArgument, Annotations, ServerRequest, ServerNotification, ReadResourceResult, ElicitRequestFormParams, ElicitRequestURLParams, ElicitResult, Tool, GetPromptResult, CompleteResult, CallToolResult, CreateTaskResult, ListResourcesResult, ListRootsResult, CreateMessageRequest, CreateMessageResult, CreateMessageResultWithTools, Implementation,
|
|
1
|
+
import { ServerCapabilities, ToolAnnotations, ToolExecution, Icon, Resource, ResourceTemplate, PromptArgument, Annotations, ServerRequest, ServerNotification, ReadResourceResult, ElicitRequestFormParams, ElicitRequestURLParams, ElicitResult, Tool, GetPromptResult, CompleteResult, CallToolResult, CreateTaskResult, ListResourcesResult, ListRootsResult, CreateMessageRequest, CreateMessageResult, CreateMessageResultWithTools, Implementation, LoggingMessageNotification, ResourceUpdatedNotification, ContentBlock } from '@modelcontextprotocol/sdk/types.js';
|
|
2
2
|
import { RequestHandlerExtra, RequestOptions, RequestTaskStore } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
3
3
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
4
4
|
import { WebStandardStreamableHTTPServerTransport, HandleRequestOptions } from '@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js';
|
|
@@ -276,24 +276,6 @@ declare function canonicalize(value: unknown): unknown;
|
|
|
276
276
|
declare function canonicalJson(value: unknown): string;
|
|
277
277
|
declare function sha256(value: unknown): string;
|
|
278
278
|
|
|
279
|
-
declare function diffManifests(before: McpFnManifest, after: McpFnManifest): McpFnDiffResult;
|
|
280
|
-
|
|
281
|
-
declare function jsonSafe(value: unknown): unknown;
|
|
282
|
-
declare class McpFnError extends Error {
|
|
283
|
-
readonly code: string;
|
|
284
|
-
readonly details?: unknown;
|
|
285
|
-
constructor(code: string, message: string, details?: unknown);
|
|
286
|
-
}
|
|
287
|
-
declare class McpFnValidationError extends McpFnError {
|
|
288
|
-
constructor(message: string, details?: unknown);
|
|
289
|
-
}
|
|
290
|
-
declare class McpFnOutputValidationError extends McpFnError {
|
|
291
|
-
constructor(message: string, details?: unknown);
|
|
292
|
-
}
|
|
293
|
-
declare function errorResult(error: unknown, options?: {
|
|
294
|
-
includeStructuredContent?: boolean;
|
|
295
|
-
}): CallToolResult;
|
|
296
|
-
|
|
297
279
|
interface CreateManifestOptions {
|
|
298
280
|
protocolVersions?: string[];
|
|
299
281
|
transports?: Array<"stdio" | "streamable-http">;
|
|
@@ -304,9 +286,6 @@ interface CreateManifestOptions {
|
|
|
304
286
|
declare function createManifest<TContext>(info: McpFnServerInfo, registry: McpFnRegistry<TContext>, options?: CreateManifestOptions): McpFnManifest;
|
|
305
287
|
declare function validateManifest(value: unknown): McpFnManifest;
|
|
306
288
|
|
|
307
|
-
declare function textResult(text: string): CallToolResult;
|
|
308
|
-
declare function structuredResult(structuredContent: Record<string, unknown>, content?: ContentBlock[]): CallToolResult;
|
|
309
|
-
|
|
310
289
|
interface McpFnToolVisibilityInput<TContext> {
|
|
311
290
|
tool: McpFnListedTool;
|
|
312
291
|
context: TContext;
|
|
@@ -331,6 +310,8 @@ interface McpFnServerOptions<TContext> extends CreateManifestOptions {
|
|
|
331
310
|
maxTaskQueueSize?: number;
|
|
332
311
|
enforceStrictCapabilities?: boolean;
|
|
333
312
|
}
|
|
313
|
+
/** Resolve the exact protocol/manifest capabilities from one registry contract. */
|
|
314
|
+
declare function resolveMcpFnServerCapabilities<TContext>(registry: McpFnRegistry<TContext>, additionalCapabilities: ServerCapabilities | undefined, includeTaskOperations: boolean): ServerCapabilities;
|
|
334
315
|
declare class McpFnServer<TContext = undefined> {
|
|
335
316
|
readonly registry: McpFnRegistry<TContext>;
|
|
336
317
|
readonly info: McpFnServerInfo;
|
|
@@ -363,4 +344,49 @@ declare class McpFnServer<TContext = undefined> {
|
|
|
363
344
|
}
|
|
364
345
|
declare function createMcpFnServer<TContext = undefined>(options: McpFnServerOptions<TContext>): McpFnServer<TContext>;
|
|
365
346
|
|
|
366
|
-
|
|
347
|
+
interface McpFnServerDeclarationOptions<TContext = undefined> extends CreateManifestOptions {
|
|
348
|
+
info: McpFnServerInfo;
|
|
349
|
+
tools?: McpFnToolDefinition<TContext>[];
|
|
350
|
+
resources?: McpFnResourceDefinition<TContext>[];
|
|
351
|
+
resourceTemplates?: McpFnResourceTemplateDefinition<TContext>[];
|
|
352
|
+
prompts?: McpFnPromptDefinition<TContext>[];
|
|
353
|
+
/** Reuse an existing registry while adopting the declaration/runtime split. */
|
|
354
|
+
registry?: McpFnRegistry<TContext>;
|
|
355
|
+
}
|
|
356
|
+
type McpFnServerRuntimeOptions<TContext> = Omit<McpFnServerOptions<TContext>, "info" | "registry" | "additionalCapabilities" | keyof CreateManifestOptions>;
|
|
357
|
+
/**
|
|
358
|
+
* Side-effect-free application declaration. The same registry and manifest
|
|
359
|
+
* feed production transports, deterministic tests, and release tooling.
|
|
360
|
+
*/
|
|
361
|
+
declare class McpFnServerDeclaration<TContext = undefined> {
|
|
362
|
+
readonly info: McpFnServerInfo;
|
|
363
|
+
readonly registry: McpFnRegistry<TContext>;
|
|
364
|
+
private readonly manifestOptions;
|
|
365
|
+
constructor(options: McpFnServerDeclarationOptions<TContext>);
|
|
366
|
+
manifest(): McpFnManifest;
|
|
367
|
+
createServer(runtime?: McpFnServerRuntimeOptions<TContext>): McpFnServer<TContext>;
|
|
368
|
+
}
|
|
369
|
+
declare function defineMcpFnServer<TContext = undefined>(options: McpFnServerDeclarationOptions<TContext>): McpFnServerDeclaration<TContext>;
|
|
370
|
+
|
|
371
|
+
declare function diffManifests(before: McpFnManifest, after: McpFnManifest): McpFnDiffResult;
|
|
372
|
+
|
|
373
|
+
declare function jsonSafe(value: unknown): unknown;
|
|
374
|
+
declare class McpFnError extends Error {
|
|
375
|
+
readonly code: string;
|
|
376
|
+
readonly details?: unknown;
|
|
377
|
+
constructor(code: string, message: string, details?: unknown);
|
|
378
|
+
}
|
|
379
|
+
declare class McpFnValidationError extends McpFnError {
|
|
380
|
+
constructor(message: string, details?: unknown);
|
|
381
|
+
}
|
|
382
|
+
declare class McpFnOutputValidationError extends McpFnError {
|
|
383
|
+
constructor(message: string, details?: unknown);
|
|
384
|
+
}
|
|
385
|
+
declare function errorResult(error: unknown, options?: {
|
|
386
|
+
includeStructuredContent?: boolean;
|
|
387
|
+
}): CallToolResult;
|
|
388
|
+
|
|
389
|
+
declare function textResult(text: string): CallToolResult;
|
|
390
|
+
declare function structuredResult(structuredContent: Record<string, unknown>, content?: ContentBlock[]): CallToolResult;
|
|
391
|
+
|
|
392
|
+
export { type CreateManifestOptions, MCP_APP_EXTENSION_ID, MCP_APP_MIME_TYPE, type McpAppCsp, type McpAppPermissions, type McpAppResourceMetadata, type McpAppResourceOptions, type McpAppToolMetadata, type McpFnChangeSeverity, type McpFnClientRequestOptions, type McpFnContractChange, type McpFnDiffResult, type McpFnElicitationParams, type McpFnElicitationResult, McpFnError, type McpFnJsonSchema, type McpFnListedResource, type McpFnListedResourceTemplate, type McpFnListedTool, type McpFnManifest, type McpFnManifestPrompt, type McpFnManifestResource, type McpFnManifestResourceTemplate, type McpFnManifestTool, type McpFnObjectSchema, McpFnOutputValidationError, type McpFnPromptDefinition, McpFnRegistry, type McpFnRequestExtra, type McpFnResourceDefinition, type McpFnResourceTemplateDefinition, type McpFnRootsResult, type McpFnSamplingParams, type McpFnSamplingResult, McpFnServer, McpFnServerDeclaration, type McpFnServerDeclarationOptions, type McpFnServerInfo, type McpFnServerOptions, type McpFnServerRuntimeOptions, type McpFnTaskHandler, type McpFnTaskRequestExtra, type McpFnToolDefinition, type McpFnToolVisibilityInput, McpFnValidationError, assertMcpAppContracts, assertPromptSchemaSupportsStringValues, canonicalJson, canonicalize, compareCodeUnits, createManifest, createMcpAppResource, createMcpFnServer, defineMcpFnServer, diffManifests, errorResult, jsonSafe, mcpAppToolMetadata, promptArguments, resolveMcpFnServerCapabilities, schemaPromptArguments, sha256, structuredResult, textResult, validateManifest };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ServerCapabilities, ToolAnnotations, ToolExecution, Icon, Resource, ResourceTemplate, PromptArgument, Annotations, ServerRequest, ServerNotification, ReadResourceResult, ElicitRequestFormParams, ElicitRequestURLParams, ElicitResult, Tool, GetPromptResult, CompleteResult, CallToolResult, CreateTaskResult, ListResourcesResult, ListRootsResult, CreateMessageRequest, CreateMessageResult, CreateMessageResultWithTools, Implementation,
|
|
1
|
+
import { ServerCapabilities, ToolAnnotations, ToolExecution, Icon, Resource, ResourceTemplate, PromptArgument, Annotations, ServerRequest, ServerNotification, ReadResourceResult, ElicitRequestFormParams, ElicitRequestURLParams, ElicitResult, Tool, GetPromptResult, CompleteResult, CallToolResult, CreateTaskResult, ListResourcesResult, ListRootsResult, CreateMessageRequest, CreateMessageResult, CreateMessageResultWithTools, Implementation, LoggingMessageNotification, ResourceUpdatedNotification, ContentBlock } from '@modelcontextprotocol/sdk/types.js';
|
|
2
2
|
import { RequestHandlerExtra, RequestOptions, RequestTaskStore } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
3
3
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
4
4
|
import { WebStandardStreamableHTTPServerTransport, HandleRequestOptions } from '@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js';
|
|
@@ -276,24 +276,6 @@ declare function canonicalize(value: unknown): unknown;
|
|
|
276
276
|
declare function canonicalJson(value: unknown): string;
|
|
277
277
|
declare function sha256(value: unknown): string;
|
|
278
278
|
|
|
279
|
-
declare function diffManifests(before: McpFnManifest, after: McpFnManifest): McpFnDiffResult;
|
|
280
|
-
|
|
281
|
-
declare function jsonSafe(value: unknown): unknown;
|
|
282
|
-
declare class McpFnError extends Error {
|
|
283
|
-
readonly code: string;
|
|
284
|
-
readonly details?: unknown;
|
|
285
|
-
constructor(code: string, message: string, details?: unknown);
|
|
286
|
-
}
|
|
287
|
-
declare class McpFnValidationError extends McpFnError {
|
|
288
|
-
constructor(message: string, details?: unknown);
|
|
289
|
-
}
|
|
290
|
-
declare class McpFnOutputValidationError extends McpFnError {
|
|
291
|
-
constructor(message: string, details?: unknown);
|
|
292
|
-
}
|
|
293
|
-
declare function errorResult(error: unknown, options?: {
|
|
294
|
-
includeStructuredContent?: boolean;
|
|
295
|
-
}): CallToolResult;
|
|
296
|
-
|
|
297
279
|
interface CreateManifestOptions {
|
|
298
280
|
protocolVersions?: string[];
|
|
299
281
|
transports?: Array<"stdio" | "streamable-http">;
|
|
@@ -304,9 +286,6 @@ interface CreateManifestOptions {
|
|
|
304
286
|
declare function createManifest<TContext>(info: McpFnServerInfo, registry: McpFnRegistry<TContext>, options?: CreateManifestOptions): McpFnManifest;
|
|
305
287
|
declare function validateManifest(value: unknown): McpFnManifest;
|
|
306
288
|
|
|
307
|
-
declare function textResult(text: string): CallToolResult;
|
|
308
|
-
declare function structuredResult(structuredContent: Record<string, unknown>, content?: ContentBlock[]): CallToolResult;
|
|
309
|
-
|
|
310
289
|
interface McpFnToolVisibilityInput<TContext> {
|
|
311
290
|
tool: McpFnListedTool;
|
|
312
291
|
context: TContext;
|
|
@@ -331,6 +310,8 @@ interface McpFnServerOptions<TContext> extends CreateManifestOptions {
|
|
|
331
310
|
maxTaskQueueSize?: number;
|
|
332
311
|
enforceStrictCapabilities?: boolean;
|
|
333
312
|
}
|
|
313
|
+
/** Resolve the exact protocol/manifest capabilities from one registry contract. */
|
|
314
|
+
declare function resolveMcpFnServerCapabilities<TContext>(registry: McpFnRegistry<TContext>, additionalCapabilities: ServerCapabilities | undefined, includeTaskOperations: boolean): ServerCapabilities;
|
|
334
315
|
declare class McpFnServer<TContext = undefined> {
|
|
335
316
|
readonly registry: McpFnRegistry<TContext>;
|
|
336
317
|
readonly info: McpFnServerInfo;
|
|
@@ -363,4 +344,49 @@ declare class McpFnServer<TContext = undefined> {
|
|
|
363
344
|
}
|
|
364
345
|
declare function createMcpFnServer<TContext = undefined>(options: McpFnServerOptions<TContext>): McpFnServer<TContext>;
|
|
365
346
|
|
|
366
|
-
|
|
347
|
+
interface McpFnServerDeclarationOptions<TContext = undefined> extends CreateManifestOptions {
|
|
348
|
+
info: McpFnServerInfo;
|
|
349
|
+
tools?: McpFnToolDefinition<TContext>[];
|
|
350
|
+
resources?: McpFnResourceDefinition<TContext>[];
|
|
351
|
+
resourceTemplates?: McpFnResourceTemplateDefinition<TContext>[];
|
|
352
|
+
prompts?: McpFnPromptDefinition<TContext>[];
|
|
353
|
+
/** Reuse an existing registry while adopting the declaration/runtime split. */
|
|
354
|
+
registry?: McpFnRegistry<TContext>;
|
|
355
|
+
}
|
|
356
|
+
type McpFnServerRuntimeOptions<TContext> = Omit<McpFnServerOptions<TContext>, "info" | "registry" | "additionalCapabilities" | keyof CreateManifestOptions>;
|
|
357
|
+
/**
|
|
358
|
+
* Side-effect-free application declaration. The same registry and manifest
|
|
359
|
+
* feed production transports, deterministic tests, and release tooling.
|
|
360
|
+
*/
|
|
361
|
+
declare class McpFnServerDeclaration<TContext = undefined> {
|
|
362
|
+
readonly info: McpFnServerInfo;
|
|
363
|
+
readonly registry: McpFnRegistry<TContext>;
|
|
364
|
+
private readonly manifestOptions;
|
|
365
|
+
constructor(options: McpFnServerDeclarationOptions<TContext>);
|
|
366
|
+
manifest(): McpFnManifest;
|
|
367
|
+
createServer(runtime?: McpFnServerRuntimeOptions<TContext>): McpFnServer<TContext>;
|
|
368
|
+
}
|
|
369
|
+
declare function defineMcpFnServer<TContext = undefined>(options: McpFnServerDeclarationOptions<TContext>): McpFnServerDeclaration<TContext>;
|
|
370
|
+
|
|
371
|
+
declare function diffManifests(before: McpFnManifest, after: McpFnManifest): McpFnDiffResult;
|
|
372
|
+
|
|
373
|
+
declare function jsonSafe(value: unknown): unknown;
|
|
374
|
+
declare class McpFnError extends Error {
|
|
375
|
+
readonly code: string;
|
|
376
|
+
readonly details?: unknown;
|
|
377
|
+
constructor(code: string, message: string, details?: unknown);
|
|
378
|
+
}
|
|
379
|
+
declare class McpFnValidationError extends McpFnError {
|
|
380
|
+
constructor(message: string, details?: unknown);
|
|
381
|
+
}
|
|
382
|
+
declare class McpFnOutputValidationError extends McpFnError {
|
|
383
|
+
constructor(message: string, details?: unknown);
|
|
384
|
+
}
|
|
385
|
+
declare function errorResult(error: unknown, options?: {
|
|
386
|
+
includeStructuredContent?: boolean;
|
|
387
|
+
}): CallToolResult;
|
|
388
|
+
|
|
389
|
+
declare function textResult(text: string): CallToolResult;
|
|
390
|
+
declare function structuredResult(structuredContent: Record<string, unknown>, content?: ContentBlock[]): CallToolResult;
|
|
391
|
+
|
|
392
|
+
export { type CreateManifestOptions, MCP_APP_EXTENSION_ID, MCP_APP_MIME_TYPE, type McpAppCsp, type McpAppPermissions, type McpAppResourceMetadata, type McpAppResourceOptions, type McpAppToolMetadata, type McpFnChangeSeverity, type McpFnClientRequestOptions, type McpFnContractChange, type McpFnDiffResult, type McpFnElicitationParams, type McpFnElicitationResult, McpFnError, type McpFnJsonSchema, type McpFnListedResource, type McpFnListedResourceTemplate, type McpFnListedTool, type McpFnManifest, type McpFnManifestPrompt, type McpFnManifestResource, type McpFnManifestResourceTemplate, type McpFnManifestTool, type McpFnObjectSchema, McpFnOutputValidationError, type McpFnPromptDefinition, McpFnRegistry, type McpFnRequestExtra, type McpFnResourceDefinition, type McpFnResourceTemplateDefinition, type McpFnRootsResult, type McpFnSamplingParams, type McpFnSamplingResult, McpFnServer, McpFnServerDeclaration, type McpFnServerDeclarationOptions, type McpFnServerInfo, type McpFnServerOptions, type McpFnServerRuntimeOptions, type McpFnTaskHandler, type McpFnTaskRequestExtra, type McpFnToolDefinition, type McpFnToolVisibilityInput, McpFnValidationError, assertMcpAppContracts, assertPromptSchemaSupportsStringValues, canonicalJson, canonicalize, compareCodeUnits, createManifest, createMcpAppResource, createMcpFnServer, defineMcpFnServer, diffManifests, errorResult, jsonSafe, mcpAppToolMetadata, promptArguments, resolveMcpFnServerCapabilities, schemaPromptArguments, sha256, structuredResult, textResult, validateManifest };
|