Skip to main content
Glama
Vizioz

Swagger MCP

by Vizioz

스웨거 MCP

Swagger 사양에 연결하고 AI가 해당 서비스에 대한 MCP 서버를 생성하는 데 필요한 모든 모델을 구축하는 데 도움이 되는 MCP 서버입니다.

특징

  • Swagger 사양을 다운로드하여 더 빠르게 참조할 수 있도록 로컬에 저장합니다.

  • 모든 엔드포인트와 해당 HTTP 메서드 및 설명의 목록을 반환합니다.

  • 모든 모델의 목록을 반환합니다.

  • 모델을 반환합니다

  • 종단점에 연결하기 위한 서비스 반환

  • MCP 함수 정의를 반환합니다.

  • 전체 스키마 정보를 사용하여 완전한 MCP 도구 정의를 생성합니다.

  • 도구 설명에 AI 관련 지침이 포함되어 있습니다.

Related MCP server: Mcp-Swagger-Server

필수 조건

  • Node.js(v14 이상)

  • npm 또는 yarn

설치

  1. 저장소를 복제합니다.

지엑스피1

  1. 종속성 설치:

npm install
  1. .env.example 파일을 기반으로 .env 파일을 만듭니다.

cp .env.example .env
  1. .env 파일을 업데이트합니다.

구성

.env 파일을 편집하여 애플리케이션을 구성합니다.

  • PORT : 서버가 실행될 포트(기본값: 3000)

  • NODE_ENV : 환경(개발, 프로덕션, 테스트)

  • LOG_LEVEL : 로깅 레벨(정보, 오류, 디버그)

용법

애플리케이션 구축

애플리케이션을 빌드하세요:

npm run build

이렇게 하면 MCP 서버로 사용할 준비가 된 TypeScript 코드가 컴파일됩니다.

MCP 서버로 실행

Cursor 및 기타 애플리케이션과 통합하기 위해 MCP 서버로 실행하려면:

node build/index.js

MCP 검사기 사용

디버깅을 위해 MCP 검사기를 실행하려면:

npm run inspector

커서에 추가

이 MCP 서버를 Cursor에 추가하려면:

  1. 커서 설정 > 기능 > MCP 열기

  2. "+ 새 MCP 서버 추가"를 클릭하세요

  3. 서버 이름을 입력하세요(예: "Swagger MCP")

  4. 전송 유형으로 "stdio"를 선택하세요

  5. 서버를 실행하려면 다음 명령을 입력하세요: node path/to/swagger-mcp/build/index.js 그리고 필요한 경우 위에서 언급한 대로 명령줄 인수를 추가합니다.

  6. "추가"를 클릭하세요

이제 Composer의 커서 에이전트에서 Swagger MCP 도구를 사용할 수 있습니다.

사용 가능한 Swagger MCP 도구

다음 도구는 MCP 서버를 통해 사용할 수 있습니다.

  • getSwaggerDefinition : URL에서 Swagger 정의를 다운로드합니다.

  • listEndpoints : Swagger 정의의 모든 엔드포인트를 나열합니다.

  • listEndpointModels : 특정 엔드포인트에서 사용되는 모든 모델을 나열합니다.

  • generateModelCode : 모델에 대한 TypeScript 코드를 생성합니다.

  • generateEndpointToolCode : MCP 도구 정의에 대한 TypeScript 코드를 생성합니다.

사용 가능한 Swagger MCP 프롬프트

이 서버는 또한 AI 어시스턴트를 일반적인 워크플로로 안내하는 MCP 프롬프트를 제공합니다.

  • add-endpoint : Swagger MCP 도구를 사용하여 새 엔드포인트를 추가하기 위한 단계별 가이드

프롬프트를 사용하려면 클라이언트가 프롬프트 이름과 선택적 인수를 사용하여 prompts/get 요청을 만들 수 있습니다.

{
  "method": "prompts/get",
  "params": {
    "name": "add-endpoint",
    "arguments": {
      "swaggerUrl": "https://petstore.swagger.io/v2/swagger.json",
      "endpointPath": "/pets/{id}",
      "httpMethod": "GET"
    }
  }
}

프롬프트는 AI 어시스턴트가 새로운 엔드포인트를 추가하는 데 필요한 정확한 프로세스를 안내하는 일련의 메시지를 반환합니다.

새 프로젝트 설정

먼저 에이전트에게 Swagger 파일을 가져오라고 요청하고, Swagger 파일의 URL을 알려주거나 적어도 파일을 찾을 수 있는 방법을 알려주세요. 이렇게 하면 파일이 다운로드되어 해시된 파일 이름으로 로컬에 저장됩니다. 이 파일 이름은 현재 솔루션의 루트에 있는 .swagger-mcp 설정 파일에 자동으로 추가됩니다.

자동 생성된 .swagger-mcp 구성 파일

SWAGGER_FILENAME = TheFilenameOfTheLocallyStoredSwaggerFile

이 간단한 구성 파일은 현재 프로젝트를 특정 Swagger API와 연결하며, 나중에 더 자세한 내용을 저장하는 데 사용할 수 있습니다.

MCP를 구성하면 Swagger 정의를 찾아 현재 솔루션과 연결할 수 있으며, 작업 중인 솔루션과 관련된 프로젝트 및 작업을 가져오는 데 필요한 API 호출 수가 줄어듭니다.

개선된 MCP 도구 코드 생성기

MCP 도구 코드 생성기가 더욱 완전하고 사용 가능한 도구 정의를 제공하도록 향상되었습니다.

주요 개선 사항

  1. 완전한 스키마 정보 : 생성기는 이제 중첩된 객체를 포함한 모든 모델에 대한 완전한 스키마 정보를 inputSchema에 직접 포함합니다.

  2. 더 나은 매개변수 명명 : 매개변수 이름이 이제 더 의미론적으로 바뀌었고 마침표와 같은 문제가 있는 문자가 사용되지 않습니다(예: taskRequest 대신 task.Request ).

  3. 의미적 도구 이름 : 도구 이름이 이제 더 설명적이며 HTTP 메서드와 리소스 경로를 기반으로 일관된 명명 규칙을 따릅니다.

  4. YAML Swagger 파일 지원 : 생성기는 이제 JSON과 YAML Swagger 정의 파일을 모두 지원합니다.

  5. 개선된 문서화 : 생성된 도구 정의에는 모든 매개변수와 속성에 대한 포괄적인 설명이 포함됩니다.

  6. 외부 종속성 없음 : 생성된 코드는 외부 모델 파일을 가져올 필요가 없으므로 더욱 독립적이고 사용하기 쉽습니다.

  7. AI 전용 지침 : 도구 설명에 이제 AI 에이전트를 위한 특별 지침이 포함되어 도구를 효과적으로 사용하는 방법을 이해하는 데 도움이 됩니다.

사용 예

엔드포인트에 대한 MCP 도구 정의를 생성하려면 다음을 수행합니다.

import generateEndpointToolCode from './services/generateEndpointToolCode.js';

const toolCode = await generateEndpointToolCode({
  path: '/pets',
  method: 'POST',
  swaggerFilePath: './petstore.json',
  singularizeResourceNames: true
});

console.log(toolCode);

이렇게 하면 POST /pets 엔드포인트에 대한 전체 스키마 정보가 포함된 완전한 MCP 도구 정의가 생성됩니다.

특허

이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여되었습니다. 자세한 내용은 라이선스 파일을 참조하세요.

AI 어시스턴트를 위한 MCP 프롬프트

AI 어시스턴트가 Swagger MCP 도구를 효과적으로 사용할 수 있도록, 일반적인 작업을 안내하는 프롬프트 모음을 만들었습니다. 이 프롬프트는 새 엔드포인트 추가, 생성된 모델 사용 등의 프로세스에 대한 단계별 지침을 제공합니다.

전체 프롬프트 컬렉션은 PROMPTS.md 파일에서 확인하세요.

예시 사용 사례: AI 어시스턴트에게 프로젝트에 새로운 엔드포인트를 추가하도록 요청할 때 "새로운 엔드포인트 추가" 프롬프트를 참조하여 어시스턴트가 올바른 순서대로 올바른 프로세스를 따르도록 할 수 있습니다.

Available Tools

5 tools
execute_api_requestC

Execute an API request to a specific endpoint

ParametersJSON Schema
NameRequiredDescriptionDefault
methodYesHTTP method (GET, POST, PUT, DELETE, etc.)
pathYesThe endpoint path (e.g., '/users/123')
paramsNoQuery parameters as key-value pairs
bodyNoRequest body as a JSON object (for POST/PUT/PATCH)
headersNoCustom headers as key-value pairs

TDQS

C2.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool executes an API request but fails to describe critical traits such as authentication requirements, error handling, rate limits, side effects (e.g., whether it modifies data), or response format. This leaves significant gaps for a tool that could perform destructive operations like DELETE.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that gets straight to the point without unnecessary words. It's appropriately sized for a general-purpose tool, though it could be more front-loaded with key details if it were more comprehensive.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of executing arbitrary API requests (with potential for mutations, auth needs, etc.), no annotations, and no output schema, the description is incomplete. It doesn't address behavioral aspects, return values, or usage context, making it inadequate for safe and effective tool selection by an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the input schema already documents all 5 parameters thoroughly. The description adds no additional meaning beyond what's in the schema (e.g., it doesn't clarify parameter interactions or provide examples), resulting in a baseline score of 3 where the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the action ('execute') and resource ('API request to a specific endpoint'), which provides a basic purpose. However, it lacks specificity about what kind of API or system this targets, and it doesn't clearly differentiate from sibling tools like 'fetch_swagger_info' or 'validate_api_response', which might involve similar API interactions but for different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context (e.g., for testing or production calls), or exclusions, leaving the agent to infer usage based on the generic name and parameters alone, which is insufficient given the presence of sibling tools like 'get_endpoint_details' or 'list_endpoints'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

fetch_swagger_infoC

Fetch Swagger/OpenAPI documentation to discover available API endpoints

ParametersJSON Schema
NameRequiredDescriptionDefault
urlNoURL to the swagger.json or swagger.yaml file. If not provided, will try to use the base URL with common Swagger paths.

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't describe how it behaves—such as whether it makes network requests, handles errors, returns structured data, or has any side effects. This leaves significant gaps for an agent to understand the tool's operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that efficiently conveys the tool's purpose without any wasted words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete for a tool that likely returns complex API documentation. It doesn't explain what the output looks like (e.g., JSON/YAML structure), potential errors, or how it interacts with sibling tools, leaving the agent with insufficient context for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, so the schema already documents the single parameter ('url') adequately. The description adds no additional meaning or context about the parameter beyond what's in the schema, such as examples or constraints, but this is acceptable given the high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('fetch') and resource ('Swagger/OpenAPI documentation'), and indicates what it's used for ('to discover available API endpoints'). However, it doesn't explicitly differentiate this from sibling tools like 'list_endpoints' or 'get_endpoint_details', which might have overlapping functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'list_endpoints' or 'get_endpoint_details'. It mentions the purpose but doesn't specify scenarios, prerequisites, or exclusions that would help an agent choose between these related tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_endpoint_detailsB

Get detailed information about a specific API endpoint

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesThe endpoint path to get details for (e.g., '/users/{id}')
methodYesThe HTTP method (GET, POST, PUT, DELETE, etc.)

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves information, implying a read-only operation, but doesn't specify aspects like authentication requirements, rate limits, error handling, or the format of the returned details. This is a significant gap for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. Every part earns its place by directly stating the tool's function, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (2 required parameters, no output schema, no annotations), the description is minimally adequate. It clarifies the purpose but lacks behavioral details and usage guidelines. Without an output schema, it doesn't explain return values, which could be a gap, but the description focuses on the input aspect, making it borderline complete for a basic read operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with clear descriptions for both parameters ('path' and 'method'), so the schema does the heavy lifting. The description adds no additional parameter semantics beyond implying that these inputs identify a 'specific API endpoint', which is already inferred from the schema. Baseline 3 is appropriate as the schema provides adequate documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('detailed information about a specific API endpoint'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'fetch_swagger_info' or 'list_endpoints', which likely provide similar API information but with different scopes or formats.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. With siblings like 'fetch_swagger_info' (which might retrieve broader API documentation) and 'list_endpoints' (which might list endpoints without details), the description lacks context for selection, leaving the agent to infer usage based on tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_endpointsB

List all available API endpoints after fetching Swagger documentation

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that endpoints are listed 'after fetching Swagger documentation', hinting at a dependency or sequence, but it doesn't describe what 'list' entails (e.g., format, pagination, or if it's a read-only operation). For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action ('List all available API endpoints') and adds necessary context ('after fetching Swagger documentation'). There is no wasted verbiage, and every part of the sentence contributes to understanding the tool's purpose and sequence.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity is low (0 parameters, no output schema), the description is adequate but has gaps. It covers the purpose and hints at a sequence, but without annotations or output schema, it lacks details on behavior (e.g., what 'list' returns, any side effects). For a simple listing tool, it's minimally viable but could be more complete by clarifying the output or dependencies.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% description coverage, so the schema fully documents the lack of inputs. The description doesn't need to add parameter details, and it appropriately doesn't mention any. Baseline is 4 for 0 parameters, as the description doesn't introduce confusion or redundancy.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List all available API endpoints') and the resource ('API endpoints'), making the purpose immediately understandable. It distinguishes itself from siblings like 'fetch_swagger_info' by specifying it operates 'after fetching Swagger documentation', though it doesn't explicitly contrast with all siblings like 'get_endpoint_details'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by mentioning 'after fetching Swagger documentation', suggesting a prerequisite or sequence, but it doesn't provide explicit guidance on when to use this tool versus alternatives like 'get_endpoint_details' or 'execute_api_request'. No exclusions or clear alternatives are stated, leaving usage context somewhat vague.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

validate_api_responseB

Validate an API response against the schema from Swagger documentation

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesThe endpoint path
methodYesThe HTTP method
statusCodeYesThe HTTP status code
responseBodyYesThe response body to validate

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool validates responses but doesn't explain how validation works (e.g., returns validation errors, success/failure status), what happens on failure, or any side effects. For a validation tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded and wastes no space, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (4 parameters, validation logic) and lack of annotations or output schema, the description is minimally adequate. It covers the basic purpose but fails to provide critical context like validation outcomes, error handling, or integration with sibling tools, leaving gaps for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting all four parameters (path, method, statusCode, responseBody). The description adds no additional parameter semantics beyond what the schema provides, such as format examples or constraints. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Validate an API response against the schema from Swagger documentation'. It specifies the verb 'validate' and the resource 'API response', making it understandable. However, it doesn't explicitly differentiate from sibling tools like 'execute_api_request' or 'fetch_swagger_info', which might handle related but distinct operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing Swagger documentation loaded), context (e.g., after an API call), or exclusions. With siblings like 'execute_api_request' and 'fetch_swagger_info', this lack of differentiation leaves usage ambiguous.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 5 tool updates
    • First observedexecute_api_request
    • First observedfetch_swagger_info
    • First observedget_endpoint_details
    • First observedlist_endpoints
    • First observedvalidate_api_response

TDQS

A3.5/5.0

Scored across 5 tools

Disambiguation5/5

Each tool has a clearly distinct purpose with no overlap: fetching documentation, listing endpoints, getting endpoint details, executing requests, and validating responses. The descriptions make it easy to tell them apart, as they target different stages of the API workflow.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern (e.g., fetch_swagger_info, list_endpoints, execute_api_request). The naming is predictable and readable throughout, with no deviations in style or convention.

Tool Count5/5

With 5 tools, the server is well-scoped for its purpose of interacting with Swagger/OpenAPI documentation and APIs. Each tool earns its place by covering distinct aspects of the workflow, from discovery to execution and validation.

Completeness5/5

The tool set provides complete coverage for the domain: it supports fetching documentation, listing and detailing endpoints, executing requests, and validating responses. There are no obvious gaps, and agents can handle the full API lifecycle without dead ends.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers