xmcp 1.4.1 → 1.5.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/dist/client/managed.d.ts +23 -0
- package/dist/client.d.ts +4 -0
- package/dist/client.js +77 -0
- package/dist/config/index.d.ts +102 -29
- package/dist/config/schemas/components.d.ts +54 -0
- package/dist/config/schemas/index.d.ts +1 -0
- package/dist/config.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/runtime/adapter-express.js +16 -16
- package/dist/runtime/adapter-fastify.js +16 -16
- package/dist/runtime/adapter-nestjs.js +10 -10
- package/dist/runtime/adapter-nextjs.js +15 -15
- package/dist/runtime/adapter-tanstack-cloudflare.js +15 -15
- package/dist/runtime/adapter-tanstack.js +15 -15
- package/dist/runtime/cloudflare-worker.js +17 -17
- package/dist/runtime/http.js +16 -16
- package/dist/runtime/stdio.js +12 -12
- package/dist/runtime/utils/component-visibility.d.ts +10 -0
- package/dist/runtime/utils/execution-logger.d.ts +7 -0
- package/dist/runtime/utils/resources.d.ts +2 -2
- package/dist/runtime/utils/server.d.ts +6 -6
- package/dist/runtime/vercel.js +22 -22
- package/package.json +11 -3
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Client, type ClientContext, type ClientOptions, type ConnectOptions, type HandlerResultTypeMap, type RequestTypeMap } from "@modelcontextprotocol/client";
|
|
2
|
+
import type { ClientDefinition } from "./types";
|
|
3
|
+
type Handler<Method extends keyof RequestTypeMap> = (request: RequestTypeMap[Method], context: ClientContext) => HandlerResultTypeMap[Method] | Promise<HandlerResultTypeMap[Method]>;
|
|
4
|
+
export interface ClientHandlers {
|
|
5
|
+
sampling?: Handler<"sampling/createMessage">;
|
|
6
|
+
/** Handles both form and URL elicitation requests. */
|
|
7
|
+
elicitation?: Handler<"elicitation/create">;
|
|
8
|
+
roots?: Handler<"roots/list">;
|
|
9
|
+
}
|
|
10
|
+
export interface ManagedClientOptions {
|
|
11
|
+
handlers?: ClientHandlers;
|
|
12
|
+
/** Defaults to automatic modern/legacy protocol negotiation. */
|
|
13
|
+
versionNegotiation?: ClientOptions["versionNegotiation"];
|
|
14
|
+
/** SDK connection options, including timeout and cancellation signal. */
|
|
15
|
+
connect?: ConnectOptions;
|
|
16
|
+
/** Receives piped subprocess stderr; otherwise it is forwarded to stderr. */
|
|
17
|
+
onStderrData?: (chunk: Buffer) => void;
|
|
18
|
+
}
|
|
19
|
+
/** Connect using a client definition, with handlers installed before negotiation. */
|
|
20
|
+
export declare function createClient(definition: ClientDefinition, options?: ManagedClientOptions): Promise<Client>;
|
|
21
|
+
/** Run an operation and close the connection even when the operation fails. */
|
|
22
|
+
export declare function withClient<T>(definition: ClientDefinition, operation: (client: Client) => T | Promise<T>, options?: ManagedClientOptions): Promise<T>;
|
|
23
|
+
export {};
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createClient, withClient } from "./client/managed";
|
|
2
|
+
export type { ClientHandlers, ManagedClientOptions } from "./client/managed";
|
|
3
|
+
export type { ClientDefinition, HttpClientDefinition, StdioClientDefinition, } from "./client/types";
|
|
4
|
+
export type { CustomHeaders, CustomHeader } from "./client/headers";
|