Skip to main content
Glama

@qbtlabs/openmm-mcp

npm version npm downloads License: MIT Ask DeepWiki

📚 文档 · 🤖 AI 技能门户 · 🔌 API 参考

OpenMM 的 MCP 服务器 —— 通过任何 MCP 客户端向 AI 代理提供市场数据、账户、交易和策略工具。

两种使用方式

选项

适用场景

API 密钥

支付

本地 (npm)

完全控制,使用自己的密钥

加密保险库

免费

托管 (mcp.openmm.io)

无需设置,按需付费

公共数据无需密钥

x402 USDC


Related MCP server: polymarket-trader-mcp

本地设置

先决条件: Node.js 20 或更高版本。

1. 安装与配置

npm install -g @qbtlabs/openmm-mcp
openmm-mcp --setup

设置向导会为您的客户端(Claude Desktop、Claude Code、Cursor、Windsurf)写入正确的 MCP 配置。配置文件中不会存储任何凭据 —— 仅存储套接字路径。

2. 初始化加密保险库

openmm-init

这将在 ~/.openmm/vault.enc 处创建一个加密保险库,其中包含您的钱包密钥和交易所 API 凭据。您将设置密码、生成(或导入)钱包,并可选择添加交易所密钥。

3. 启动服务器

openmm serve

输入一次您的保险库密码。统一套接字将在 /tmp/openmm.sock 启动 —— 所有 MCP 客户端都连接到此处。任何配置文件中都不会存在凭据。

手动配置

如果您更喜欢直接编辑配置文件而不是使用 --setup:

客户端

配置文件

Claude Desktop

~/Library/Application Support/Claude/claude_desktop_config.json

Claude Code

~/.claude.json

Cursor

.cursor/mcp.json

Windsurf

~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "openmm": {
      "command": "node",
      "args": ["/path/to/openmm-mcp/dist/index.js"],
      "env": {
        "MCP_TRANSPORT": "stdio",
        "OPENMM_SOCKET": "/tmp/openmm.sock",
        "PAYMENT_SERVER": "https://mcp.openmm.io",
        "X402_TESTNET": "true"
      }
    }
  }
}

将 /path/to/openmm-mcp 替换为实际的安装路径。对于 Claude Desktop,请使用 node 的完整路径(例如通过 which node 获取),以避免 nvm/PATH 问题。

提示: 请改用 openmm-mcp --setup —— 它会自动写入正确的绝对路径。

没有 API 密钥。没有私钥。没有密码。只有套接字路径。

无保险库模式(快速启动)

您可以跳过保险库,直接在 env 块中传递 API 密钥:

{
  "mcpServers": {
    "openmm": {
      "command": "npx",
      "args": ["@qbtlabs/openmm-mcp"],
      "env": {
        "MEXC_API_KEY": "your_key",
        "MEXC_SECRET": "your_secret"
      }
    }
  }
}

保险库增强了每一种场景的安全性 —— 任何配置文件、进程环境或客户端内存中都不会存在敏感信息。

客户端兼容性

客户端

无保险库

有保险库

Claude Desktop

环境中的 API 密钥

仅 OPENMM_SOCKET

Claude Code

环境中的 API 密钥

仅 OPENMM_SOCKET

Cursor

环境中的 API 密钥

仅 OPENMM_SOCKET

Windsurf

环境中的 API 密钥

仅 OPENMM_SOCKET

所有客户端都连接到同一个运行中的 openmm serve —— 一个保险库,一个套接字,适用于任何客户端。


带有 x402 支付的托管服务器

连接到 mcp.openmm.io —— 公共数据无需本地安装。 使用 Base 链上的 USDC 按工具调用次数付费。

工作原理

AI Agent (Claude / Cursor / Windsurf)
│  MCP stdio — no keys in config
▼
MCP Client Process
(reads OPENMM_SOCKET — credentials never here)
│  Unix socket /tmp/openmm.sock (mode 0600)
▼
openmm serve — unified vault process
┌──────────────────────────────────┐
│  ~/.openmm/vault.enc             │
│  AES-256-GCM + PBKDF2           │  ← wallet key + exchange keys, one vault
│            │                     │
│  Policy Engine                   │  ← maxPerTx, maxPerDay, allowedChains
│  (checked before key is touched) │
│            │                     │
│  signAndWipe()                   │  ← key used inline, wiped from memory
└──────────────────────────────────┘
│  EIP-3009 signature only
▼
mcp.openmm.io → x402 verification → Base L2 settlement

安全属性

属性

实现方式

静态密钥加密

~/.openmm/vault.enc 中的 AES-256-GCM + PBKDF2

密钥从不进入客户端内存

MCP 进程仅持有套接字路径

配置文件中无密钥

配置中没有任何 API 密钥或私钥

进程隔离

签名发生在 openmm serve 中,而非 AI 代理进程中

策略执行

在访问私钥前检查支出限额

内存安全

signAndWipe() —— 密钥仅使用一次,随后立即超出作用域

支付流程

  1. 代理调用工具

  2. 服务器返回 402 Payment Required 及价格

  3. openmm serve 签署 EIP-3009 授权(无 Gas 费 —— 无需 ETH)

  4. 服务器在链上提交支付并返回数据

工具定价

类别

工具

价格 (USDC)

免费

list_exchanges

$0.00

读取

get_ticker, get_orderbook, get_trades, get_ohlcv, get_balance, list_orders, get_cardano_price, discover_pools, get_strategy_status

$0.001

写入

create_order, cancel_order, cancel_all_orders, start_grid_strategy, stop_strategy

$0.01


可用工具 (15)

工具

描述

参数

市场数据

list_exchanges

列出支持的交易所

—

get_ticker

实时价格、买入/卖出价、点差、成交量

exchange, symbol

get_orderbook

订单簿深度(买单/卖单)

exchange, symbol, limit?

get_trades

近期交易及买卖汇总

exchange, symbol, limit?

get_ohlcv

OHLCV K 线数据

exchange, symbol, timeframe?, limit?

账户

get_balance

账户余额(全部或筛选)

exchange, asset?

list_orders

未结订单(全部或按交易对)

exchange, symbol?

交易

create_order

下限价单或市价单

exchange, symbol, type, side, amount, price?

cancel_order

按 ID 取消订单

exchange, symbol, orderId

cancel_all_orders

取消某交易对的所有订单

exchange, symbol

Cardano DEX

get_cardano_price

从 DEX 聚合的代币价格

symbol

discover_pools

发现流动性池

symbol, minLiquidity?

策略

start_grid_strategy

启动网格交易

exchange, symbol, lowerPrice, upperPrice, gridLevels?, totalAmount

stop_strategy

停止运行中的策略

strategyId, cancelOrders?

get_strategy_status

获取策略状态

strategyId


CLI 参考

设置与服务器

命令

描述

openmm-init

创建保险库,生成/导入钱包,添加交易所

openmm-init --import <key>

使用现有私钥创建保险库

openmm serve

解锁保险库,启动统一套接字

openmm-status

显示保险库、套接字、钱包和交易所状态(无需密码)

交易所凭据

命令

描述

openmm-exchange list

列出已配置的交易所

openmm-exchange add <id>

添加交易所凭据

openmm-exchange remove <id>

移除交易所凭据

支持的交易所:mexc, gateio, bitget, kraken, binance, coinbase, okx

钱包

命令

描述

openmm-wallet info

显示钱包地址和链

openmm-wallet set

设置钱包凭据

openmm-wallet export

显示私钥(需要确认)

支出策略

命令

描述

openmm-policy show

显示当前策略

openmm-policy set max-per-tx <amount>

每笔交易的最大 USDC

openmm-policy set max-per-day <amount>

每天的最大 USDC

openmm-policy set allowed-chains <chains>

逗号分隔的链 ID

openmm-policy reset

清除所有策略限制

高级

命令

描述

openmm-vault info

显示保险库元数据

openmm-vault change-password

更改保险库密码

openmm-vault export

导出所有凭据(危险)

openmm-vault destroy

删除保险库


使用示例

检查 BTC 价格:

"Get me the BTC/USDT ticker on MEXC"

下单:

"Buy 0.1 ETH at $2400 on Kraken"

启动网格策略:

"Start a grid strategy on MEXC for INDY/USDT between $0.10 and $0.15 with 10 levels and $500 total"

检查 Cardano 代币:

"What's the current price of SNEK on Cardano DEXes?"

安全性

  • 保险库: AES-256-GCM 加密,位于 ~/.openmm/vault.enc

  • 密码: 仅限交互式终端 —— 绝不出现在任何配置文件、环境变量或 CLI 标志中

  • 套接字: /tmp/openmm.sock 模式 0600 —— 套接字是身份验证边界

  • 策略: 在接触私钥之前,在套接字处强制执行支出限额

  • 隔离: 私钥绝不会进入任何 MCP 客户端进程内存 —— 签名通过 IPC 在 openmm serve 进程中完成


开发

git clone https://github.com/QBT-Labs/openMM-MCP.git
cd openMM-MCP
npm install
npm run typecheck
npm run lint
npm test
npm run build

资源

许可证

MIT

托管部署

可在 Fronteir AI 上进行托管部署。

Available Tools

13 tools
cancel_all_ordersAInspect

Cancel all open orders for a trading pair on a supported exchange

Inputs: exchange (required), symbol (required).

cancel_orderAInspect

Cancel a specific order by ID on a supported exchange

Inputs: exchange (required), symbol (required), orderId (required).

create_orderBInspect

Create a new order (limit or market) on a supported exchange

Inputs: exchange (required), symbol (required), type (required), side (required), +2 more.

discover_poolsAInspect

Discover Cardano DEX liquidity pools for a native token via Iris API

Inputs: symbol (required).

get_balanceAInspect

Get account balances for all assets (or a specific asset) on a supported exchange

Inputs: exchange (required), asset.

get_cardano_priceAInspect

Get aggregated price for a Cardano native token from DEX liquidity pools (TOKEN/USDT via ADA bridge)

Inputs: symbol (required).

get_orderbookBInspect

Fetch order book depth (bids and asks) for a trading pair on a supported exchange

Inputs: exchange (required), symbol (required), limit.

get_strategy_statusAInspect

Get current grid strategy status: open orders, current price, and P&L estimate

Inputs: exchange (required), symbol (required).

get_tickerAInspect

Get real-time price, bid/ask, spread, and volume for a trading pair on a supported exchange

Inputs: exchange (required), symbol (required).

get_tradesCInspect

Get recent trades for a trading pair on a supported exchange

Inputs: exchange (required), symbol (required), limit.

list_ordersAInspect

List open orders on a supported exchange, optionally filtered by trading pair symbol

Inputs: exchange (required), symbol.

start_grid_strategyBInspect

Calculate and optionally place grid trading orders around the current price

Inputs: exchange (required), symbol (required), levels, spacing, +5 more.

stop_strategyAInspect

Cancel all open orders for a trading pair, effectively stopping any running grid strategy

Inputs: exchange (required), symbol (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 13 tools

    Disambiguation4/5

    Most tools have distinct purposes, such as create_order for order creation and get_ticker for price data. However, cancel_all_orders and stop_strategy both involve canceling orders for a trading pair, which could cause confusion in selection, though stop_strategy is tied to grid strategies.

    Naming Consistency4/5

    The naming follows a consistent verb_noun pattern with snake_case throughout, such as get_balance and list_orders. Minor deviations exist, like discover_pools using 'discover' instead of 'get' or 'list', but overall the pattern is clear and readable.

    Tool Count5/5

    With 13 tools, the count is well-scoped for a trading and strategy automation server. Each tool serves a specific function, from order management to price fetching and strategy control, without feeling excessive or insufficient for the domain.

    Completeness4/5

    The toolset covers core trading operations like order CRUD, balance checks, and market data, plus grid strategy management. A minor gap is the lack of tools for modifying existing orders (e.g., update_order) or detailed strategy configuration, but agents can work around this with the available tools.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides cryptocurrency trading signals, market analysis, and portfolio management capabilities across 15+ exchanges with AI-enhanced technical analysis, arbitrage detection, and risk assessment tools.
      2
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Trade, analyze, and automate Polymarket prediction markets via AI. 34 tools for direct trading, smart money flow, copy trading, backtest, and portfolio management.
      48
      115 npm
      20
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      MCP server for DeFi execution — lets AI agents swap, provide liquidity, lend, bridge, and run yield strategies across 22 chains in a single transaction. 7 tools for token discovery, portfolio analysis, quoting, and execution via the Haiku API.
      7
      80 npm
      2
      MIT