@zuplo/runtime 6.54.21 → 6.54.22

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.
@@ -1,6 +1,8 @@
1
+ import { CallToolResult } from "@zuplo/mcp/types";
1
2
  import { KeyLike } from "jose";
2
3
  import { RequestGeneric as RequestGeneric_2 } from "../../request.js";
3
4
  import type { ValidateFunction } from "ajv";
5
+ import { z } from "zod/v4";
4
6
 
5
7
  /**
6
8
  * Entry format for Akamai API Security logger
@@ -4640,6 +4642,101 @@ declare type LokiTransportVersion = 1 | 2;
4640
4642
 
4641
4643
  /* Excluded from this release type: LookupResult */
4642
4644
 
4645
+ /**
4646
+ * Plugin for adding MCP (Model Context Protocol) custom tools to Zuplo
4647
+ *
4648
+ * This plugin allows end users to create custom MCP tools using a simple SDK
4649
+ * that can perform complex operations including invoking multiple routes on the gateway or
4650
+ * implementing custom logic beyond simple route mapping.
4651
+ */
4652
+ export declare class McpCustomToolsPlugin extends SystemRuntimePlugin {
4653
+ private options;
4654
+ private mcpServer;
4655
+ private transport;
4656
+ constructor(options: McpCustomToolsPluginOptions);
4657
+ private validateTools;
4658
+ registerRoutes(options: {
4659
+ router: Router;
4660
+ runtimeSettings: RuntimeSettings;
4661
+ }): void;
4662
+ private createMcpHandler;
4663
+ /**
4664
+ * Lazy loads the MCP server, http transport, and tools on first call
4665
+ */
4666
+ private initializeMcpServer;
4667
+ /**
4668
+ * Registers individual custom tools from users given a McpToolDefinion
4669
+ */
4670
+ private registerTool;
4671
+ }
4672
+
4673
+ /**
4674
+ * Configuration options for the MCP Custom Tools Plugin
4675
+ */
4676
+ export declare interface McpCustomToolsPluginOptions {
4677
+ /**
4678
+ * Name of the MCP server
4679
+ */
4680
+ name?: string;
4681
+ /**
4682
+ * Version of the MCP server
4683
+ */
4684
+ version?: string;
4685
+ /**
4686
+ * The endpoint path where the MCP server will be registered on the gateway
4687
+ * Default: "/mcp"
4688
+ */
4689
+ endpoint?: string;
4690
+ /**
4691
+ * Custom tools to register with the MCP server
4692
+ */
4693
+ tools: McpToolDefinition[];
4694
+ }
4695
+
4696
+ /**
4697
+ * SDK for creating and managing MCP custom tools
4698
+ *
4699
+ * Provides a fluent API for defining custom MCP tools that can perform
4700
+ * complex operations including calling multiple routes or implementing
4701
+ * custom logic beyond simple route mapping.
4702
+ */
4703
+ export declare class McpCustomToolsSDK {
4704
+ /**
4705
+ * Create a new tool builder
4706
+ */
4707
+ createTool(): McpToolBuilder;
4708
+ /**
4709
+ * Define a tool with a configuration object
4710
+ */
4711
+ defineTool<TSchema extends z.ZodType>(config: {
4712
+ name: string;
4713
+ description: string;
4714
+ schema?: TSchema;
4715
+ outputSchema?: TSchema;
4716
+ handler: McpToolHandler<z.infer<TSchema>>;
4717
+ }): McpToolDefinition<z.infer<TSchema>>;
4718
+ /**
4719
+ * Create a text response
4720
+ */
4721
+ textResponse(text: string): CallToolResult;
4722
+ /**
4723
+ * Create a JSON response (automatically stringified and put in structured content)
4724
+ */
4725
+ jsonResponse(data: any): CallToolResult;
4726
+ /**
4727
+ * Create an error response
4728
+ */
4729
+ errorResponse(message: string): CallToolResult;
4730
+ /**
4731
+ * Create an image response
4732
+ */
4733
+ imageResponse(data: string, mimeType: string): CallToolResult;
4734
+ /**
4735
+ * Create a resource response
4736
+ */
4737
+ resourceResponse(uri: string, mimeType?: string): CallToolResult;
4738
+ }
4739
+
4643
4740
  /**
4644
4741
  * An MCP Server handler for Zuplo
4645
4742
  * Only POST requests are supported for the HTTP streamable MCP transport.
@@ -4654,6 +4751,56 @@ export declare function mcpServerHandler(
4654
4751
  context: ZuploContext
4655
4752
  ): Promise<Response>;
4656
4753
 
4754
+ /**
4755
+ * Builder for creating MCP tools with type safety
4756
+ */
4757
+ export declare class McpToolBuilder<TSchema extends z.ZodSchema = z.ZodAny> {
4758
+ private config;
4759
+ /**
4760
+ * Set the tool name
4761
+ */
4762
+ name(name: string): this;
4763
+ /**
4764
+ * Set the tool description
4765
+ */
4766
+ description(description: string): this;
4767
+ /**
4768
+ * Set the input schema for the tool
4769
+ */
4770
+ schema<S extends z.ZodSchema>(schema: S): McpToolBuilder<S>;
4771
+ /**
4772
+ * Set the output schema for the tool
4773
+ */
4774
+ outSchema<S extends z.ZodSchema>(schema: S): McpToolBuilder<S>;
4775
+ /**
4776
+ * Set the handler function for the tool
4777
+ */
4778
+ handler(handler: McpToolHandler<z.infer<TSchema>>): this;
4779
+ /**
4780
+ * Build the tool definition
4781
+ */
4782
+ build(): McpToolDefinition<z.infer<TSchema>>;
4783
+ }
4784
+
4785
+ /**
4786
+ * Definition of a custom MCP tool
4787
+ */
4788
+ export declare interface McpToolDefinition<TSchema = any> {
4789
+ name: string;
4790
+ description: string;
4791
+ schema?: z.ZodType<TSchema>;
4792
+ outputSchema?: z.ZodType<TSchema>;
4793
+ handler: McpToolHandler<TSchema>;
4794
+ }
4795
+
4796
+ /**
4797
+ * Handler function for MCP tools
4798
+ */
4799
+ export declare type McpToolHandler<TArgs = any> = (
4800
+ args: TArgs,
4801
+ context: ZuploContext
4802
+ ) => Promise<CallToolResult> | CallToolResult;
4803
+
4657
4804
  /**
4658
4805
  * A two-tier cache that combines in-memory caching with zone-level caching.
4659
4806
  * Data is first checked in memory cache for fastest access, then falls back to
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "6.54.21",
4
+ "version": "6.54.22",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {