Skip to main content
Glama
Swagger MCP Server
by Waltu

Swagger MCP Server

An MCP (Model Context Protocol) server that provides AI tools access to multiple Swagger/OpenAPI documentation endpoints. This allows AI assistants to browse, search, and understand API specifications across your microservices architecture.

Features

  • Service Discovery: List and search available microservices

  • Swagger Fetching: Retrieve full OpenAPI/Swagger documentation

  • Endpoint Analysis: Extract and search API endpoints

  • Schema Extraction: Get data models and schemas

  • Service Comparison: Compare endpoints between services

  • Caching: Built-in caching mechanism for performance

  • Group Filtering: Organize services by groups

Related MCP server: mcp-swagger

Installation

npm install
npm run build

Quick Start

  1. Clone and build the project:

git clone <repository-url>
cd swagger-mcp
npm install
npm run build
  1. Generate an example MCP configuration:

node generate-example-config.js

This will create an example.mcp.json file with the correct paths to your swagger-mcp installation.

  1. Copy the generated configuration to LLM MCP configuration

  2. Add your Swagger endpoints to swagger-config.json:

[
  {
    "name": "Service Name",
    "slug": "service-slug",
    "baseUrl": "http://service.example.com",
    "openApiPath": "/documentation/json",
    "group": "Service Group"
  }
]
  1. Restart Agent to load the MCP server.

Configuration

The server reads service configurations from swagger-config.json file. Each service should have:

{
  "name": "Service Name",
  "slug": "service-slug",
  "baseUrl": "http://service.example.com",
  "openApiPath": "/documentation/json",
  "group": "Service Group"
}

Usage

Adding to Claude Code

The generate-example-config.js script creates an MCP configuration with the correct absolute paths. The generated configuration will look like:

{
  "mcpServers": {
    "swagger": {
      "command": "node",
      "args": ["/absolute/path/to/swagger-mcp/dist/index.js"]
    }
  }
}

After adding the configuration, restart Agent for the changes to take effect.

Available Tools

The MCP server provides the following tools:

  1. list_services - List all available microservices

    • Optional: Filter by group

  2. search_services - Search for services by name, slug, or group

    • Required: query string

  3. get_swagger - Get full OpenAPI/Swagger documentation

    • Required: service slug

  4. get_endpoints - List all endpoints from a service

    • Required: service slug

  5. search_endpoints - Search for specific endpoints

    • Required: service slug and query

  6. get_endpoint_details - Get detailed endpoint information

    • Required: service slug, path, and HTTP method

  7. get_schemas - Extract data schemas/models

    • Required: service slug

  8. compare_services - Compare endpoints between two services

    • Required: two service slugs

Available Resources

Each service is exposed as a resource with URI format: swagger://{service-slug}

Development

# Run in development mode
npm run dev

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

# Lint and format code
npm run lint

# Check linting without fixing
npm run lint:check

Architecture

The server is built with:

  • TypeScript for type safety

  • @modelcontextprotocol/sdk for MCP server implementation

  • Biome for linting and formatting

  • Vitest for testing

  • node-fetch for HTTP requests

Main Components

  • index.ts - MCP server implementation and tool handlers

  • swagger-fetcher.ts - Service for fetching and caching Swagger documents

  • swagger-analyzer.ts - Utilities for analyzing Swagger documents

  • types.ts - TypeScript type definitions

Testing

Tests are written using Vitest and cover:

  • Service discovery and filtering

  • Swagger document fetching and caching

  • Endpoint extraction and searching

  • Schema extraction

  • Base URL resolution

Run tests with:

npm test

License

MIT

Available Tools

12 tools
compare_servicesC

Compare endpoints between two services

Inputs: slug1 (required), slug2 (required).

find_similarC

Find endpoints similar to a given endpoint

Inputs: path (required), method (required), service (required), limit.

get_endpoint_detailsC

Get detailed information about a specific endpoint

Inputs: path (required), slug (required), method (required).

get_endpointsB

Get all endpoints from a service's API

Inputs: slug (required).

get_schemasB

Get all data schemas/models from a service

Inputs: slug (required).

get_swaggerB

Get the full OpenAPI/Swagger documentation for a service

Inputs: slug (required).

indexing_statusC

Check the status of background indexing

Inputs: no named parameters.

list_servicesB

List all available microservices

Inputs: group.

search_endpointsC

Search for specific endpoints in a service

Inputs: slug (required), query (required).

search_servicesB

Search for microservices by name, slug, or group

Inputs: query (required).

search_statsC

Get statistics about indexed swagger documentation

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 12 tools

    Disambiguation4/5

    Most tools target a clearly distinct resource+action (list_services vs. search_services, get_endpoints vs. get_endpoint_details, compare_services, find_similar). The riskiest pairs are search_endpoints vs. semantic_search (keyword-in-service vs. natural-language-across-all) and indexing_status vs. search_stats (status vs. statistics), but descriptions give enough signal to separate them.

    Naming Consistency4/5

    Eight tools follow a clean verb_noun pattern (list_services, get_endpoints, compare_services). Deviations are minor but present: noun-first names like indexing_status and search_stats, plus adjective_noun semantic_search and the objectless find_similar, which break the otherwise predictable convention.

    Tool Count5/5

    Twelve tools sit squarely in the well-scoped range and each maps to a concrete browsing/search need. There's no obviously redundant or filler tool for a Swagger documentation server.

    Completeness4/5

    The surface covers listing, searching, fetching specs, endpoints, schemas, details, semantic search, similarity, comparison, indexing and stats — a full read-only lifecycle. Minor gaps remain: no filtering endpoints by method/tag, no batch multi-endpoint fetch, and no way to resolve a schema referenced by name across services.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to load, parse, and query OpenAPI/Swagger documentation from URLs with intelligent search across endpoints, schemas, and authentication methods. Provides 10 specialized tools for comprehensive API exploration including path details, operation lookups, and multi-criteria search capabilities.
      4
      -
    • A
      license
      A
      quality
      D
      maintenance
      Exposes Swagger/OpenAPI API documentation to AI models, enabling exploration, search, and interaction with endpoints, schemas, and execution of API calls.
      14
      27 npm
      2
      MIT
    • F
      license
      A
      quality
      D
      maintenance
      Enables LLMs to dereference and query OpenAPI/Swagger specifications, search endpoints and schemas, validate payloads, extract security schemes, and generate production-ready integration code in multiple languages.
      8
      -