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

@manabuy/mcp-server

v0.1.2

Published

ManaBuy MCP server for product search, order quote, and AI-assisted ordering.

Readme

ManaBuy MCP Server

English | 日本語 | Español | Français | Deutsch | Italiano | Português | 简体中文

ManaBuy MCP Server 是一个 Model Context Protocol (MCP) 网关,供 AI 客户端搜索 ManaBuy 商品、查看商品详情、订单报价、创建已确认订单,以及查询订单状态。

该服务不会重新实现 ManaBuy 业务逻辑。它只把 MCP 工具调用转换为现有 ManaBuy API 请求,并把结构化 JSON 响应返回给 AI 客户端。

功能

  • 搜索 ManaBuy 商品和游戏。
  • 获取商品详情、SKU 列表、下单字段和充值说明。
  • 在支付前进行订单报价。
  • 在用户明确确认后创建订单。
  • 查询订单状态和订单详情。
  • 通过浏览器登录,或通过环境变量配置 API 环境、货币、语言、渠道和用户 token。

可用工具

| 工具 | 用途 | | --- | --- | | login_manabuy | 启动 ManaBuy 浏览器登录并返回登录链接。 | | logout_manabuy | 删除本地保存的 ManaBuy token。 | | get_login_status | 查看当前 MCP 是否已经登录。 | | search_products | 按关键词、商品编码、分类或游戏 hub URL 名称搜索商品或游戏。 | | get_product_detail | 获取商品详情、SKU、必填下单字段和充值说明。 | | quote_order | 创建订单前预览最终价格、折扣、优惠券和应付金额。 | | create_order | 创建 ManaBuy 订单并返回支付信息。这是高风险操作。 | | get_order_status | 根据订单号获取当前订单状态。 | | get_order_detail | 根据订单号获取订单详情。 |

安全说明

create_order 可以创建真实的 ManaBuy 订单。AI 客户端必须在用户明确确认商品、SKU、数量、账号字段、价格、货币和支付方式后,才能调用该工具。

生产环境建议使用更安全的流程:

  1. create_order_draft
  2. 向用户展示完整订单摘要。
  3. confirm_order({ draftOrderId, confirmationToken })

要求

  • Node.js >=20.10.0
  • npm
  • 通过 login_manabuy 浏览器登录,或提供用于认证订单操作的有效 ManaBuy 用户 token

安装

npm install

配置

cp .env.example .env
MANABUY_API_BASE_URL=https://manabuy.com/api
MANABUY_ENVIRONMENT=yz
MANABUY_CURRENCY=USD
MANABUY_LANG=en
MANABUY_BIZ_CHANNEL=THIS
MANABUY_AUTH_TOKEN=your_user_login_token

开发

npm run dev

如果要启动远程 Streamable HTTP MCP 入口:

npm run dev:http

构建和运行

npm run build
npm start

构建后启动 HTTP MCP:

npm run start:http

默认监听 0.0.0.0:3000,并暴露:

| 路径 | 用途 | | --- | --- | | /mcp | Streamable HTTP MCP endpoint。 | | /health | 健康检查。 | | / | 面向开发者的落地页,包含 agent 配置命令。使用 Accept: application/json 可获取 JSON 服务描述。 |

HTTP 服务可通过这些环境变量配置:

| 变量 | 默认值 | 说明 | | --- | --- | --- | | PORT | 3000 | HTTP 端口。 | | HOST | 0.0.0.0 | HTTP 监听地址。 | | MCP_PATH | /mcp | MCP endpoint 路径。 | | CORS_ORIGIN | * | 允许的浏览器来源。 |

本地登录工具

服务提供 3 个认证工具,适合本地 stdio MCP 场景:

| 工具 | 用途 | | --- | --- | | login_manabuy | 启动 ManaBuy 浏览器登录并返回登录链接。 | | logout_manabuy | 删除本地保存的 ManaBuy token。 | | get_login_status | 查看当前 MCP 是否已经登录。 |

login_manabuy 默认复用 Web 登录页。Hosted HTTP MCP 场景下,它会立即返回登录链接,并尝试让运行环境打开浏览器。如果 Codex 没有自动打开浏览器,用户可以手动打开返回的 loginUrl

https://manabuy.com/mcp-auth?redirect_uri=https://agents.manabuy.com/auth/callback&state=xxx

Web 端用户登录成功后,把现有 cookie 中的 ManaBuy token 通过 POST 回 MCP callback:

{
  "state": "xxx",
  "token": "user-login-token",
  "user": {
    "userId": 123,
    "email": "[email protected]"
  }
}

MCP 会保存 token,之后请求 ManaBuy API 时按现有 Web 约定直接放进 Authorization 请求头。本地 stdio MCP 仍可通过 waitForCallback: true 使用 127.0.0.1 callback 等待登录完成。

相关环境变量:

| 变量 | 默认值 | 说明 | | --- | --- | --- | | MANABUY_AUTH_BASE_URL | 从 MANABUY_API_BASE_URL 推导出的 origin | 授权页和 token 接口所在域名。 | | MANABUY_MCP_PUBLIC_BASE_URL | https://agents.manabuy.com | Hosted MCP 的公网地址,用于生成 /auth/callback 回调 URL。 | | MANABUY_LOGIN_PATH | /mcp-auth | Web 登录中转页路径。 | | MANABUY_LOGIN_RESPONSE_TYPE | token | 登录回调类型。默认由 Web 直接回传 ManaBuy token。 | | MANABUY_AUTHORIZE_PATH | 空 | 兼容旧 OAuth 授权入口;未设置 MANABUY_LOGIN_PATH 时才使用。 | | MANABUY_TOKEN_PATH | /oauth/token | 授权码换 token 的接口路径,仅 code 回调时使用。 | | MANABUY_OAUTH_CLIENT_ID | manabuy-mcp | OAuth client id。 | | MANABUY_AUTH_FILE | ~/.manabuy/mcp-auth.json | 本地 token 保存路径。 | | MANABUY_AUTH_TOKEN | 空 | 兼容旧方式;如果配置了环境变量,会优先使用它。 |

Web 端可新增一个 pages/mcp-auth.vue,复用现有 useLoginDialog()$loginSuccess 后写入的 token cookie。核心逻辑如下:

const route = useRoute()
const redirectUri = computed(() => String(route.query.redirect_uri || ''))
const state = computed(() => String(route.query.state || ''))
const token = useCookie<string>('token')
const userInfo = useCookie('userInfo')

async function finishMcpLogin() {
  if (!redirectUri.value || !state.value || !token.value) return
  await fetch(redirectUri.value, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      state: state.value,
      token: token.value,
      user: userInfo.value
    })
  })
}

Claude Desktop 配置

{
  "mcpServers": {
    "manabuy": {
      "command": "node",
      "args": ["/absolute/path/to/ManaBuy-mcp/dist/index.js"],
      "env": {
        "MANABUY_API_BASE_URL": "https://manabuy.com/api",
        "MANABUY_ENVIRONMENT": "yz",
        "MANABUY_CURRENCY": "USD",
        "MANABUY_LANG": "en",
        "MANABUY_BIZ_CHANNEL": "THIS",
        "MANABUY_AUTH_BASE_URL": "https://manabuy.com"
      }
    }
  }
}

远程 MCP 配置

如果你想做到 Morpho 那种“用户不需要从 GitHub 或 npm 下载 MCP”,就把 HTTP 入口部署到公网,然后让客户端连接你的公开 URL。

Codex:

codex mcp add manabuy --url https://your-domain.example/mcp

或写入 codex.toml

[mcp_servers.manabuy]
url = "https://your-domain.example/mcp"

Cursor:

{
  "mcpServers": {
    "manabuy": {
      "url": "https://your-domain.example/mcp"
    }
  }
}

Claude Code:

claude mcp add manabuy --transport http https://your-domain.example/mcp

这种模式下,用户本地只保存 MCP URL。真正的工具代码、依赖和 ManaBuy API 调用都运行在你部署的服务器上。

不要在公开服务上配置共享的 MANABUY_AUTH_TOKEN。生产环境创建订单时,建议改成用户级 OAuth、短期 token broker,或者后端 draft/confirm 流程,确保每个用户只授权自己的订单。

GitHub Actions 自动部署

仓库包含 .github/workflows/deploy.yml。当代码 push 到 main 分支时,GitHub 会自动:

  1. 安装依赖。
  2. 执行类型检查。
  3. 构建 dist/
  4. 通过 SSH 上传到服务器目录 /app/manaBuy-cmp
  5. 在服务器执行 npm ci --omit=dev
  6. 用 PM2 启动或重启 node dist/http.js

先在服务器执行一次基础准备:

sudo mkdir -p /app/manaBuy-cmp
sudo chown -R ubuntu:ubuntu /app/manaBuy-cmp
sudo npm install -g pm2

如果服务器还没有 Node.js 20,先安装 Node.js 20。可以用 nvm、NodeSource 或你现有的服务器管理方式安装。

然后在 GitHub 仓库里进入 Settings -> Secrets and variables -> Actions,添加这些 Repository secrets:

| Secret | 示例 | 说明 | | --- | --- | --- | | SSH_HOST | 43.130.68.70 | 服务器 IP 或域名。 | | SSH_USER | ubuntu | SSH 用户;不填 workflow 默认使用 ubuntu。 | | SSH_PORT | 22 | SSH 端口;不填 workflow 默认使用 22。 | | SSH_PRIVATE_KEY | 私钥内容 | 可登录服务器的 SSH 私钥。 | | MANABUY_ENV_FILE | .env 内容 | 可选。部署时写入服务器 /app/manaBuy-cmp/.env。 |

MANABUY_ENV_FILE 示例:

MANABUY_API_BASE_URL=https://manabuy.com/api
MANABUY_ENVIRONMENT=yz
MANABUY_CURRENCY=USD
MANABUY_LANG=en
MANABUY_BIZ_CHANNEL=THIS
MANABUY_AUTH_TOKEN=

部署成功后,GitHub Actions 默认让 MCP 服务监听服务器本机 3100 端口:

http://43.130.68.70:3100/mcp

生产环境建议在 Nginx 里把域名 HTTPS 反代到 127.0.0.1:3100,然后让用户连接:

codex mcp add manabuy --url https://your-domain.example/mcp