npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

apipost-mcp-server-simple

v1.0.5

Published

Apipost MCP Server for AI Agents

Readme

Apipost MCP Server

这是一个基于 Model Context Protocol (MCP) 实现的 Apipost 服务端。它允许 AI Agent(如 Claude Desktop、Cursor、Cline、Antigravity 等)直接读取您在 Apipost 中的接口定义,并能够发起 API 请求以获取实时响应。

🚀 功能特性

  • 自动同步接口: 通过 Apipost 的 OpenAPI 3.0 分享链接,自动加载最新的接口定义。
  • 资源浏览: 提供 apipost://apis 资源,方便 AI 了解所有可用的端点、方法及功能描述。
  • 动态执行: 提供 run_api_request 工具,AI 可以根据需求构造参数并直接调用接口,获取真实业务数据。
  • 灵活配置: 支持通过环境变量自定义 API 基础路径(Base URL),解决接口定义中缺少服务器地址的问题。

⚙️ 配置说明

在使用本服务前,通常需要配置以下环境变量:

| 变量名 | 描述 | 示例 | | :--- | :--- | :--- | | APIPOST_OPENAPI_URL | (必填) Apipost 项目的 OpenAPI 分享链接 | https://openapi.apipost.net/swagger/v3/... | | APIPOST_API_BASE_URL | (推荐) 接口执行的实际后端基础 URL | https://api.example.com | | APIPOST_HEADERS | (可选) 全局鉴权 Headers,必须为 JSON 字符串 | {"Authorization":"Bearer token"} |

🛠️ 使用方式

方式一:直接通过 npx 运行 (推荐)

这是最简单的方式,无需下载代码,直接在您的 AI 客户端配置中添加即可。

Claude DesktopCursor 为例,在 MCP 设置中添加如下配置:

{
  "mcpServers": {
    "apipost": {
      "command": "npx",
      "args": [
        "-y",
        "apipost-mcp-server-simple@latest"
      ],
      "env": {
        "APIPOST_OPENAPI_URL": "您的 OpenAPI 分享链接",
        "APIPOST_API_BASE_URL": "您的后端服务地址",
        "APIPOST_HEADERS": "{\"Authorization\":\"Bearer your_token\"}"
      }
    }
  }
}

方式二:本地开发运行

如果您需要修改代码或在本地调试运行:

  1. 克隆并安装依赖

    git clone <your-repo-url>
    cd ApipostMcpServer
    npm install
  2. 配置本地环境: 在项目根目录创建 .env 文件,参照上述“配置说明”填写内容。

  3. 编译并启动

    npm run build
    npm start
  4. 客户端配置: 在 AI 客户端配置中指向本地路径:

    "apipost": {
      "command": "node",
      "args": ["/绝对路径/到/项目/dist/index.js"],
      "env": { ... }
    }

🔒 鉴权说明

本 Server 支持两种鉴权模式:

  1. 隐式注入 (推荐):在环境变量中设置 APIPOST_HEADERS,AI 客户端无需感知 Token,服务端自动补全,更安全。
  2. 显式传递:AI 可以在调用工具时,通过 headers 参数手动传递 Token,适用于需要动态切换身份的场景。
    • 注意:显式传递的 Header 优先级高于隐式注入。

📝 暴露的接口

资源 (Resources)

  • apipost://apis: 返回 JSON 格式的接口列表,包含所有可用接口的 Method、Path 和 Summary。

工具 (Tools)

  • run_api_request:
    • method: HTTP 方法 (GET, POST, PUT, DELETE 等)。
    • path: 接口路径。
    • params: Query 参数对象。
    • body: 请求体 JSON。
    • headers: 自定义请求头。

📄 许可证

MIT