Skip to main content

Version: 3.8.x

Deploy API7 MCP

API7-MCP is a Model Context Protocol (MCP) server for connecting to the API7ee API, allowing AI LLMs to analyze gateway resource configurations, monitoring data analysis, permission management, risk item detection, and more.

This tutorial walks you through deploying API7-MCP, using it to manage resources and send requests. The tutorial uses VS Code and Cline for demonstration, but you can choose other AI clients, such as Cursor and Claude Desktop, that best suit your workflow.

Prerequisites

  1. Install API7 Enterprise.
  2. Install Cline from the Extension marketplace of Visual Studio Code (VS Code).

Install and Configure API7-MCP

The following are different ways of installation.

npm

If you are installing from npm, configure the MCP server with the following details. Then update the API7 dashboard address, gateway address, and API7 Enterprise token per your environment in the AI client:

{
"mcpServers": {
"api7-mcp": {
"command": "npx",
"args": ["-y","api7-mcp"],
"env": {
"DASHBOARD_URL": "your-api7ee-dashboard-url",
"GATEWAY_URL":"your-api7ee-gateway-server-url",
"TOKEN": "your-api7ee-token"
}
}
}
}

Source Code

To install from source code, first clone the api7-mcp repository:

git clone https://github.com/api7/api7-mcp.git
cd api7-mcp

Install the dependencies and build the project:

pnpm install
pnpm build

Finally, configure the MCP server with the following details and update the API7 dashboard address, gateway address, and API7 Enterprise token per your environment in the AI client:

{
"mcpServers": {
"api7-mcp": {
"disabled": false,
"command": "node",
"args": ["your-project-path/dist/index.js"],
"env": {
"DASHBOARD_URL": "your-api7ee-dashboard-url",
"GATEWAY_URL": "your-api7ee-gateway-server-url",
"TOKEN": "your-api7ee-token"
}
}
}
}

args: After running the command above, a dist folder will appear in the Explorer Module of VS Code. Keep the path of the dist folder, e.g., /Users/alice/workspace/new/api7-mcp/dist/index.js.

DASHBOARD_URL: The domain name of the API7 Enterprise dashboard, e.g., http://192.168.31.29:7443.

GATEWAY_URL: The gateway server URL of your API7 Enterprise, e.g., http://192.168.64.1:9080.

TOKEN: Configure the token generated on the API7 Enterprise Dashboard.

Once the configurations are saved, you should see that the MCP server is successfully installed in your AI client.

Launch MCP Servers

This tutorial uses VS Code and Cline for demonstration.

Open VS Code and click Cline on the left side navigation bar to open it.

Open Cline

On top of Cline, click on MCP Servers.

Configure MCP Servers

Select Installed and click Configure MCP Servers to open the cline_mcp_settings.json file.

Configure MCP Servers

Update the cline_mcp_settings.json file according to the guide of the [Source Code](#### Source Code) part to configure the MCP Server.

After configuring the cline_mcp_settings.json file, the status on the right side of api7-mcp will turn green, indicating successful configuration and that API7-MCP is running.

Successful MCP Configuration

Click the Done button in the upper right corner to complete.

Finish MCP Configuration

Configure Cline in VS Code

Click the settings icon in the top right corner to access the settings.

Open Settings

In the API Provider field, select your preferred API provider, e.g., OpenRouter.

Select OpenRouter as API Provider

Enter the OpenRouter API Key generated on the OpenRouter platform.

Enter OpenRouter API Key

Select the desired AI model, e.g., deepseek/deepseek-chat-v3-0324, as the Model.

Select Model

Click Save in the top right corner to complete the configuration.

Save Settings

Verify

In VS Code, ask Cline to send 5 API requests to API7 Enterprise.

Send 5 API Requests

Cline wants to use the send_request_to_gateway operation to run the command. Click Approve to authorize it.

Authorize Cline to send requests

Cline returns that 5 API requests are successfully sent.

Send API requests successfully

Check API Request Count

Ask Cline to check all API requests of API7 Enterprise over the past 10 minutes.

Check API Request

Cline requests data on API requests over the past 10 minutes. Click Approve to authorize it.

Approve to Fetch API Request Data

Cline returns the API request data for the past 10 minutes of API7 Enterprise. The result shows that the request count in the past 10 minutes is "5.13," and the 5 requests are sent successfully.

API Request Summary

Select Monitoring from the side navigation bar on the API7 Enterprise dashboard. The request volume is 5, and all 5 requests received 200 responses, consistent with the result from API7-MCP.

Verified API Request Count

note

The 13% deviation in the API request count could be attributed to factors such as network latency, data transmission issues, caching mechanisms, or data update delays, which are normal phenomena.

Check QPS and Latency

Ask Cline to check the QPS and Latency data of API7 Enterprise over the past 10 minutes.

Check QPS and Latency

Cline requests to fetch QPS and latency data using the get_prometheus_metrics operation. Click Approve to authorize it.

Fetch QPS and Latency

Cline returns the monitoring data of QPS and latencies for the past 10 minutes of API7 Enterprise. The result shows that the latency peaking was at 181.9ms.

QPS and Latency Summary

Select Monitoring from the side navigation bar on the API7 Enterprise dashboard. The latency peaking at 181.9ms was at 11:15:55, which aligns with the conclusion from API7-MCP.

Verified QPS Data

Additional Resource

API7.ai Logo

The digital world is connected by APIs,
API7.ai exists to make APIs more efficient, reliable, and secure.

Sign up for API7 newsletter

Product

API7 Gateway

SOC2 Type IIISO 27001HIPAAGDPRRed Herring

Copyright © APISEVEN PTE. LTD 2019 – 2025. Apache, Apache APISIX, APISIX, and associated open source project names are trademarks of the Apache Software Foundation