Swagger Navigator MCP Server

Swagger Navigator MCP Server

Enables AI assistants to discover, search, and interact with REST APIs by parsing OpenAPI/Swagger specifications with intelligent fuzzy search across endpoints, supporting both local and remote API sources.

Category
访问服务器

README

🔍 Swagger Navigator MCP Server

License: MIT Node.js TypeScript

An MCP server implementation that provides intelligent discovery and search capabilities for Swagger/OpenAPI endpoints. This tool enables AI assistants to dynamically explore, understand, and interact with REST APIs by parsing OpenAPI specifications and providing fuzzy search across endpoints.


🚀 How It Works

The Swagger Navigator MCP Server acts as an intelligent API knowledge hub, seamlessly connecting developers with their API specifications. When you ask Cursor/Claude/LLMs to generate API clients, anticorruption layers, or type definitions, Cursor/Claude/LLMs consults the MCP server to get accurate, structured API information and then generates perfect code based on the actual API schema.

flowchart TD
    A[👨‍💻 Developer] -->|"💬 Generate API client<br/>for /users endpoint"| B[🎯 Cursor/IDE/LLMs]
    B -->|"🔍 Query: What is<br/>/users endpoint?"| C[🚀 Swagger Navigator MCP Server]
    C -->|"📊 Returns endpoint<br/>schema & structure"| B
    B -->|"✨ Here's your<br/>generated API client"| A

    style A fill:#74b9ff,stroke:#0984e3,stroke-width:2px,color:#fff
    style B fill:#a29bfe,stroke:#6c5ce7,stroke-width:2px,color:#fff
    style C fill:#ff6b6b,stroke:#333,stroke-width:4px,color:#fff

    linkStyle 0 stroke:#fd79a8,stroke-width:3px
    linkStyle 1 stroke:#00b894,stroke-width:3px
    linkStyle 2 stroke:#fdcb6e,stroke-width:3px
    linkStyle 3 stroke:#e17055,stroke-width:3px

✨ Features

  • 🔍 Dynamic API Discovery: Automatically parse and index Swagger/OpenAPI specifications from multiple sources
  • 🎯 Intelligent Search: Use fuzzy matching to find relevant endpoints based on natural language queries
  • 🔗 Multi-source Support: Handle both local files and remote HTTP endpoints with authentication
  • ⚡ Real-time Updates: Monitor configuration changes and refresh API data automatically
  • 🔄 Hot-reload Configuration: Detect config file changes without server restart

🛠️ Tools

📋 list_all_sources

Retrieves a comprehensive list of all available Swagger/OpenAPI sources in the system.

Purpose:

  • Provides overview of all loaded API specifications
  • Shows available APIs for search and exploration
  • Returns source names for use with other tools

Returns:

  • Array of sources with name, description, and OpenAPI info (title, version)

📄 list_endpoints_for_source

Retrieves all endpoints from a specific API source with pagination support.

Inputs:

  • name (string): The source name to list endpoints for
  • limit (number, optional): Maximum endpoints to return (1-100, default: 10)
  • offset (number, optional): Number of endpoints to skip (default: 0)

Returns:

  • Array of endpoints with path, method, description, and metadata
  • Pagination information with total count and navigation flags

🔎 search_endpoint

Intelligently searches endpoints using fuzzy matching across multiple attributes.

Inputs:

  • query (string): Search query using natural language (e.g., "create user", "authentication", "GET users")

Returns:

  • Ranked array of matching endpoints with relevance scores
  • Weighted search across descriptions, paths, methods, and tags

⚙️ Configuration

🤖 Usage with Cursor

Add this to your ~/.cursor/mcp.json:

Using npx

{
  "mcpServers": {
    "swagger-navigator-mcp": {
      "command": "npx",
      "args": ["-y", "swagger-navigator-mcp"],
      "env": {
        "CONFIG_PATH": "path/to/swagger-navigator-mcp.config.yaml"
      }
    }
  }
}

📝 Configuration File

Create a swagger-navigator-mcp.config.yaml file:

# Swagger Navigator MCP Server Configuration

sources:
  # Local file example
  - name: "petstore-local"
    source: "./specs/petstore.json"
    description: "Local Petstore API specification"

  # Remote HTTP source with authentication
  - name: "github-api"
    source: "https://api.github.com"
    description: "GitHub REST API v3"
    headers:
      Authorization: "token ${GITHUB_TOKEN}"
      Accept: "application/vnd.github.v3+json"

  # API with custom headers
  - name: "internal-api"
    source: "https://internal.company.com/api/swagger.json"
    description: "Internal company API"
    headers:
      X-API-Key: "${API_KEY}"

# Optional: Search configuration
search:
  fuzzyThreshold: 0.6 # 0-1, lower = more fuzzy matching

# Optional: Refresh interval in seconds
refreshInterval: 300 # Refresh every 5 minutes

🔐 Environment Variable Substitution

The configuration file supports environment variable substitution using ${VARIABLE_NAME} syntax. This allows you to securely store sensitive information like API keys and tokens outside of your configuration file.

Examples:

  • ${GITHUB_TOKEN} - Substituted with the value of the GITHUB_TOKEN environment variable
  • ${API_KEY} - Substituted with the value of the API_KEY environment variable
  • ${DATABASE_URL} - Any environment variable can be used

Note: If an environment variable is not set, the substitution will result in an empty string.

🌍 Environment Variables

Set environment variables for configuration and authentication:

export CONFIG_PATH="./swagger-navigator-mcp.config.yaml"
export GITHUB_TOKEN="your-github-token"
export API_KEY="your-api-key"

🚀 Usage

📦 Install Dependencies

npm install

🔨 Build the Project

npm run build

▶️ Start the Server

CONFIG_PATH=./swagger-navigator-mcp.config.yaml npm start

🧪 Development Mode

npm run dev

📄 License

This project is licensed under the ISC License - see the LICENSE file for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选