@flexprice/mcp-server

中文文档
2.1.48发布于 2026/11/05ES Module近 30 天下载 3125

A Model Context Protocol (MCP) server that exposes the flexprice API as tools for AI assistants (e.g. Claude, Cursor, VS Code, Windsurf). Use it to manage customers, plans, prices, subscriptions, invoices, payments, events, and more from your IDE or CLI.

原始使用文档
文档目录22 节
  1. Table of contents
  2. Prerequisites
  3. How to use the flexprice MCP server
  4. Option 1: npm package
  5. Option 2: Local repo
  6. Add to your MCP client
  7. Config file locations
  8. Cursor
  9. VS Code
  10. Claude Code
  11. Claude Desktop
  12. Alternative configs
  13. Tools
  14. Progressive discovery (dynamic mode)
  15. Scopes
  16. Mounting Specific Scopes
  17. Troubleshooting
  18. "Invalid URL" or request errors
  19. API connection issues
  20. Server issues
  21. Docker
  22. Generating the MCP server

flexprice MCP Server

A Model Context Protocol (MCP) server that exposes the flexprice API as tools for AI assistants (e.g. Claude, Cursor, VS Code, Windsurf). Use it to manage customers, plans, prices, subscriptions, invoices, payments, events, and more from your IDE or CLI.

Table of contents

Prerequisites

How to use the flexprice MCP server

You can run the server in two ways: npm package (one command) or local repo (clone and run). Pick one, then add it to your MCP client.


Option 1: npm package

Install: npm i @flexprice/mcp-server. Or run with one command (no clone or build):

npx @flexprice/mcp-server start --server-url https://us.api.flexprice.io/v1 --api-key-auth YOUR_API_KEY

Replace YOUR_API_KEY with your flexprice API key. Next: Add to your MCP client.


Option 2: Local repo

Use this if you want to change code or run without npm:

  1. Clone the repository and go to the MCP server directory (e.g. api/mcp or the repo that contains it).
  2. Install dependencies: npm install
  3. Create a .env file (from .env.example if present) with:
    • BASE_URL=https://us.api.flexprice.io/v1 (must include /v1; no trailing space or trailing slash)
    • API_KEY_APIKEYAUTH=your_api_key_here
  4. Build: npm run build
  5. Start: npm start

Docker (stdio): You can also build and run with stdio:

docker build -t flexprice-mcp .
docker run -i -e API_KEY_APIKEYAUTH=your_api_key_here -e BASE_URL=https://us.api.flexprice.io/v1 flexprice-mcp node bin/mcp-server.js start

Next: Add to your MCP client and use the Node from repo or Docker config below.

Add to your MCP client

Add the flexprice MCP server in your editor. Replace YOUR_API_KEY with your flexprice API key in all examples. Example config snippets are in examples/.

After connecting: In Cursor, open the MCP panel and confirm the server is connected. You can list tools and try an operation (e.g. list customers) from your assistant. In Claude, use /mcp to see connected servers and available tools.

Config file locations

HostConfig location
CursorCursor → Settings → MCP (or Cmd+Shift+P → "Cursor Settings" → MCP)
VS CodeCommand Palette → MCP: Open User Configuration (opens mcp.json)
Claude Desktop (macOS)~/Library/Application Support/Claude/claude_desktop_config.json
Claude Desktop (Windows)%APPDATA%\Claude\claude_desktop_config.json

Cursor

  1. Open Cursor → Settings → Cursor Settings and go to the MCP tab.
  2. Add a new MCP server and use this config (Option 1 — npx):
{
  "mcpServers": {
    "flexprice": {
      "command": "npx",
      "args": [
        "-y",
        "@flexprice/mcp-server",
        "start",
        "--server-url",
        "https://us.api.flexprice.io/v1",
        "--api-key-auth",
        "YOUR_API_KEY"
      ]
    }
  }
}

VS Code

  1. Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and run MCP: Open User Configuration or MCP: Add Server.
  2. Add:
{
  "servers": {
    "flexprice": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@flexprice/mcp-server",
        "start",
        "--server-url",
        "https://us.api.flexprice.io/v1",
        "--api-key-auth",
        "YOUR_API_KEY"
      ]
    }
  }
}

Claude Code

claude mcp add flexprice -- npx -y @flexprice/mcp-server start --server-url https://us.api.flexprice.io/v1 --api-key-auth YOUR_API_KEY

Then run claude and use /mcp to confirm the server is connected.


Claude Desktop

Add to your Claude Desktop config file (path in the table above):

{
  "mcpServers": {
    "flexprice": {
      "command": "npx",
      "args": [
        "-y",
        "@flexprice/mcp-server",
        "start",
        "--server-url",
        "https://us.api.flexprice.io/v1",
        "--api-key-auth",
        "YOUR_API_KEY"
      ]
    }
  }
}

Quit and reopen Claude Desktop.


Alternative configs

Node from repo (Option 2 — run from cloned repo):

{
  "mcpServers": {
    "flexprice": {
      "command": "node",
      "args": ["/path/to/mcp-server/bin/mcp-server.js", "start"],
      "env": {
        "API_KEY_APIKEYAUTH": "your_api_key_here",
        "BASE_URL": "https://us.api.flexprice.io/v1"
      }
    }
  }
}

Docker (Option 2 — stdio):

{
  "mcpServers": {
    "flexprice": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "-e", "API_KEY_APIKEYAUTH", "-e", "BASE_URL", "flexprice-mcp"],
      "env": {
        "API_KEY_APIKEYAUTH": "your_api_key_here",
        "BASE_URL": "https://us.api.flexprice.io/v1"
      }
    }
  }
}

After editing, save and restart Cursor or quit and reopen Claude Desktop so the MCP server is loaded.

Tools

The server exposes flexprice API operations as MCP tools. Only operations with certain OpenAPI tags are included (e.g. Customers, Invoices, Events). The allowed tags are configured in the repo; the filtered spec is docs/swagger/swagger-3-0-mcp.json. Tool names and parameters follow the OpenAPI spec. For the full list, see your MCP client’s tool list after connecting, or the OpenAPI spec (e.g. docs/swagger/swagger-3-0.json) in the repo.

Progressive discovery (dynamic mode)

Servers with many tools can bloat context and token usage. Dynamic mode exposes a small set of meta-tools so the assistant can discover and call operations on demand:

  • list_tools – List available tools with names and descriptions
  • describe_tool – Get the input schema for one or more tools
  • execute_tool – Run a tool by name with given parameters

To enable dynamic mode, add --mode dynamic when starting the server:

"args": ["-y", "@flexprice/mcp-server", "start", "--server-url", "https://us.api.flexprice.io/v1", "--api-key-auth", "YOUR_API_KEY", "--mode", "dynamic"]

This reduces tokens per request and can improve tool choice when there are many operations.

Scopes

FlexPrice MCP tools are categorized into three permission scopes to allow fine-grained access control:

  • read - Read-only operations (GET requests): list customers, get invoices, view usage, query data
  • write - Create/update operations (POST/PUT/PATCH): create customers, update subscriptions, modify resources
  • delete - Destructive operations (DELETE, finalization): delete resources, finalize invoices, void transactions

Mounting Specific Scopes

Control which tools are available by specifying scopes at server startup. You can combine multiple scopes or use a single scope for restricted access.

Read-only access (safest for exploration and reporting):

{
  "mcpServers": {
    "flexprice-readonly": {
      "command": "npx",
      "args": [
        "-y",
        "@flexprice/mcp-server",
        "start",
        "--server-url",
        "https://us.api.flexprice.io/v1",
        "--api-key-auth",
        "YOUR_API_KEY",
        "--scope",
        "read"
      ]
    }
  }
}

Read and write access (most common for automation):

{
  "mcpServers": {
    "flexprice-full": {
      "command": "npx",
      "args": [
        "-y",
        "@flexprice/mcp-server",
        "start",
        "--server-url",
        "https://us.api.flexprice.io/v1",
        "--api-key-auth",
        "YOUR_API_KEY",
        "--scope",
        "read",
        "--scope",
        "write"
      ]
    }
  }
}

Full access (including destructive operations):

{
  "mcpServers": {
    "flexprice-admin": {
      "command": "npx",
      "args": [
        "-y",
        "@flexprice/mcp-server",
        "start",
        "--server-url",
        "https://us.api.flexprice.io/v1",
        "--api-key-auth",
        "YOUR_API_KEY",
        "--scope",
        "read",
        "--scope",
        "write",
        "--scope",
        "delete"
      ]
    }
  }
}

Note: Omitting --scope entirely will mount all available tools (equivalent to specifying all scopes).

Troubleshooting

"Invalid URL" or request errors

  • The server builds request URLs from BASE_URL + path. If BASE_URL is unset or wrong, requests fail.
  • Fix: Set BASE_URL=https://us.api.flexprice.io/v1 (no trailing space or slash after v1). For npx, pass --server-url https://us.api.flexprice.io/v1.
  • If you get 404 on tool calls, ensure the base URL includes /v1.

API connection issues

  1. Credentials: Check that your API key and base URL are correct. Test the key with the flexprice API (e.g. curl -H "x-api-key: your_key" https://us.api.flexprice.io/v1/customers).
  2. Network: Confirm the host can reach the flexprice API (firewall, proxy).
  3. Rate limiting: If you see rate-limit errors, reduce request frequency or contact flexprice support.

Server issues

  • Port in use: If something else uses the port (e.g. 3000), change the server config or stop the other process.
  • Missing dependencies: Run npm install and npm run build in the server directory.
  • Permissions: Ensure the entrypoint is executable (e.g. chmod +x bin/mcp-server.js).

Docker

  • Build failures: Check Docker is installed and the daemon is running; try docker build --no-cache.
  • Container exits: Inspect logs with docker logs <container_id>.
  • Env vars: Verify env is passed: docker run -it --rm flexprice-mcp printenv.

Generating the MCP server

The server is generated from a tag-filtered OpenAPI spec (docs/swagger/swagger-3-0-mcp.json), not the full spec. Only operations whose tags are listed in the allowed-tags configuration are included. To regenerate after API or overlay changes:

  1. (Optional) Edit the allowed-tags configuration to add or remove tags; then run make filter-mcp-spec to rebuild the filtered spec.
  2. From the repo root, run make sdk-all (this runs filter-mcp-spec automatically, then generates the MCP server).
  3. Run make merge-custom so custom files (including this README) are merged into the output.
  4. Build and run: npm run build and npm start from the MCP output directory.

See the main repo README and AGENTS.md for SDK/MCP generation and publishing.

版本与发布记录

@flexprice/mcp-server 共发布 56 个版本,首次发布于 2026/02/17;过去 12 个月发布了 56 个版本。

版本发布日期距今
2.1.48latest2026/11/0510 天前
2.1.472026/11/0411 天前
2.1.462026/10/3017 天前
2.1.452026/10/2917 天前
2.1.442026/10/2917 天前
2.1.432026/10/2323 天前

关于 @flexprice/mcp-server 的常见问题

@flexprice/mcp-server 是什么?

A Model Context Protocol (MCP) server that exposes the flexprice API as tools for AI assistants (e.g. Claude, Cursor, VS Code, Windsurf). Use it to manage customers, plans, prices, subscriptions, invoices, payments, events, and more from your IDE or CLI.

如何安装 @flexprice/mcp-server?

在项目目录运行 npm install @flexprice/mcp-server,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 mcp、mcp-server,可以用 npx mcp 直接运行。

@flexprice/mcp-server 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/flexprice__mcp-server 是否存在。

@flexprice/mcp-server 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@flexprice/mcp-server 可以商用吗?

@flexprice/mcp-server 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@flexprice/mcp-server 的下载量有多少?

根据 npm 官方下载统计,@flexprice/mcp-server 在 2026/10/15 – 2026/11/13 这 30 天内被下载 3,125 次,日均约 104 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@flexprice/mcp-server 还在维护吗?

最新版本 2.1.48 发布于 2026/11/05(10 天前);至今共发布 56 个版本,其中过去 12 个月发布了 56 个;首次发布于 2026/02/17。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。