
dcolley/swagger-mcp
API development이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
dcolley/swagger-mcp는 [[T0]에서 임포트된 MCP 서버 후보입니다.
개요
dcolley/swagger-mcp는 [[T0]에서 임포트된 MCP 서버 후보입니다.
개요(AI 번역)
Model Context Protocol(MCP)을 통해 Swagger/OpenAPI 사양을 수집하고 제공하는 서버입니다.
특징
- Swagger/OpenAPI 사양 로드
- 다중 인증 방법 지원:
- 기본 인증
- 소지자 토큰
- API 키(헤더 또는 쿼리)
- OAuth2
- API 엔드포인트에서 MCP 도구를 자동으로 생성합니다
- 실시간 통신을 위한 서버-전송 이벤트(SSE) 지원
- TypeScript 지원
보안
이건 개인 서버입니다!! 공개 인터넷에 노출하지 마세요. 기본 API가 인증을 요구한다면, MCP 서버를 공개 인터넷에 노출해서는 안 됩니다.
토할
- 비밀 - MCP 서버는 사용자의 비밀을 사용해 API에 대한 요청을 인증할 수 있어야 합니다
- 종합 테스트 스위트
선수 조건
- Node.js (v18 이상)
- 실 패키지 관리자
- TypeScript
설치
-
저장소 복제:
-
의존성 설치:
-
예를 기반으로
.env파일 생성: -
Swagger/OpenAPI 명세를 구성하세요:
- 프로젝트에 Swagger 파일을 배치하세요 (예:
swagger.json) - 또는 Swagger 명세의 URL을 제공하세요
- 서버 설정으로
config.json의 구성을 업데이트하세요:
이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.
README
원문 README의 일부입니다. 원문 보기.
Swagger MCP Server
A server that ingests and serves Swagger/OpenAPI specifications through the Model Context Protocol (MCP).
Features
- Loads Swagger/OpenAPI specifications
- Supports multiple authentication methods:
- Basic Auth
- Bearer Token
- API Key (header or query)
- OAuth2
- Automatically generates MCP tools from API endpoints
- Server-Sent Events (SSE) support for real-time communication
- TypeScript support
Security
This is a personal server!! Do not expose it to the public internet. If the underlying API requires authentication, you should not expose the MCP server to the public internet.
TODO
- secrets - the MCP server should be able to use secrets from the user to authenticate requests to the API
- Comprehensive test suite
Prerequisites
- Node.js (v18 or higher)
- Yarn package manager
- TypeScript
Installation
- Clone the repository:
git clone https://github.com/dcolley/swagger-mcp.git
cd swagger-mcp
- Install dependencies:
yarn install
- Create a
.envfile based on the example:
cp .env.example .env
-
Configure your Swagger/OpenAPI specification:
- Place your Swagger file in the project (e.g.,
swagger.json) - Or provide a URL to your Swagger specification
- Place your Swagger file in the project (e.g.,
-
Update the configuration in
config.jsonwith your server settings:
{
"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"
}
}
}
Note: The server prioritizes settings from the Swagger specification over the config file:
- If the Swagger file contains a
serversarray, the first server URL will be used as the base URL - If the Swagger file defines security schemes, they will be used for authentication
- The config file settings serve as fallbacks when not specified in the Swagger file
Usage
- Start the development server:
yarn dev
- Build for production:
yarn build
- Start the production server:
yarn start
API Endpoints
GET /health- Check server health statusGET /sse- Establish Server-Sent Events connectionPOST /messages- Send messages to the MCP server
Testing
Run the test suite:
# Run tests once
yarn test
# Run tests in watch mode
yarn test:watch
# Run tests with coverage report
yarn test:coverage
Authentication
The server supports various authentication methods. Configure them in the config.json file as fallbacks when not specified in the Swagger file:
Basic Auth
{
"defaultAuth": {
"type": "basic",
"username": "your-username",
"password": "your-password"
}
}
Bearer Token
{
"defaultAuth": {
설치
This server does not publish a one-line install command.
Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →