Universal MCP server for REST & GraphQL APIs - Just 2 simple tools handle everything: all HTTP methods, file uploads/downloads, and auto-detection of content types.
Before (v1.2): 9 confusing tools - rest_api_get, rest_api_post, rest_api_put, rest_api_patch, rest_api_delete, rest_api_upload_file, rest_api_download_file, rest_api_form_urlencoded, rest_api_graphql
Now (v1.3): Just 2 smart tools:
rest_api_request- Handles ALL REST API operationsrest_api_graphql- Handles GraphQL queries/mutations
No more confusion about which tool to use!
- Universal Tool: One tool for all HTTP methods (GET, POST, PUT, PATCH, DELETE)
- Smart Auto-Detection: Automatically detects JSON, form-urlencoded, or multipart file uploads
- File Uploads: Upload images, documents via multipart/form-data
- File Downloads: Auto-saves binary responses (images, PDFs, etc.)
- All Auth Types: API Key, Bearer Token, Basic Auth
- Retry Logic: Automatic exponential backoff for network errors
- GraphQL: Full support for queries, mutations, variables
- Fixed Hugging Face: Now works with image generation APIs (Accept: /)
npm install -g rest-api-mcp-serverOr locally:
npm install rest-api-mcp-serverAdd to your MCP settings (e.g., Claude Desktop config):
{
"mcpServers": {
"rest-api": {
"command": "rest-api-mcp-server"
}
}
}Handles everything: GET, POST, PUT, PATCH, DELETE, file uploads, file downloads, form submissions.
Key Parameters:
url(required): Full URLmethod(optional): GET, POST, PUT, PATCH, DELETE (default: GET)body(optional): Request body (auto-detects JSON/form/multipart)saveResponseTo(optional): File path to save binary responsecontentType(optional): Override auto-detectionheaders,queryParams,timeout: Standard options- Auth:
authType,bearerToken,apiKey,username,password
Examples:
Simple GET:
{
"url": "https://api.example.com/users",
"method": "GET"
}POST JSON:
{
"url": "https://api.example.com/users",
"method": "POST",
"body": {
"name": "John Doe",
"email": "john@example.com"
},
"bearerToken": "your-token"
}Upload File:
{
"url": "https://api.example.com/upload",
"method": "POST",
"body": {
"files": [
{
"path": "C:\\Users\\Name\\image.jpg",
"fieldName": "file",
"mimeType": "image/jpeg"
}
]
},
"bearerToken": "your-token"
}Download Image (e.g., Hugging Face):
{
"url": "https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-dev",
"method": "POST",
"body": {
"inputs": "A cat in a sunbeam"
},
"saveResponseTo": "C:\\Users\\Name\\generated_cat.png",
"bearerToken": "hf_xxxxx",
"timeout": 60000
}Form Submission (OAuth):
{
"url": "https://oauth.example.com/token",
"method": "POST",
"body": {
"grant_type": "client_credentials",
"client_id": "xxx",
"client_secret": "yyy"
},
"contentType": "application/x-www-form-urlencoded"
}Execute GraphQL queries and mutations.
Key Parameters:
url(required): GraphQL endpointquery(required): GraphQL query/mutation stringvariables(optional): Variables objectoperationName(optional): Operation namehttpMethod(optional): GET or POST (default: POST)- Auth: Same as rest_api_request
Example:
{
"url": "https://api.example.com/graphql",
"query": "query GetUser($id: ID!) { user(id: $id) { name email } }",
"variables": {
"id": "123"
},
"bearerToken": "your-token"
}- Removed:
rest_api_get,rest_api_post,rest_api_put,rest_api_patch,rest_api_delete - Removed:
rest_api_upload_file,rest_api_download_file,rest_api_form_urlencoded - Added: Single
rest_api_requestthat does it all
- Fixed
Accept: */*header (now works with Hugging Face image generation) - Auto-detects content type from body structure
- Auto-saves binary responses when
saveResponseToprovided
Much clearer! No more confusion about:
- When to use
rest_api_getvsrest_api_download_file - When to use
rest_api_postvsrest_api_upload_filevsrest_api_form_urlencoded
Now: Just use rest_api_request with the appropriate parameters!
npm test- Fetch API data: Simple GET with auth
- Create resources: POST with JSON body
- Update resources: PUT/PATCH with JSON
- Delete resources: DELETE with auth
- Upload files: POST with multipart (auto-detected)
- Download files: Any method +
saveResponseTo - OAuth tokens: POST form-urlencoded (auto-detected)
- GraphQL APIs: Queries and mutations with variables
- AI Image Generation: Hugging Face, Replicate, etc.
MIT
Issues and PRs welcome at GitHub
- v1.3.0: Consolidated 9 tools into 2; Fixed Accept header; Auto-detection
- v1.2.0: Added GraphQL support
- v1.1.0: Added file upload/download, form-urlencoded, retry logic
- v1.0.0: Initial release with basic REST methods