The MCP REST Bridge allows you to expose any OpenAPI endpoint through the MCP protocol without additional coding or testing. Your existing REST API can be seamlessly accessed by AI tools like Anthropic, Cursor, and Windsurf via MCP.
- sse/stdio transports
- OpenAPI authentication via headers
- Including and excluding paths from the API
- Custom base url for accessing API
npm install mcp-rest
sse mode
npx mcp-rest \
--mode sse \
--api-spec-url "https://api.example.com/v1/openapi.json"
stdio mode
npx mcp-rest \
--mode stdio \
--api-spec-url "https://api.example.com/v1/openapi.json"
Configuration can be provided via environment variables or command line arguments. Environment variables take precedence over command line arguments.
The REST Bridge supports filtering which endpoints from the OpenAPI specification will be exposed as MCP tools, allowing you to control access to specific API endpoints based on your needs.
Environment Variable | Command Line Argument | Description |
---|---|---|
MODE |
--mode |
Run mode (sse or stdio ), required |
API_SPEC_URL |
--api-spec-url |
URL of the OpenAPI specification, required |
API_BASE_URL |
--api-base-url |
Base URL for API requests |
INCLUDE_ENDPOINTS |
--include-endpoints |
Comma-separated list of endpoints to include. Format <PATH>:<METHOD> . Wildcard is supported in match all paths for a method *:GET or all methods for a path /user/{id}:*
|
EXCLUDE_ENDPOINTS |
--exclude-endpoints |
Comma-separated list of endpoints to exclude. Same format as include endpoints. |
AUTHENTICATION |
--authentication |
Authentication in format <type>:<value> where type is one of: Api-Key , X-Api-Key , Bearer , JWT , or Basic
|
NOTE: when using --include-endpoints and --exclude-endpoints, first included endpoints are added to candidates list and then excluded endpoints will be removed from the candidates list.
- FastMCP - MCP server framework
- Release management - release and version management
-
Git Hooks
- lint-staged - linting and formatting
- commitlint - ensure that commit messages follow Conventional Commits schema
- [ ] - Serve binary content
- [ ] - Improve test coverage
- [ ] - Configure endpoints to be exposed as resources
- [ ] - File-based extended configuration