Built as a pure JavaScript implementation using ES modules for processing OpenAPI specifications and handling REST API interactions
Runs on Node.js runtime to provide MCP server functionality for transforming OpenAPI specifications into executable tools
Distributed and installed through npm package manager with standard Node.js dependency management
OpenAPI MCP Server (JavaScript)
A pure JavaScript implementation of a Model Context Protocol (MCP) server that transforms OpenAPI 3.x specifications into MCP tools, enabling Large Language Models (LLMs) to interact with REST APIs through the standardized MCP protocol.
Features
Pure JavaScript: Built with Node.js and ES modules
OpenAPI 3.x Support: Automatically converts OpenAPI specifications into MCP tools
Bearer Token Authentication: Supports bearer token authentication for API requests
All HTTP Methods: Supports GET, POST, PUT, DELETE, PATCH, OPTIONS, and HEAD
Configurable Base URL: Accept custom API base URLs
Parameter Validation: Validates tool parameters against OpenAPI schemas
Error Handling: Comprehensive error handling and reporting
CLI Interface: Easy-to-use command-line interface
Installation
Usage
Quick Start
Validate your OpenAPI specification:
Start the MCP server:
Command Line Options
serve
- Start the MCP server
validate
- Validate OpenAPI specification
info
- Show server information
Environment Variables
You can use environment variables instead of command-line arguments:
Configuration
OpenAPI Specification Requirements
Must be OpenAPI 3.x format
JSON format (
.json
extension)Must contain at least one path/operation
Bearer token authentication should be defined in security schemes
Example OpenAPI Security Configuration
Tool Generation
The server automatically converts OpenAPI operations into MCP tools:
Tool Naming
Uses
operationId
if availableFalls back to operation
summary
(sanitized)Last resort:
{method}_{path}
(sanitized)
Parameter Mapping
Path parameters: Required string parameters
Query parameters: Optional parameters based on OpenAPI schema
Header parameters: Prefixed with
header_
Request body: Object properties or
requestBody
parameter
Example Tool
For the UserQueueList.json specification:
MCP Integration
Using with Claude Desktop
Stdio Transport (Default)
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json
):
HTTP Transport
For HTTP transport, configure the server URL instead:
Then start the server separately:
Tool Responses
The server returns structured JSON responses:
Success Response:
Error Response:
Transport Protocols
Stdio Transport
Default transport method
Uses standard input/output streams for communication
Best for integration with Claude Desktop and other MCP clients
Automatic process management
HTTP Transport
Uses HTTP Server-Sent Events (SSE) for communication
Allows remote connections and debugging
Useful for development and testing
Configurable host and port
API Examples
Based on the UserQueueList.json specification:
List Users
List Call Queues
Development
Project Structure
Key Components
MCPServer: Main MCP server class handling tool registration and execution
OpenAPIProcessor: Parses OpenAPI specs and generates tool definitions
HttpClient: Handles HTTP requests with authentication and error handling
CLI: Command-line interface with validation and configuration options
Error Handling
The server provides comprehensive error handling:
Validation Errors: Parameter validation against OpenAPI schemas
HTTP Errors: Proper handling of API error responses
Authentication Errors: Clear messages for auth failures
Network Errors: Timeout and connectivity error handling
Security Considerations
Bearer tokens are handled securely and not logged
Request validation prevents injection attacks
Error messages don't expose sensitive information
HTTPS is recommended for all API communications
Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests if applicable
Submit a pull request
License
MIT License - see LICENSE file for details
Troubleshooting
Common Issues
"Tool not found" errors: Check that your OpenAPI spec is valid and contains the expected operations
Authentication failures: Verify your bearer token is correct and has proper permissions
Network timeouts: Increase timeout or check API endpoint availability
Schema validation errors: Ensure your OpenAPI spec follows 3.x standards
Debug Mode
For detailed logging, you can modify the server to enable debug output:
Validation
Always validate your OpenAPI specification before use:
This will show:
✅ Validation status
📄 Specification details
🔧 Available tools
🔐 Security schemes
🌐 Base URL information
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Transforms OpenAPI 3.x specifications into MCP tools, enabling Large Language Models to interact with REST APIs through standardized MCP protocol. Supports bearer token authentication and all HTTP methods for seamless API integration.