Apidog MCP Server
The Apidog MCP Server allows you to use your API specification from Apidog projects as a data source for AI-powered IDEs like Cursor. This means Agentic AI can directly access and work with your API specification, speeding up development and making your workflow more efficient.
With Apidog MCP Server, developers can leverage the AI assistant to:
- Generate or modify code based on API specification.
- Search through API specification content.
- And much more! Let your imagination and your team's creativity guide you. π
π― How Apidog MCP Server Works?
Once the Apidog MCP Server is set up, it automatically reads and caches all API specification data from your Apidog project on your local machine. The AI can then retrieve and utilize this data seamlessly.
Simply instruct the AI on what youβd like to achieve with the API specification. Here are some examples:
- Generate Code: "Use MCP to fetch the API specification and generate Java records for the 'Product' schema and related schemas".
- Update DTOs: "Based on the API specification, add the new fields to the 'Product' DTO".
- Add Comments: "Add comments for each field in the 'Product' class based on the API specification".
- Create MVC Code: "Generate all the MVC code related to the endpoint '/users' according to the API specification".
π Installation Guide
Prerequisites
- Node.js (version 18 or higher, preferably the latest LTS version).
- An IDE that supports MCP, such as:
- Cursor
- VS Code + Cline plugin
Installation Steps
Step 1. Generate an Access Token in Apidog
- Open Apidog, hover over your avatar at the top-right corner, and click
Account Settings
>API Access Token
. - Create a new API access token (refer to the help documentation for details).
- Copy the access token and replace
<access-token>
in the configuration file below.
Step 2. Get the Apidog Project ID
- Open the desired project in Apidog.
- Click project
Settings
at the left sidebar, and copy theProject ID
from theBasic Settings
page. - Copy the project ID and replace
<project-id>
in the configuration file below.
Step 3. Configure the IDE
- Copy the following JSON configuration code to add to the MCP configuration file in your IDE:
{
"mcpServers": {
"API specification": {
"command": "npx",
"args": [
"-y",
"apidog-mcp-server@latest",
"--project-id=<project-id>"
],
"env": {
"APIDOG_ACCESS_TOKEN": "<access-token>"
}
}
}
}
If you're on Windows and the configuration file above isn't working, try using the configuration file below instead:
{
"mcpServers": {
"API specification": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"apidog-mcp-server@latest",
"--project-id=<project-id>"
],
"env": {
"APIDOG_ACCESS_TOKEN": "<access-token>"
}
}
}
}
- Add the copied JSON configuration code to the MCP file in your IDE:
- For Cursor: Add to the global
~/.cursor/mcp.json
or the project-specific.cursor/mcp.json
. - For Cline: Open the Cline panel > MCP Server > Configure MCP Server.
- For Cursor: Add to the global
Important Notes
- Replace
<access-token>
and<project-id>
with your personal Apidog API access token and project ID. - Name the MCP Server something like "API Specification" or "xxx API Specification" to help the AI recognize its purpose. Avoid generic names like "Apidog" or "Apidog MCP", as it might confuse AI.
- If you need to work with API specification from several projects, simply add multiple MCP Server configurations to the configuration file. Each project should have its own unique
<project-id>
. For clarity, name each MCP Server following the format "xxx API Specification". - If your team syncs the MCP configuration file to a code repository, it is recommended to remove the line
"APIDOG_ACCESS_TOKEN": "<access-token>"
and instead, configure theAPIDOG_ACCESS_TOKEN
as an environment variable on each member's machine to prevent token leakage. - For users of the on-premise deployment, add the following parameter to the MCP configuration file in your IDE: "--apidog-api-base-url=
<API address of the on-premise server, starting with http:// or https://>
". Additionally, ensure that your can access www.npm.com properly. - In addition to the Apidog project, Apidog MCP Server also has the ability to directly read Swagger or OpenAPI Specification (OAS) files. To use this feature:
- Remove the
--project-id=<project-id>
parameter. - Add the
--oas=<oas-url-or-path>
parameter, such asnpx apidog-mcp-server --oas=https://petstore.swagger.io/v2/swagger.json
ornpx apidog-mcp-server --oas=ο½/data/petstore/swagger.json
.
- Remove the
β Help and Support
The Apidog MCP Server is currently in beta. Weβd love to hear your feedback and suggestions! Join our Discord or Slack community for support and updates.