Skip to main content
Glama
abhishek-iiit

Swagger MCP Server

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.


Related MCP server: MCP OpenAPI Server

๐Ÿš€ Installation Guide

  1. Clone the repository

git clone https://github.com/abhishek-iiit/Swagger-MCP-server.git
cd Swagger-MCP-server
  1. Create and activate a virtual environment

python3 -m venv .venv
source .venv/bin/activate
  1. 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

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    A server that enables Large Language Models to discover and interact with REST APIs defined by OpenAPI specifications through the Model Context Protocol.
    3,228 npm
    294
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    A Model Context Protocol server that loads multiple OpenAPI specifications and exposes them to LLM-powered IDE integrations, enabling AI to understand and work with your APIs directly in development tools like Cursor.
    7
    49 npm
    90
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    A standalone MCP server generated from an OpenAPI specification that exposes Petstore API endpoints as tools for AI assistants. It utilizes SSE transport to enable models to interact with pet store management functionalities through natural language.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    An MCP server generated from an OpenAPI specification that exposes Petstore API endpoints as tools for AI assistants. It enables interaction with pet store management functionalities using the Model Context Protocol over SSE transport.
    -