This is a custom Auto-MCP server in Python that:
- Dynamically creates MCP tools from an OpenAPI specification
- Handles SSL verification disabling for internal API requests
- Provides smart default values for required parameters
- Exposes tools to MCP-compatible IDEs like Windsurf via HTTP
- Dynamic Tool Registration: Automatically creates MCP tools from OpenAPI endpoints
- Smart Default Values: Generates appropriate default values for required parameters
- SSL Verification Control: Disables SSL verification for internal API requests
- Enhanced Error Handling: Provides structured error responses
- Detailed Logging: Logs API requests and responses for debugging
- Flexible Configuration: Supports environment variables and command-line arguments
├── main.py # Main entry point
├── resources/ # Resource files
│ └── ted-spec.json # Default OpenAPI specification
├── src/ # Source code
│ ├── core/ # Core functionality
│ │ └── server.py # Server implementation
│ ├── config/ # Configuration
│ │ └── openapi_config.py # OpenAPI configuration
│ ├── tools/ # MCP tools
│ │ ├── health_check.py # Health check tool
│ │ └── openapi_loader.py # OpenAPI tools loader
│ ├── utils/ # Utility functions
│ │ └── spec_parser.py # OpenAPI spec parser
│ └── tests/ # Test scripts
│ └── test_openapi_loader.py # Test for OpenAPI loader
└── requirements.txt # Dependencies
The server determines the OpenAPI specification URL in the following order of priority:
- Command-line argument (
--spec) - Environment variable (
OPENAPI_SPEC_URL)
Note: You must provide an OpenAPI specification URL using one of the above methods.
- Install requirements:
pip install -r requirements.txt- Run the server with an OpenAPI spec URL:
python main.py --spec https://example.com/api-spec.json- Run with custom settings:
python main.py --spec https://example.com/api-spec.json --base-url https://api.example.com --host localhost --port 8084 --path /mcp- You can specify additional options:
python main.py --spec path/to/spec.json --base-url https://api.example.com- Run tests:
python -m src.tests.test_openapi_loader-
Modify configuration in
src/config/openapi_config.pyto customize:- Default headers
- Authentication methods
- Logging behavior
- Default parameter values
- Tool naming conventions
- Endpoint filtering
-
Configure in your IDE's MCP settings:
{
"mcpServers": {
"auto-mcp-python": {
"url": "http://localhost:8083/mcp"
}
}
}You can easily deploy the Auto-MCP server using Docker:
- Build and start the container:
docker-compose up -d- View logs:
docker-compose logs -f- Stop the container:
docker-compose down- Build the Docker image:
docker build -t auto-mcp-python .- Run the container with an OpenAPI spec URL:
docker run -p 8083:8083 -e OPENAPI_SPEC_URL=https://example.com/openapi.json auto-mcp-python- Run with additional configuration options:
docker run -p 8083:8083 -e OPENAPI_SPEC_URL=https://your-api-domain.com/openapi.json -e OPENAPI_BASE_URL=https://api.example.com auto-mcp-pythonNote: The environment variable
OPENAPI_SPEC_URLis required unless you provide a spec URL via command-line arguments.
- Configure in your IDE's MCP settings to connect to the Docker container:
{
"mcpServers": {
"auto-mcp": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:8083/mcp",
"--transport",
"http-only"
],
"env": {
"OPENAPI_SPEC_URL": "https://your-api-domain.com/openapi.json"
}
}
}
}Note: The
envsection in the IDE configuration passes environment variables to the MCP server, allowing you to specify the OpenAPI specification URL without modifying the server code or container.