VS

vizioz/swagger-mcp

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

168 stars 26 forks Качество 63 Тренд 17MIT

vizioz/swagger-mcp — это кандидат на сервер MCP, импортированный из https://github.com/vizioz/swagger-mcp.

Обзор

vizioz/swagger-mcp — это кандидат на сервер MCP, импортированный из https://github.com/vizioz/swagger-mcp.

Обзор (машинный перевод)

MCP-сервер, который подключается к спецификации Swagger и помогает ИИ создавать все необходимые модели для создания MCP-сервера для этого сервиса.

Особенности

  • Скачает спецификацию Swagger и хранит её локально для более быстрого использования.
  • Возвращает список всех конечных точек и их HTTP-методы и описания
  • Возвращает список всех моделей
  • Возвращает модель
  • Возвращает сервис для подключения к конечной точке
  • Возвращает определения функций MCP
  • Генерирует полные определения инструментов MCP с полной информацией о схеме
  • Включает инструкции, специфичные для ИИ, в описаниях инструментов

Предварительные требования

  • Node.js (v14 или выше)
  • NPM или пряжа

Установка

  1. Клонировать репозиторий:

  2. Установка зависимостей:

  3. Создайте файл .env на основе файла .env.example:

  4. Обновить файл .env.

Конфигурация

Отредактировать файл .env для настройки приложения:

  • PORT: Порт, на котором будет работать сервер (по умолчанию: 3000)
  • NODE_ENV: Окружающая среда (разработка, производство, тестирование)
  • LOG_LEVEL: Уровень логирования (информация, ошибка, отладка)

Использование

Создание приложения

Создайте приложение:

Это скомпилирует код TypeScript, готовый к использованию в качестве MCP-сервера

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

README

Показан фрагмент оригинального README. Открыть оригинал.

Swagger MCP

An MCP server that connects to a Swagger specification and helps an AI to build all the required models to generate a MCP server for that service.

Features

  • Downloads a Swagger specification and stores it locally for faster reference.
  • Returns a list of all the endpoints and their HTTP Methods and descriptions
  • Returns a list of all the models
  • Returns a model
  • Returns service to connect to the end point
  • Returns MCP function definitions
  • Generates complete MCP tool definitions with full schema information
  • Includes AI-specific instructions in tool descriptions

Prerequisites

  • Node.js (v14 or higher)
  • npm or yarn

Installation

  1. Clone the repository:
git clone https://github.com/readingdancer/swagger-mcp.git
cd swagger-mcp
  1. Install dependencies:
npm install
  1. Create a .env file based on the .env.example file:
cp .env.example .env
  1. Update the .env file.

Configuration

Edit the .env file to configure the application:

  • PORT: The port on which the server will run (default: 3000)
  • NODE_ENV: The environment (development, production, test)
  • LOG_LEVEL: Logging level (info, error, debug)

Usage

Building the application

Build the application:

npm run build

This will compile the TypeScript code ready to be used as an MCP Server

Running as an MCP Server

To run as an MCP server for integration with Cursor and other applications:

node build/index.js

You can also provide a Swagger URL via CLI argument:

node build/index.js --swagger-url="https://petstore.swagger.io/v2/swagger.json"

Or using the alternative format:

node build/index.js --swaggerUrl="https://petstore.swagger.io/v2/swagger.json"

Note: The CLI --swagger-url argument takes priority over the swaggerFilePath parameter in tool calls. If both are provided, the CLI argument will be used.

Using the MCP Inspector

To run the MCP inspector for debugging:

npm run inspector

Adding to Cursor

To add this MCP server to Cursor:

  1. Open Cursor Settings > Features > MCP
  2. Click “+ Add New MCP Server”
  3. Enter a name for the server (e.g., “Swagger MCP”)
  4. Select “stdio” as the transport type
  5. Enter the command to run the server:
    • Basic: node path/to/swagger-mcp/build/index.js
    • With Swagger URL: node path/to/swagger-mcp/build/index.js --swagger-url="https://your-api-url/swagger.json"
  6. Click “Add”

The Swagger MCP tools will now be available to the Cursor Agent in Composer.

Tip: If you provide the --swagger-url CLI argument when configuring the server, you won’t need to provide swaggerFilePath in tool calls, making the tools easier to use.

Available Swagger MCP Tools

The following tools are available through the MCP server:

  • getSwaggerDefinition: Downloads a Swagger definition from a URL
  • listEndpoints: Lists all endpoints from the Swagger definition (optional swaggerFilePath)
Открыть полный README на GitHub

Установка

This server does not publish a one-line install command.

Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →