UNPKG

pocketsmith-mcp

Version:

MCP server for managing budgets via PocketSmith API

105 lines (104 loc) 4.5 kB
import { z } from "zod"; import { RequestContext } from "../../utils/index.js"; /** * Zod schema for a single MCP server's configuration entry. * Defines the command, arguments, environment variables, and transport type for an MCP server. * For HTTP transport, `command` holds the base URL. */ export declare const McpServerConfigEntrySchema: z.ZodObject<{ command: z.ZodString; args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; transportType: z.ZodDefault<z.ZodEnum<["stdio", "http"]>>; disabled: z.ZodOptional<z.ZodBoolean>; autoApprove: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { transportType: "stdio" | "http"; command: string; args: string[]; disabled?: boolean | undefined; env?: Record<string, string> | undefined; autoApprove?: boolean | undefined; }, { command: string; disabled?: boolean | undefined; transportType?: "stdio" | "http" | undefined; args?: string[] | undefined; env?: Record<string, string> | undefined; autoApprove?: boolean | undefined; }>; /** * Represents the configuration for a single MCP server. * This type is inferred from the {@link McpServerConfigEntrySchema}. */ export type McpServerConfigEntry = z.infer<typeof McpServerConfigEntrySchema>; /** * Zod schema for the root structure of the `mcp-config.json` file. * It expects a top-level key `mcpServers` containing a map of server names to their configurations. */ export declare const McpClientConfigFileSchema: z.ZodObject<{ mcpServers: z.ZodRecord<z.ZodString, z.ZodObject<{ command: z.ZodString; args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; transportType: z.ZodDefault<z.ZodEnum<["stdio", "http"]>>; disabled: z.ZodOptional<z.ZodBoolean>; autoApprove: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { transportType: "stdio" | "http"; command: string; args: string[]; disabled?: boolean | undefined; env?: Record<string, string> | undefined; autoApprove?: boolean | undefined; }, { command: string; disabled?: boolean | undefined; transportType?: "stdio" | "http" | undefined; args?: string[] | undefined; env?: Record<string, string> | undefined; autoApprove?: boolean | undefined; }>>; }, "strip", z.ZodTypeAny, { mcpServers: Record<string, { transportType: "stdio" | "http"; command: string; args: string[]; disabled?: boolean | undefined; env?: Record<string, string> | undefined; autoApprove?: boolean | undefined; }>; }, { mcpServers: Record<string, { command: string; disabled?: boolean | undefined; transportType?: "stdio" | "http" | undefined; args?: string[] | undefined; env?: Record<string, string> | undefined; autoApprove?: boolean | undefined; }>; }>; /** * Represents the entire structure of the MCP client configuration file (`mcp-config.json`). * This type is inferred from the {@link McpClientConfigFileSchema}. */ export type McpClientConfigFile = z.infer<typeof McpClientConfigFileSchema>; /** * Loads, validates, and caches the MCP client configuration from `mcp-config.json`. * The configuration is validated against {@link McpClientConfigFileSchema}. * * @param parentContext - Optional parent request context for logging and tracing. * @returns The loaded and validated MCP server configurations object. * @throws {McpError} If the config file cannot be read, or if parsing or validation fails. */ export declare function loadMcpClientConfig(parentContext?: RequestContext | null): McpClientConfigFile; /** * Retrieves a copy of the configuration entry for a specific MCP server by its name. * This function ensures the main configuration is loaded before accessing server details. * * @param serverName - The name/identifier of the server as defined in the configuration file. * @param parentContext - Optional parent request context for consistent logging. * @returns A copy of the configuration for the specified server. * @throws {McpError} If the main configuration cannot be loaded, or if the specified `serverName` is not found. */ export declare function getMcpServerConfig(serverName: string, parentContext?: RequestContext | null): McpServerConfigEntry;