MCP REST Server
Provides REST API client functionality for interacting with GitHub's API, supporting endpoint discovery through OpenAPI documentation and authenticated requests for managing repositories, issues, and other GitHub resources.
Enables automatic endpoint discovery and documentation parsing from OpenAPI/Swagger specifications, allowing dynamic exploration and interaction with any REST API that provides Swagger documentation.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP REST Server configure with baseUrl https://api.github.com and token auth, then get my user profile"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP REST Server
A Model Context Protocol (MCP) server that provides REST API client functionality with authentication support and Swagger documentation integration.
Features
Multiple Authentication Methods: Support for both token-based and login-based authentication
Swagger Integration: Automatic endpoint discovery and documentation from OpenAPI/Swagger specs
Automatic Token Management: Handles token refresh and re-authentication
Comprehensive HTTP Methods: Support for GET, POST, PUT, DELETE, and PATCH requests
Error Handling: Robust error handling with retry logic
MCP Compatible: Fully compatible with the Model Context Protocol
Related MCP server: swagger-mcp-server
Installation
npm install
npm run buildDevelopment
npm run devConfiguration
The server supports two authentication methods:
Token Authentication
{
"baseUrl": "https://api.example.com",
"swaggerUrl": "https://api.example.com/swagger.json",
"auth": {
"type": "token",
"token": "your-api-token-here"
},
"timeout": 30000,
"retries": 3
}Login Authentication
{
"baseUrl": "https://api.example.com",
"swaggerUrl": "https://api.example.com/swagger.json",
"auth": {
"type": "login",
"username": "your-username",
"password": "your-password",
"loginEndpoint": "/auth/login",
"tokenField": "access_token"
},
"timeout": 30000,
"retries": 3
}Available Tools
1. configure_rest_client
Configure the REST client with authentication and API details.
Parameters:
baseUrl(required): Base URL for the REST APIauth(required): Authentication configuration (token or login)swaggerUrl(optional): URL to Swagger/OpenAPI documentationtimeout(optional): Request timeout in milliseconds (default: 30000)retries(optional): Number of retries for failed requests (default: 3)
2. http_request
Make HTTP requests to the configured API.
Parameters:
method(required): HTTP method (GET, POST, PUT, DELETE, PATCH)path(required): API endpoint pathparams(optional): Query parameters or request body parametersbody(optional): Request body for POST, PUT, PATCH requestsheaders(optional): Additional headers
3. get_swagger_documentation
Get the complete list of available endpoints from Swagger documentation.
4. search_endpoints
Search for endpoints in the Swagger documentation.
Parameters:
query(required): Search query to find matching endpoints
5. get_endpoint_info
Get detailed information about a specific endpoint.
Parameters:
path(required): Endpoint pathmethod(required): HTTP method
6. check_authentication
Check if the client is currently authenticated.
7. logout
Logout and clear authentication state.
Usage Examples
Basic Setup
Configure the client:
{
"baseUrl": "https://jsonplaceholder.typicode.com",
"auth": {
"type": "token",
"token": "dummy-token"
}
}Make a GET request:
{
"method": "GET",
"path": "/posts/1"
}Make a POST request:
{
"method": "POST",
"path": "/posts",
"body": {
"title": "New Post",
"body": "Post content",
"userId": 1
}
}With Swagger Documentation
{
"baseUrl": "https://petstore.swagger.io/v2",
"swaggerUrl": "https://petstore.swagger.io/v2/swagger.json",
"auth": {
"type": "token",
"token": "your-api-key"
}
}Then you can:
Search endpoints:
search_endpointswith query "pet"Get endpoint info:
get_endpoint_infowith path "/pet" and method "POST"View all documentation:
get_swagger_documentation
Authentication Flow
Token Authentication
Token is stored and used immediately
Added to requests as
Authorization: Bearer <token>If 401 received, no automatic retry (token assumed invalid)
Login Authentication
Makes login request to specified endpoint
Extracts token from response using
tokenFieldStores token in memory
Adds token to subsequent requests
If 401 received, automatically re-authenticates and retries
Error Handling
Network errors: Automatic retry with exponential backoff
Authentication errors: Automatic re-authentication for login-based auth
Validation errors: Clear error messages with details
API errors: HTTP status and error message forwarding
Development
Project Structure
src/
├── types.ts # TypeScript type definitions
├── auth.ts # Authentication manager
├── swagger.ts # Swagger documentation parser
├── rest-client.ts # REST client implementation
└── index.ts # MCP server implementationBuilding
npm run buildRunning
npm startMCP Client Configuration
The MCP REST server now supports automatic configuration through multiple methods, eliminating the need to configure APIs manually for each project.
Configuration Methods (in order of priority)
Command Line Arguments (highest priority)
Environment Variables
Configuration File
Manual Configuration (via MCP tools - lowest priority)
Cursor Configuration
Option 1: Auto-Configuration with Environment Variables (Recommended)
{
"mcpServers": {
"mcp-rest-github": {
"command": "node",
"args": ["/path/to/your/mcp-rest/dist/index.js"],
"env": {
"MCP_REST_BASE_URL": "https://api.github.com",
"MCP_REST_AUTH_TYPE": "token",
"MCP_REST_TOKEN": "your-github-token-here",
"MCP_REST_SWAGGER_URL": "https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json"
}
},
"mcp-rest-petstore": {
"command": "node",
"args": ["/path/to/your/mcp-rest/dist/index.js"],
"env": {
"MCP_REST_BASE_URL": "https://petstore.swagger.io/v2",
"MCP_REST_AUTH_TYPE": "token",
"MCP_REST_TOKEN": "your-api-key",
"MCP_REST_SWAGGER_URL": "https://petstore.swagger.io/v2/swagger.json"
}
}
}
}Option 2: Auto-Configuration with Config Files
{
"mcpServers": {
"mcp-rest-github": {
"command": "node",
"args": ["/path/to/your/mcp-rest/dist/index.js", "--config", "/path/to/your/mcp-rest/examples/github-api.json"]
},
"mcp-rest-petstore": {
"command": "node",
"args": ["/path/to/your/mcp-rest/dist/index.js", "--config", "/path/to/your/mcp-rest/examples/petstore.json"]
}
}
}Option 3: Auto-Configuration with Command Line Arguments
{
"mcpServers": {
"mcp-rest-github": {
"command": "node",
"args": [
"/path/to/your/mcp-rest/dist/index.js",
"--base-url", "https://api.github.com",
"--auth-type", "token",
"--token", "your-github-token-here",
"--swagger-url", "https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json"
]
}
}
}Claude Desktop Configuration
Location:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Use the same configuration options as Cursor above.
Configuration Examples
The project includes several example configurations in the examples/ directory:
examples/github-api.json- GitHub API configurationexamples/petstore.json- Swagger Petstore API configurationexamples/jsonplaceholder.json- JSONPlaceholder API configuration
Environment Variables
Variable | Description |
| Base URL for the REST API (required) |
| Authentication type: 'token' or 'login' (required) |
| API token (required for token auth) |
| Username (required for login auth) |
| Password (required for login auth) |
| Login endpoint path (required for login auth) |
| Token field name in login response (default: access_token) |
| URL to Swagger/OpenAPI documentation |
| Request timeout in milliseconds (default: 30000) |
| Number of retries for failed requests (default: 3) |
| Path to JSON configuration file |
Note: Replace /path/to/your/mcp-rest/ with the actual path to your MCP REST server directory.
Usage in Claude/Cursor
With Auto-Configuration (Recommended)
If you've configured the server with auto-configuration (environment variables, CLI args, or config file), the server will be ready to use immediately:
Make a GET request to /posts/1
Show me all available endpoints
Search for endpoints related to "user"With Manual Configuration
If you haven't provided auto-configuration, you can still configure the client manually:
Configure the client first:
Please configure the REST client with:
- Base URL: https://api.example.com
- Authentication: token
- Token: your-api-token-here
- Swagger URL: https://api.example.com/swagger.jsonThen make API requests:
Make a GET request to /users/123Testing the Configuration
You can test your configuration before using it in Claude/Cursor:
# Test with config file
node dist/index.js --config examples/jsonplaceholder.json
# Test with CLI arguments
node dist/index.js --base-url https://api.github.com --auth-type token --token your-token
# Test with environment variables
MCP_REST_BASE_URL=https://httpbin.org MCP_REST_AUTH_TYPE=token MCP_REST_TOKEN=test node dist/index.jsIf you see "✅ Auto-configured REST client for [URL]", the configuration is working correctly.
License
MIT
Available Tools
7 toolscheck_authenticationB
Check if the client is currently authenticated
Inputs: no named parameters.
configure_rest_clientC
Configure the REST client with base URL, authentication, and optional Swagger documentation URL
Inputs: baseUrl (required), auth (required), swaggerUrl, timeout, +1 more.
get_endpoint_infoC
Get detailed information about a specific endpoint
Inputs: path (required), method (required).
get_swagger_documentationA
Get the complete Swagger/OpenAPI documentation for available endpoints
Inputs: no named parameters.
http_requestB
Make an HTTP request to the configured API
Inputs: method (required), path (required), params, body, +1 more.
logoutA
Logout and clear authentication state
Inputs: no named parameters.
search_endpointsB
Search for endpoints in the Swagger documentation
Inputs: query (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool has a distinct purpose: authentication checking, configuration, endpoint info, documentation retrieval, HTTP requests, logout, and endpoint search. No overlap.
All tool names follow the verb_noun snake_case pattern (e.g., check_authentication, get_endpoint_info), ensuring predictability.
7 tools cover the core functionality of a REST client server without being excessive or sparse, aligning well with the server's scope.
The tool set covers authentication lifecycle, API documentation exploration, and HTTP requests. Missing features like configuration management (e.g., updating base URL without reconfiguring) are minor.
Maintenance
Related MCP Connectors
Turn any task into the right API calls: discover, evaluate, and integrate public APIs.
Remote MCP for 1,500+ APIs. Vault-managed credentials; OAuth or API key. Search, load, and execute.
Find, document and execute authenticated API calls across 1000+ apps via one MCP server
Connect AI agents to 580+ APIs with OAuth or API-key auth. Hosted gateway; API pricing varies.
Related MCP Servers
- AlicenseAqualityDmaintenanceExposes Swagger/OpenAPI API documentation to AI models, enabling exploration, search, and interaction with endpoints, schemas, and execution of API calls.1420 npm2MIT
- AlicenseNot gradedqualityDmaintenanceEnables natural language interaction with any Swagger/OpenAPI-defined API, allowing discovery, parameterized calls, and automated testing through large language models.5Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to discover, search, and call any REST API described by an OpenAPI or Swagger document. Supports multiple API endpoints with authentication and parameter handling.27 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables AI coding agents to discover and use Swagger/OpenAPI operations, schemas, and endpoints from configured sources, with optional API request execution and environment-based authentication.19 npm1MIT