gauravgarg/openapi-2-mcpserver
3.1
If you are the rightful owner of openapi-2-mcpserver and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
This project sets up an MCP server using FastMCP to serve an OpenAPI specification.
openapi-2-mcpserver
This project downloads an OpenAPI specification (Petstore example), saves it locally, and starts an MCP server using FastMCP.
Setup
-
(Optional) Create and activate a Python virtual environment:
python3 -m venv venv source venv/bin/activate -
Install dependencies (using uv):
uv pip install -r requirements.txt
Running on a VM (with uv installed)
- Upload your project files to the VM.
- Open a terminal and navigate to your project directory.
- Install dependencies:
uv pip install -r requirements.txt - Run the server:
python main.py- The server will start on
0.0.0.0:8000.
- The server will start on
How it works
- Downloads the Petstore OpenAPI spec from
https://petstore3.swagger.io/api/v3/openapi.json. - Saves it as
petstore_openapi.json. - Creates an MCP server using FastMCP and serves it with Uvicorn.
Project Structure
main.py— Entry pointrequirements.txt— Python dependencies