Author avatar

openapi-mcp-converter

by zxypro1

Server

Tags

#llm #llm-tools #mcp #mcp-server #model-context-protocol #openapi #openapi-spec #openapi-specification #javascript #node #nodejs #typescript
4.8 (120)

OpenAPI to MCP Server Converter

Node.js Version TypeScript Version License: MIT

A tool for automatically converting OpenAPI specifications into Model Context Protocol (MCP) server instance

Features

  • 🚀 Automated Conversion: Auto-parses OpenAPI 3.0 specifications
  • 🛠 Type Safety: TypeScript-based strong type validation
  • 🔄 Request Proxy: Automatically handles tool call parameter mapping

Quick Start

Prerequisites

  • Node.js 18+
  • TypeScript 5.x

Basic Usage

Install the package:

npm install openapi-mcp-converter

Run a local stdio MCP server:

import { OpenApiMCPSeverConverter } from "openapi-mcp-converter";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import fs from "fs";

const openApiDoc = JSON.parse(fs.readFileSync("./openapi.json"));
const converter = new OpenApiMCPSeverConverter(openApiDoc);
const server = converter.getServer();

// Start MCP service
async function runServer() {
  const transport = new StdioServerTransport();
  await server.connect(transport);
  console.log("GitHub MCP Server running on stdio");
}

runServer().catch((error) => {
  console.error("Fatal error in main():", error);
  process.exit(1);
});

Run Examples

npm run test  # Execute sample test cases

Development Guide

Project Structure

/openapi-to-mcp
├── dist/            # Compiled output
├── src/             # Source code
│   ├── example/     # Example configurations
│   └── index.ts     # Core implementation
├── package.json
└── tsconfig.json

Build Commands

npm run build    # Production build
npm run watch    # Development mode watch

Related Services

playwright-mcp

Server

4.8 (120)
View Details →

blender-mcp

Server

4.8 (120)
View Details →

tavily-mcp

Server

4.8 (120)
View Details →