Built using FastAPI to provide a high-performance framework for the MCP server implementation.
Interacts with the Swagger Petstore API using an OpenAPI 3.0 specification, providing tools for managing pets, stores, and users including operations like adding pets, placing orders, and managing user accounts.
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
- Create and activate a virtual environment
- Install dependencies
🧪 Running the Server
To start the server:
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:
This server cannot be installed
A lightweight server that enables interaction with the Swagger Petstore API using the Model Context Protocol, allowing operations on pets, stores, and users through dynamically loaded OpenAPI specifications.
Related MCP Servers
- -securityAlicense-qualityA server that enables interaction with any API that has a Swagger/OpenAPI specification through Model Context Protocol (MCP), automatically generating tools from API endpoints and supporting multiple authentication methods.Last updated -3490TypeScriptApache 2.0
- AsecurityFlicenseAqualityA server based on Model Context Protocol that parses Swagger/OpenAPI documents and generates TypeScript types and API client code for different frameworks (Axios, Fetch, React Query).Last updated -12713TypeScript
- -securityFlicense-qualityA lightweight Model Context Protocol server that enables creating, managing, and querying model contexts with integrated Datadog metrics and monitoring.Last updated -Python
MockLoop MCP Serverofficial
-securityAlicense-qualityA Model Context Protocol server that generates and runs mock API servers from API documentation like OpenAPI/Swagger specs, enabling developers and AI assistants to quickly spin up mock backends for development and testing.Last updated -8PythonMIT License