MCPInstall
mcp_builder logo

mcp_builder

by alikarimii 4 stars alikarimii/mcp_builder

Convert OpenAPI specifications into TypeScript code and generate MCP Server

READMEmain

MCP Builder

This project is designed to convert OpenAPI specifications into TypeScript code and generate MCP Server. It provides a simple way to generate TypeScript schemas and handlers based on the definitions provided in an OpenAPI YAML file.

This project works with OpenAPI v3, to convert v2 to v3 check this doc: openapi3-parser

Generate Code

To run the project, activate venv:

uv venv --python 3.12.9
source .venv/bin/activate
uv install

Then, you can run the generator script to convert your OpenAPI YAML file into TypeScript code. The command below assumes you have an OpenAPI YAML file named example/openapi_v3.yaml and you want to generate a TypeScript files in output directory, using the templates located in the src/templates directory.

python -m src.main --input=example/openapi_v3.yaml --output_dir=output --templates_dir=src/templates

or

make run

Prepare MCP Server

change directory to output,create .env file and put your envs there, then run:

npm i

Check server

run node dist/server.js. you shuold see the starting message. (MCP Server running ...)

Use MCP Server

VsCode

Create .vscode folder in root of your project and create mcp.json file.

{
  "servers": {
    "gitlab": {
      "command": "node",
      "args": [
        "/path/to/mcp_builder/output/dist/server.js" ## Change this base on your path
      ],
      "env": {
        "ACCESS_TOKEN": "ss", ## change it
        "API_URL": "ss" ## change it
      },
      "type": "stdio"
    }
  }
}

Cline

find cline_mcp_settings.json in your device and add this:

{
  "mcpServers": {
    "gitlab": {
      "disabled": false,
      "timeout": 60,
      "command": "node",
      "args": [
        "/path/to/mcp_builder/output/dist/server.js" ## Change this base on your path
      ],
      "env": {
        "ACCESS_TOKEN": "ss", ## change it
        "API_URL": "ss" ## change it
      },
      "transportType": "stdio"
    }
  }
}

If more than about 50 tools are generated, they are not shown in the Cline list. you can filter list in src/templates/server.ts.j2 and generate it again:

...
server.setRequestHandler(ListToolsRequestSchema, async () => {
  return {
    tools: Object.entries(toolStore).slice(0,50).map(([name, tool]) => ({
      name,
      description: tool.definition.description,
      inputSchema: tool.definition.inputSchema,
    })),
  };
});
...

More API Development MCP servers

Similar servers from the same category.

Integrates with DeepL to provide high-quality text translation and rephrasing between numerous languages with formality controls for supported language pairs.

API Development

Integrates with Kong API Gateway to enable management and analysis of API configurations, traffic patterns, and control plane settings through Kong's cloud APIs for DevOps teams maintaining API infrastructure.

API Development

Maton

maton-ai

Integrate with Maton APIs through function calling. This protocol supports various apps and actions to interact with different Maton services.

API Development

Converts OpenAPI specifications from API.market into tools for accessing over 200 services including image generation, geocoding, and content detection through a unified authentication system

authentication