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

linker-trading-mcp-v2

v0.3.1

Published

MCP server for Linker Trading System v2 - hand-crafted tools with clean LLM-optimized responses

Downloads

1,499

Readme

linker-trading-mcp-v2

Linker 交易系统 MCP 服务(v2),为 LLM/Agent 提供盈亏、持仓、行情、策略值查询能力。

环境变量

| 变量 | 说明 | 示例 | |------|------|------| | TRADING_API_BASE | 交易服务地址(含 /trading-api 前缀) | http://hub.linker.net/trading-api | | TRADING_API_KEY | API Key(X-API-Key 鉴权) | trading-prod-20260323 |

工具列表

get_pnl_summary — 盈亏汇总

查询各持仓人的策略盈亏汇总。

参数

  • owners(可选):持仓人姓名列表,不传返回全部

返回示例

[
  {"owner":"任志华","strategy_id":1820,"open_count":0,"net_qty":0,"realized_pnl":-29390809.96,"last_trade":"2026-02-02"}
]

get_positions_summary — 持仓汇总

查询各持仓人的策略持仓汇总,含净持仓量和已实现盈亏。

参数

  • owners(可选):持仓人姓名列表,不传返回全部

返回示例

[
  {"owner":"任志华","strategy_id":1820,"net_qty":0,"realized_pnl":-29390809.96,"open_count":0}
]

get_market_price — Wind 合约最新行情

查询指定合约的最新市场价格(Wind 数据源)。

参数

  • contract_code(必填):合约代码,如 M2509.DCEPG2605.DCE

返回示例

{"contract":"M2509.DCE","price":4520.0,"date":"2026-04-23","category":"豆粕"}

get_strategy_values — 策略当前值

查询策略的实时计算值(基于行情和策略公式)。

参数

  • keyword(可选):策略名关键词,模糊匹配
  • limit(可选):返回条数,默认 50

返回示例

[
  {"strategy_id":42,"strategy":"LPG_套利策略_跨品种套利_fei/mopj,May-2026","value":-77.0,"status":"OK"}
]

list_owners — 持仓人列表

列出系统中所有持仓人姓名和 ID。适合在查询前确认姓名是否存在。

参数:无

返回示例

[{"id":2,"name":"任志华"},{"id":5,"name":"张三"}]

get_owner_active_strategies — 某人活跃策略

查询某持仓人当前有持仓的策略列表。

参数

  • owner(必填):持仓人姓名

返回示例

[
  {"strategy_id":1820,"strategy":"LPG套利","net_qty":10,"realized_pnl":12000.5,"open_count":3}
]

get_owner_positions — 某人完整持仓

查询某持仓人的完整持仓:总盈亏汇总 + 每个活跃策略下按合约聚合的持仓明细。

参数

  • owner(必填):持仓人姓名

返回示例

{
  "owner":"任志华",
  "total_realized_pnl":-29390809.96,
  "active_strategies":2,
  "strategies":[
    {
      "strategy":"LPG套利",
      "positions":[{"contract":"PG2605.DCE","dir":"long","qty":10,"avg_price":4520.0}]
    }
  ]
}

get_foreign_prices — 外盘实时行情

查询外盘期货合约实时报价(Marex 数据源),含买价/卖价/成交价。

参数

  • contract_codes(可选):合约代码列表,格式 FIELD,MON-YYYY,不传返回全部

支持的 FIELD:FEICPMOPJFEI/CPFEI/MOPJLST/FEILST/CPPXFEI 的别名)

返回示例

[
  {"contract":"FEI,MAY-2026","bid":612.0,"offer":null,"trades":null,"source":"marex"},
  {"contract":"CP,MAY-2026","bid":570.0,"offer":null,"trades":null,"source":"marex"}
]

Agent 使用场景

| 场景 | 工具组合 | |------|---------| | 某人持什么仓、均价多少 | get_owner_positions | | 某人有哪些活跃策略 | get_owner_active_strategies | | 各人盈亏排名 | get_pnl_summary | | 某合约现价 | get_market_price | | 外盘 LPG 报价 | get_foreign_prices | | 套利价差现在多少 | get_strategy_values(keyword="LPG") | | 某人持仓的浮动盈亏 | get_owner_positions + get_market_price → agent 计算 | | 当前套利机会判断 | get_strategy_values + get_foreign_prices → agent 综合判断 |


配置方式

Claude Desktop

编辑 claude_desktop_config.json

{
  "mcpServers": {
    "linker-trading": {
      "command": "npx",
      "args": ["-y", "linker-trading-mcp-v2@latest"],
      "env": {
        "TRADING_API_BASE": "http://hub.linker.net/trading-api",
        "TRADING_API_KEY": "your-api-key"
      }
    }
  }
}

Cursor

编辑 .cursor/mcp.json,内容同上。

Claude Code

claude mcp add linker-trading \
  --env TRADING_API_BASE=http://hub.linker.net/trading-api \
  --env TRADING_API_KEY=your-api-key \
  -- npx -y linker-trading-mcp-v2@latest

本地调试

npm install
npm run build
TRADING_API_BASE=http://test-hub.linker.net/trading-api \
TRADING_API_KEY=your-key \
npx @modelcontextprotocol/inspector dist/index.js