mcp-server-apidebug

mcp-server-apidebug

A standalone MCP server for API debugging, login authentication, API configuration management, and indexed API execution.

Category
访问服务器

README

mcp-server-apidebug

English | 中文


English

MCP Server for API Debugging

A standalone MCP (Model Context Protocol) server for API debugging, login authentication, API configuration management, and indexed API execution.

Features

  • api_config: Manage API debugging configuration, Base URL, common Headers, and API list
  • api_debug: Execute API requests directly, supports GET/POST/PUT/DELETE/PATCH methods, query parameters, headers, body, automatic Content-Type detection
  • api_execute: Execute requests by index saved in api_config
  • api_login: Execute login requests based on environment variables
  • api_help: View API debugging tool documentation and examples

Installation

Global installation (Recommended):

npm install -g @liangshanli/mcp-server-apidebug

Local installation:

npm install @liangshanli/mcp-server-apidebug

Local Development

npm start

Or start the server directly:

node src/server.js

Quick Self-Test

npm test

This will output the MCP tools/list result.

Environment Variables

Variable Default Description
PROJECT_PATH . Project directory; uses current directory when not set
TOOL_PREFIX default Tool name prefix; default tools are default_api_debug, default_api_config, etc.
CONFIG_DIR empty Optional config directory override; generally not needed. When not set, uses PROJECT_PATH/.setting/{TOOL_PREFIX}
API_DEBUG_BASE_URL empty API base URL; when configured, no need to set baseUrl via api_config
API_DEBUG_ALLOWED_METHODS GET,POST,PUT,DELETE,PATCH Allowed HTTP methods, comma-separated
API_DEBUG_LOGIN_URL /api/login Login API URL
API_DEBUG_LOGIN_METHOD POST Login API method
API_DEBUG_LOGIN_BODY {"username":"","password":""} Login request body, supports JSON string or plain string
API_DEBUG_LOGIN_DESCRIPTION empty Login tool description
API_DEBUG_LOGIN_USER_HEADER new-api-user Header name for user ID (extracted from login response)

MCP Configuration Example

{
  "servers": {
    "apidebug": {
      "command": "npx",
      "args": [
        "@liangshanli/mcp-server-apidebug"
      ],
      "env": {
        "API_DEBUG_BASE_URL": "https://api.example.com",
        "API_DEBUG_ALLOWED_METHODS": "GET,POST,PUT,DELETE,PATCH",
        "API_DEBUG_LOGIN_URL": "/api/user/login",
        "API_DEBUG_LOGIN_METHOD": "POST",
        "API_DEBUG_LOGIN_BODY": "{\"username\":\"your_username\",\"password\":\"your_password\"}",
        "API_DEBUG_LOGIN_USER_HEADER": "new-api-user",
        "API_DEBUG_LOGIN_DESCRIPTION": "Execute login requests based on environment variables. Use api_config interface to handle login configuration after successful login."
      }
    }
  }
}

Configuration Storage

Default storage path:

{PROJECT_PATH}/.setting/{TOOL_PREFIX}/api.json

If PROJECT_PATH is not set, defaults to .; if TOOL_PREFIX is not set, defaults to default.

Usage Examples

  1. Set Base URL:
{
  "action": "updateBaseUrl",
  "baseUrl": "https://api.example.com"
}
  1. Debug an API:
{
  "url": "/api/users",
  "method": "GET",
  "query": {
    "page": 1,
    "limit": 10
  }
}
  1. Add an API and execute by index:
{
  "action": "addApi",
  "api": {
    "url": "/api/login",
    "method": "POST",
    "body": {
      "username": "admin",
      "password": "123456"
    }
  }
}
{
  "index": 0
}

中文

API 调试 MCP 服务器

独立运行的 MCP (Model Context Protocol) 服务器,用于 API 调试、登录认证、API 配置管理和按索引执行 API 请求。

工具列表

  • api_config:管理 API 调试配置、Base URL、公共 Headers 和接口列表
  • api_debug:直接执行 API 请求,支持 GET/POST/PUT/DELETE/PATCH 方法、query 参数、headers、body,自动检测 Content-Type
  • api_execute:按 api_config 中保存的接口索引执行请求
  • api_login:根据环境变量执行登录请求
  • api_help:查看 API 调试工具说明和示例

安装依赖

全局安装(推荐):

npm install -g @liangshanli/mcp-server-apidebug

本地安装:

npm install @liangshanli/mcp-server-apidebug

本地运行

npm start

或直接启动 server:

node src/server.js

快速自检

npm test

会输出 MCP tools/list 结果。

环境变量

变量 默认值 说明
PROJECT_PATH . 项目目录;不设置时使用当前目录
TOOL_PREFIX default 工具名前缀;默认工具名为 default_api_debugdefault_api_config
CONFIG_DIR 可选覆盖配置目录;一般不需要设置。未设置时使用 PROJECT_PATH/.setting/{TOOL_PREFIX}
API_DEBUG_BASE_URL API 基础 URL;配置后无需再通过 api_config 设置 baseUrl
API_DEBUG_ALLOWED_METHODS GET,POST,PUT,DELETE,PATCH 允许执行的 HTTP 方法,逗号分隔
API_DEBUG_LOGIN_URL /api/login 登录接口 URL
API_DEBUG_LOGIN_METHOD POST 登录接口方法
API_DEBUG_LOGIN_BODY {"username":"","password":""} 登录请求体,支持 JSON 字符串或普通字符串
API_DEBUG_LOGIN_DESCRIPTION 登录工具说明
API_DEBUG_LOGIN_USER_HEADER new-api-user 用户 ID 的 Header 名称(从登录响应中提取)

MCP 配置示例

{
  "servers": {
    "apidebug": {
      "command": "npx",
      "args": [
        "@liangshanli/mcp-server-apidebug"
      ],
      "env": {
        "API_DEBUG_BASE_URL": "https://api.example.com",
        "API_DEBUG_ALLOWED_METHODS": "GET,POST,PUT,DELETE,PATCH",
        "API_DEBUG_LOGIN_URL": "/api/user/login",
        "API_DEBUG_LOGIN_METHOD": "POST",
        "API_DEBUG_LOGIN_BODY": "{\"username\":\"your_username\",\"password\":\"your_password\"}",
        "API_DEBUG_LOGIN_USER_HEADER": "new-api-user",
        "API_DEBUG_LOGIN_DESCRIPTION": "根据环境变量执行登录请求。使用 api_config 接口处理登录成功后的配置。"
      }
    }
  }
}

配置保存路径

默认保存目录规则:

{PROJECT_PATH}/.setting/{TOOL_PREFIX}/api.json

如果 PROJECT_PATH 不设置,则默认 .;如果 TOOL_PREFIX 不设置,则默认 default

使用示例

  1. 设置 Base URL:
{
  "action": "updateBaseUrl",
  "baseUrl": "https://api.example.com"
}
  1. 调试接口:
{
  "url": "/api/users",
  "method": "GET",
  "query": {
    "page": 1,
    "limit": 10
  }
}
  1. 添加接口后按索引执行:
{
  "action": "addApi",
  "api": {
    "url": "/api/login",
    "method": "POST",
    "body": {
      "username": "admin",
      "password": "123456"
    }
  }
}
{
  "index": 0
}

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选