Swagger MCP Server

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Uses .ENV files for configuration management, allowing users to set server parameters and authentication credentials through environment variables.

  • Ingests Swagger/OpenAPI specifications and automatically generates MCP tools from API endpoints, supporting multiple authentication methods including Basic Auth, Bearer Token, API Key, and OAuth2.

Swagger MCP 서버

MCP(Model Context Protocol)를 통해 Swagger/OpenAPI 사양을 수집하고 제공하는 서버입니다.

특징

  • Swagger/OpenAPI 사양을 로드합니다.
  • 다양한 인증 방법을 지원합니다:
    • 기본 인증
    • 베어러 토큰
    • API 키(헤더 또는 쿼리)
    • OAuth2
  • API 엔드포인트에서 MCP 도구를 자동으로 생성합니다.
  • 실시간 통신을 위한 SSE(Server-Sent Events) 지원
  • TypeScript 지원

보안

이것은 개인 서버입니다!! 공개 인터넷에 노출하지 마세요. 기본 API에 인증이 필요한 경우, MCP 서버를 공개 인터넷에 노출해서는 안 됩니다.

할 일

  • 비밀 - MCP 서버는 사용자의 비밀을 사용하여 API에 대한 요청을 인증할 수 있어야 합니다.
  • 포괄적인 테스트 모음

필수 조건

  • Node.js(v18 이상)
  • Yarn 패키지 관리자
  • 타입스크립트

설치

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

지엑스피1

  1. 종속성 설치:
yarn install
  1. 다음 예를 기반으로 .env 파일을 만듭니다.
cp .env.example .env
  1. Swagger/OpenAPI 사양을 구성하세요.
    • 프로젝트에 Swagger 파일을 넣으세요(예: swagger.json )
    • 또는 Swagger 사양에 대한 URL을 제공하세요.
  2. config.json 의 구성을 서버 설정으로 업데이트합니다.
{ "server": { "host": "localhost", "port": 3000 }, "swagger": { "url": "url-or-path/to/your/swagger.json", "apiBaseUrl": "https://api.example.com", // Fallback if not specified in Swagger "defaultAuth": { // Fallback if not specified in Swagger "type": "apiKey", "apiKey": "your-api-key", "apiKeyName": "api_key", "apiKeyIn": "header" } } }

참고: 서버는 구성 파일보다 Swagger 사양의 설정을 우선시합니다.

  • Swagger 파일에 servers 배열이 포함되어 있는 경우 첫 번째 서버 URL이 기본 URL로 사용됩니다.
  • Swagger 파일이 보안 체계를 정의하는 경우 인증에 사용됩니다.
  • Swagger 파일에 지정되지 않은 경우 구성 파일 설정은 대체 수단으로 사용됩니다.

용법

  1. 개발 서버를 시작합니다.
yarn dev
  1. 프로덕션을 위해 빌드:
yarn build
  1. 프로덕션 서버를 시작합니다.
yarn start

API 엔드포인트

  • GET /health - 서버 상태 확인
  • GET /sse - 서버에서 보낸 이벤트 연결 설정
  • POST /messages - MCP 서버로 메시지 보내기

테스트

테스트 모음을 실행합니다.

# Run tests once yarn test # Run tests in watch mode yarn test:watch # Run tests with coverage report yarn test:coverage

입증

서버는 다양한 인증 방법을 지원합니다. Swagger 파일에 지정되지 않은 경우 config.json 파일에서 대체 방법으로 설정하세요.

기본 인증

{ "defaultAuth": { "type": "basic", "username": "your-username", "password": "your-password" } }

베어러 토큰

{ "defaultAuth": { "type": "bearer", "token": "your-bearer-token" } }

API 키

{ "defaultAuth": { "type": "apiKey", "apiKey": "your-api-key", "apiKeyName": "X-API-Key", "apiKeyIn": "header" } }

OAuth2

{ "defaultAuth": { "type": "oauth2", "token": "your-oauth-token" } }

개발

  1. 개발 서버를 시작합니다.
yarn dev

특허

이 프로젝트는 Apache 2.0 라이선스에 따라 라이선스가 부여되었습니다.

환경 변수

  • PORT : 서버 포트(기본값: 3000)
  • API_USERNAME : API 인증을 위한 사용자 이름(대체)
  • API_PASSWORD : API 인증을 위한 비밀번호(대체)
  • API_TOKEN : 인증을 위한 API 토큰(폴백)
  • DEFAULT_API_BASE_URL : API 엔드포인트의 기본 URL(대체)
  • DEFAULT_SWAGGER_URL : 기본 Swagger 사양 URL
-
security - not tested
A
license - permissive license
-
quality - not tested

모델 컨텍스트 프로토콜(MCP)을 통해 Swagger/OpenAPI 사양이 있는 모든 API와 상호 작용할 수 있는 서버로, API 엔드포인트에서 도구를 자동으로 생성하고 여러 인증 방법을 지원합니다.

  1. Features
    1. Security
      1. TODO
        1. Prerequisites
          1. Installation
            1. Usage
              1. API Endpoints
                1. Testing
                  1. Authentication
                    1. Basic Auth
                    2. Bearer Token
                    3. API Key
                    4. OAuth2
                  2. Development
                    1. License
                      1. Environment Variables
                        ID: ekf8s6cdjk