MCP server by Ompatil7026
API Docs MCP - Local Configuration
This project provides a pre-configured setup for the api-docs-mcp server to interact with a local Java backend. It allows any MCP-compatible tool (like Antigravity or Gemini-CLI) to explore and understand the API documentation of the local service.
Setup Overview
The core of this setup is the api-docs-mcp server, which fetches OpenAPI definitions from a local service running at http://localhost:8080/v3/api-docs.
Components
api-docs-mcp-repo/: The local clone of the MCP server.antigravity-mcp-config.json: Configuration file for the Antigravity MCP client.bearer-auth-token.txt: Contains the JWT token used for authorized access to the API documentation.debug-mcp.js: A utility script to verify the MCP configuration and cache status.
Installation & Build
-
Ensure the Backend is Running: The local Java server should be active at
http://localhost:8080. -
Build the MCP Server: Navigate to the repository and install dependencies:
cd api-docs-mcp-repo npm install npm run build cd ..
Windows Setup
If you are using a Windows machine, follow these adjustments to ensure a smooth setup.
Path Formatting
Windows uses backslashes (\) for paths. In JSON configuration files (like antigravity-mcp-config.json), you must use either double backslashes (\\) or forward slashes (/).
Example for antigravity-mcp-config.json on Windows:
"args": [
"C:/Users/YourName/Documents/API-Docs-MCP-Config/api-docs-mcp-repo/build/index.js"
]
Environment Variables
Setting the API_SOURCES variable differs based on your terminal:
PowerShell:
$env:API_SOURCES='[{"name": "LocalBE", "method": "GET", "url": "http://localhost:8080/v3/api-docs", "headers": {"Authorization": "Bearer YOUR_TOKEN"}, "type": "api"}]'
node debug-mcp.js
Command Prompt (CMD):
set API_SOURCES=[{"name": "LocalBE", "method": "GET", "url": "http://localhost:8080/v3/api-docs", "headers": {"Authorization": "Bearer YOUR_TOKEN"}, "type": "api"}]
node debug-mcp.js
Node.js on Windows
Ensure Node.js is added to your System PATH. You can verify this by running node -v in your terminal. Use the same build steps provided in the Installation & Build section using PowerShell or Git Bash.
Configuration
The MCP server is configured via the API_SOURCES environment variable.
API Sources Definition
The current configuration targets the local backend:
[
{
"name": "LocalBE",
"method": "GET",
"url": "http://localhost:8080/v3/api-docs",
"headers": {
"Authorization": "Bearer <YOUR_JWT_TOKEN>"
},
"type": "api"
}
]
Authentication
The JWT token is stored in bearer-auth-token.txt. When updating the token, you must also update the API_SOURCES environment variable in your MCP client configuration (e.g., antigravity-mcp-config.json).
Tool Integration
Antigravity
Antigravity is configured using the antigravity-mcp-config.json file. It specifies the command to run the MCP server and passes the API_SOURCES (including the token) as an environment variable.
Windows Users: See the Windows Setup section for important notes on path formatting and environment variable escaping in this file.
Gemini-CLI
Gemini-CLI can use this MCP by being pointed to the build/index.js of the repo with the appropriate environment variables. This workspace is already optimized for Gemini-CLI usage.
You can verify the tools are available by running:
/help
And look for mcp_api-docs_api_docs and mcp_api-docs_api_search.
To list all available APIs directly from Gemini-CLI:
# In the chat interface
mcp_api-docs_api_docs(sourceName="LocalBE")
Testing & Debugging
Manual Verification
You can test if the MCP can successfully fetch and parse the API docs by running the debug script:
node debug-mcp.js
This will output the loaded configuration and the count of resources found in the API documentation.
Logs
error.log: Captures runtime errors from the MCP server.mcp-output.log: Standard output logs from the MCP server.
Maintenance
Updating the JWT Token
- Generate a new JWT token from your backend.
- Update
bearer-auth-token.txtwith the new token. - Update the
Authorizationheader inantigravity-mcp-config.json(or your specific tool's environment configuration) with the newBearer <token>string.