abhishek-iiit/Swagger-MCP-server
If you are the rightful owner of Swagger-MCP-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
Swagger-MCP-server is a lightweight MCP server that interfaces with the Swagger Petstore API using OpenAPI 3.0.
Swagger-MCP-server
Swagger-MCP-server is a lightweight Model Context Protocol (MCP) server that interacts with the Swagger Petstore API using an OpenAPI 3.0 specification. The server dynamically loads API tools defined in openapi.json
and exposes endpoints that mimic those of the Petstore API using the mcp.server.fastmcp
module.
๐ฆ Features
- โ Dynamic loading of OpenAPI 3.0 spec (Petstore).
- ๐พ Full support for Petstore operations: Pets, Stores, Users.
- โก Built using FastAPI.
- ๐ ๏ธ Utilizes the
mcp
server CLI and dynamic tool registration.
๐ Installation Guide
- Clone the repository
git clone https://github.com/abhishek-iiit/Swagger-MCP-server.git
cd Swagger-MCP-server
- Create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate
- Install dependencies
pip install -r requirements.txt
๐งช Running the Server
To start the server:
python main.py
This will start an MCP server that registers endpoints as defined in the openapi.json file and serves them via the Petstore API interface.
๐ API Endpoints
The server mirrors the Swagger Petstore API. It includes operations for:
Pets
- Add a new pet
- Update an existing pet
- Find pets by status or tags
- Get pet by ID
- Delete a pet
- Stores
- Place an order
- Get order by ID
- Check inventory
- Users
- Create users
- Login/logout
- Get user by username
- Update/delete user
๐ฆ Dependencies
Dependencies are listed in requirements.txt and include:
- fastapi: High-performance API framework.
- httpx: Async-compatible HTTP client.
- mcp[cli]: Model Context Protocol server framework.
- jsonschema: JSON Schema validation.
Install them via:
pip install -r requirements.txt