Stop drowning your LLM in API documentation. This MCP server gives LLMs intelligent, progressive access to OpenAPI specs without overwhelming their context windows.
{
"openapi-context": { // name it whatever you want
"command": "docker",
"args": [
"run", "--rm", "-i",
"-v", "/path/to/your/openapi.yaml:/app/spec:ro", // filepath + :/app/spec:ro
"djankies/openapi-context:latest"
]
}
}That's it. Your LLM now has API hotwheels.
I wanted to create a tool that was more effective at helping LLMs efficiently navigate and retrieve laser-scoped information from OpenAPI specs without overwhelming their context windows. LLMs start with high-level overviews, then drill down only into what they need, being naturally guided by the tools the whole way.
- π Full OpenAPI specs can be 1000s of lines
- π€― LLMs get overwhelmed with unnecessary details
- πΈ Wastes context tokens on irrelevant information
- π LLMs don't know how to use openapi tools correctly
- π Progressive exploration that guides LLMs naturally
- π§ Built-in intelligence that helps LLMs make correct tool choices
- π¦ Automatic simplification without losing essential information
- π― Error messages that guide LLMs to the right next step
Every tool description is dynamically generated to include context about the loaded API:
list_operations: "List all endpoints from Petstore API v1.0.0"
get_operation_details: "Get details for operations in Petstore API v1.0.0"
LLMs always know which API they're working with and what tools are relevant.
Every error includes the exact next step:
**Operation Not Found**
Operation not found: createUser
π‘ Use `list_operations()` to see available operations or call `help()` for usage guidance.LLMs never get stuck - they always know how to recover.
The tool design naturally guides LLMs through efficient exploration:
list_tagsβ See API structureget_operation_summaryβ Quick overview without schemasget_request_schemaβ Details only when needed
- Collapses duplicate examples
- Simplifies UUID patterns:
[0-9a-f]{8}-[0-9a-f]{4}-...βuuid - Flattens complex
allOfstructures - Removes redundant descriptions
// LLM can request minimal info
get_operation_details({ operation_id: "createUser", detail_level: "minimal" })
// Or specific fields only
get_operation_details({ operation_id: "createUser", fields: ["parameters"] })
// Or compact schemas
get_request_schema({ operation_id: "createUser", compact: true })
// Returns: "Type: object { name: string, email: string (email) }"Large schemas include navigation hints:
Page 1 of 3 (showing 0-2000 of 5432 chars)
Use index=2000 to continue reading.
**Missing Parameters**
Please provide either `operation_id` or both `method` and `path`.
π‘ Need help with tool usage? Call the `help` tool for detailed parameter guidance.The ping helps the llm verify the server is actually responsive when receiving errors. This prevents extraneous calls to the tool.
**Server Status**
Status: Ready
OpenAPI Spec: Loaded (Petstore API v1.0.0)
Ready to process queries.- π·οΈ
list_tags- See API categories with operation counts - π
list_operations- List endpoints with filtering and compact mode - π
search_operations- Find endpoints by keyword - π
get_operation_summary- Quick overview without full schemas
- π©»
get_operation_details- Full endpoint info with customizable detail levels - π€
get_request_schema- Request schemas with pagination and compact mode - π₯
get_response_schema- Response schemas by status code - π
get_operation_examples- Example payloads when available - π
get_auth_requirements- Authentication details with examples - βΉοΈ
get_server_info- API metadata and statistics
- π
ping- Check server responsiveness - β
help- Comprehensive guidance with current context
// 1. Understand API structure (3 lines)
list_tags()
// β "Users (12 operations), Orders (8 operations), Auth (3 operations)"
// 2. Find relevant operations (10 lines)
list_operations({ filter: "Users", compact: true })
// β "GET /users - List users\nPOST /users - Create user..."
// 3. Get overview before diving deep (5 lines)
get_operation_summary({ operation_id: "createUser" })
// β "POST /users\nParameters: body: required\nRequired: name, email\nAuth: api_key"
// 4. Get details only when needed (1 line with compact mode)
get_request_schema({ operation_id: "createUser", compact: true })
// β "Type: object { name: string, email: string (email), age?: number }"The server provides three detail levels that LLMs can choose based on their needs:
minimal: Just operation signatures and required fieldsstandard: Simplified schemas without patterns (default)full: Complete details including patterns and examples
When schemas are large, LLMs receive clear continuation instructions:
Page 1 of 3 (showing 0-2000 of 5432 chars)
...content...
Use index=2000 to continue reading.
{
"openapi-context": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-v", "/path/to/your/spec.yaml:/app/spec:ro",
"djankies/openapi-context:latest"
]
}
}Each API gets its own instance with dedicated tool contexts:
{
"users-api": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-v", "/path/to/users-api.yaml:/app/spec:ro",
"djankies/openapi-context:latest"
]
},
"orders-api": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-v", "/path/to/orders-api.yaml:/app/spec:ro",
"djankies/openapi-context:latest"
]
}
}| Variable | Description | Default |
|---|---|---|
LOG_LEVEL |
Logging verbosity (error, warn, info, debug) |
info |
MAX_SPEC_SIZE |
Maximum OpenAPI spec file size in MB | 10 |
MCP_MODE |
Server mode (stdio for MCP, http for debugging) |
stdio |
Test the server independently:
docker run --rm -p 3000:3000 \
-e MCP_MODE=http \
-v "/path/to/spec.yaml:/app/spec:ro" \
djankies/openapi-context:latestAccess health check at http://localhost:3000/health
# Install dependencies
npm install
# Run tests
npm test
# Development mode
npm run dev
# Full CI pipeline
npm run ci- OpenAPI 3.1 specifications
- File extensions:
.yaml,.yml,.json - Auto-detects format from content
MIT License - see LICENSE file for details.