A
Api2mcp
POC about how to create an API interface to expose MCP Servers
Created 10/12/2025
Updated 2 months ago
README
Repository documentation and setup instructions
API2MCP
Generate a FastAPI server from a Swagger/OpenAPI specification.
Description
This tool takes a Swagger/OpenAPI specification file (in YAML or JSON format) and generates a basic FastAPI server with endpoints and models defined in the specification.
Installation
-
Clone the repository:
git clone https://github.com/your-username/api2mcp.git cd api2mcp -
Install the dependencies using Poetry:
poetry install
Usage
To generate a server, use the generate command:
poetry run api2mcp generate <path-to-swagger-file> <output-directory>
For example:
poetry run api2mcp generate my-api.yaml my-server
This will create a new directory my-server with the generated FastAPI server files.
Testing
To run the tests, use pytest:
poetry run pytest
Quick Setup
Installation guide for this server
Install Package (if required)
uvx api2mcp
Cursor configuration (mcp.json)
{
"mcpServers": {
"jhderojasuva-api2mcp": {
"command": "uvx",
"args": [
"api2mcp"
]
}
}
}