tmcp 1.16.4 → 1.17.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/README.md CHANGED
@@ -293,6 +293,46 @@ const response = server.receive(jsonRpcRequest, {
293
293
  });
294
294
  ```
295
295
 
296
+ ##### `request({ method, params })`
297
+
298
+ Send a raw JSON-RPC request to the connected client. This lets you call
299
+ experimental MCP APIs or proprietary extensions before they gain a dedicated
300
+ method on `McpServer` or to send a request with a custom JSON-schema that is not expressible with your validation library.
301
+
302
+ ```javascript
303
+ const response = await server.request({
304
+ method: 'elicitation/create',
305
+ params: {
306
+ message: 'Describe the deployment plan',
307
+ requestedSchema: {
308
+ type: 'object',
309
+ required: ['region', 'replicas', 'features'],
310
+ properties: {
311
+ region: {
312
+ type: 'string',
313
+ enum: ['us-east-1', 'us-west-2', 'eu-central-1'],
314
+ },
315
+ replicas: { type: 'integer', minimum: 1, maximum: 20 },
316
+ features: {
317
+ type: 'array',
318
+ items: {
319
+ type: 'string',
320
+ enum: ['canary', 'observability', 'autoscaling'],
321
+ },
322
+ minItems: 1,
323
+ },
324
+ },
325
+ },
326
+ },
327
+ });
328
+ ```
329
+
330
+ - `method`: Fully qualified MCP client method name
331
+ - `params` (optional): JSON-RPC params object/array accepted by that method
332
+
333
+ Handle the resolved payload like any other JSON-RPC response—cast or (better) validate
334
+ as needed when using this escape hatch.
335
+
296
336
  ##### `elicitation(schema)`
297
337
 
298
338
  Request client elicitation with schema validation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tmcp",
3
- "version": "1.16.4",
3
+ "version": "1.17.0",
4
4
  "description": "The main tmcp library",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -1029,6 +1029,17 @@ export class McpServer {
1029
1029
  );
1030
1030
  }
1031
1031
 
1032
+ /**
1033
+ * Lower level api to send a request to the client, mostly useful to call client methods that not yet supported by the server or
1034
+ * if you want to send requests with json schema that is not expressible with your validation library.
1035
+ * @param {{ method: string, params?: JSONRPCParams }} request
1036
+ * @returns {Promise<unknown>}
1037
+ */
1038
+ async request({ method, params }) {
1039
+ this.#lazyily_create_client();
1040
+ return this.#client?.request(method, params, 'standalone');
1041
+ }
1042
+
1032
1043
  /**
1033
1044
  * Send a notification for subscriptions
1034
1045
  * @template {keyof ChangedArgs} TWhat
@@ -1,6 +1,6 @@
1
1
  declare module 'tmcp' {
2
2
  import type { StandardSchemaV1 } from '@standard-schema/spec';
3
- import type { JSONRPCServer, JSONRPCClient, JSONRPCRequest } from 'json-rpc-2.0';
3
+ import type { JSONRPCServer, JSONRPCClient, JSONRPCParams, JSONRPCRequest } from 'json-rpc-2.0';
4
4
  import type { JSONSchema7 } from 'json-schema';
5
5
  import * as v from 'valibot';
6
6
  export class McpServer<StandardSchema extends StandardSchemaV1 | undefined = undefined, CustomContext extends Record<string, unknown> | undefined = undefined> {
@@ -113,6 +113,14 @@ declare module 'tmcp' {
113
113
  *
114
114
  * */
115
115
  receive(message: JSONRPCMessage, ctx?: Context<CustomContext>): ReturnType<JSONRPCServer["receive"]> | ReturnType<JSONRPCClient["receive"] | undefined>;
116
+ /**
117
+ * Lower level api to send a request to the client, mostly useful to call client methods that not yet supported by the server or
118
+ * if you want to send requests with json schema that is not expressible with your validation library.
119
+ * */
120
+ request({ method, params }: {
121
+ method: string;
122
+ params?: JSONRPCParams;
123
+ }): Promise<unknown>;
116
124
  /**
117
125
  * Send a notification for subscriptions
118
126
  * */
@@ -74,6 +74,6 @@
74
74
  null,
75
75
  null
76
76
  ],
77
- "mappings": ";;;;;cAiLaA,SAASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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