openapi-mcp-generator
Version:
Generates MCP server code from OpenAPI specifications
28 lines (27 loc) • 1.05 kB
TypeScript
/**
* Programmatic API for OpenAPI to MCP Generator
* Allows direct usage from other Node.js applications
*/
import { McpToolDefinition } from './types/index.js';
/**
* Options for generating the MCP tools
*/
export interface GetToolsOptions {
/** Optional base URL to override the one in the OpenAPI spec */
baseUrl?: string;
/** Whether to dereference the OpenAPI spec */
dereference?: boolean;
/** Array of operation IDs to exclude from the tools list */
excludeOperationIds?: string[];
/** Optional filter function to exclude tools based on custom criteria */
filterFn?: (tool: McpToolDefinition) => boolean;
}
/**
* Get a list of tools from an OpenAPI specification
*
* @param specPathOrUrl Path or URL to the OpenAPI specification
* @param options Options for generating the tools
* @returns Promise that resolves to an array of tool definitions
*/
export declare function getToolsFromOpenApi(specPathOrUrl: string, options?: GetToolsOptions): Promise<McpToolDefinition[]>;
export { McpToolDefinition };