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

cosa-mcp

v1.0.1

Published

Crypto options strategy assistant — MCP server + CLI for BTC/ETH options strategies from public Deribit data.

Readme

cosa-mcp — MCP server + Skill CLI

语言: English · 中文 · 日本語

把「加密期权策略助手」的策略引擎包装成两种可以直接在 Claude 里使用的形态:

  • MCP serversrc/server.ts):标准 stdio MCP 服务,暴露一个工具 generate_options_strategy,可在 Claude Desktop / Claude Code / 任意 MCP 客户端配置使用。
  • Skill CLIsrc/cli.ts):被项目里的 /options-strategy 技能调用(见 .claude/skills/options-strategy/),输出可内联渲染的 HTML 片段。

两者都调用 @cosa/server/engine同一套已验证的策略逻辑,并用 @cosa/render 生成自包含 HTML。

MCP 工具:generate_options_strategy

完全确定性,不需要任何 API Key 或配置。 复杂需求由调用方模型(Claude)自己解析成结构化字段传入。

| 参数 | 类型 | 说明 | | ---- | ---- | ---- | | lang | "zh" \| "en" \| "ja" | 输出语言(含 HTML 页面全部文字),设成用户提问语言;默认 en | | asset | "BTC" \| "ETH" | 标的,默认 BTC | | view | "bullish" \| "bearish" \| "range" | 简单方向观点 | | horizon_days | number | 时间范围(天),常用 7 / 30 / 90,默认 30 | | direction | bullish\|bearish\|range\|volatile | 方向(结构化) | | target_price / target_move_usd | number | 目标价 / 目标涨跌幅(USD) | | target_range_lower / target_range_upper | number | 目标区间上下沿(USD,需成对) | | capital_usd | number | 可用资金(USD/USDT) | | position_quantity / position_avg_cost | number | 现有持仓数量 / 均价(对冲用) | | hedge_intent / income_preference | boolean | 是否对冲 / 是否收权利金 | | risk_profile | beginner\|moderate\|advanced | 风险偏好 | | strategy_preference | iron_butterfly\|ratio | 指定特定结构(否则自动选择) |

返回:

  • 一段 text 策略摘要 + 已保存的 HTML 文件路径;
  • 一个 text/html 资源(自包含 HTML 数据页面,含 Payoff SVG)。

默认会尝试用系统浏览器打开保存的 HTML 文件(COSA_OPEN_BROWSER=0 可关闭)。

构建 / npx / 发布

本包可打包成零运行时依赖的自包含包(@cosa/* 全部内联),提供两个 bin: cosa-mcp(MCP server)和 cosa-cli(命令行)。

bun run build            # 生成 dist/server.js, dist/cli.js(node 可执行,带 #!/usr/bin/env node)
npm publish              # 发布到 npm(先 npm login;prepublishOnly 会自动构建;不带 scope 默认即公开)
# 或不发布,全局安装本地包:
npm i -g .               # 之后任意机器:cosa-mcp / cosa-cli 都在 PATH 上

cosa-mcp 这个 bin 与包名一致,所以 npx -y cosa-mcp 能直接解析到它(包里有多个 bin 时,npx 会选与包名同名的那个)。

在 Claude Desktop / Claude Code 配置

从下面任选一种配置合并进客户端。

npx(发布或全局安装后,最简单):

{ "mcpServers": { "crypto-options": { "command": "npx", "args": ["-y", "cosa-mcp"], "env": { "COSA_OPEN_BROWSER": "1" } } } }

从本仓库(不发布、不构建,用 Bun 直接跑 TS,绝对路径):

{ "mcpServers": { "crypto-options": { "command": "/abs/bun", "args": ["run", "<repo>/packages/mcp/src/server.ts"], "env": { "COSA_OPEN_BROWSER": "1" } } } }

想用打包产物?先 bun run --cwd packages/mcp build,再用 "/abs/node"["<repo>/packages/mcp/dist/server.js"]

  • Claude Code:放在项目根的 .mcp.json,或用 claude mcp add
  • Claude Desktop:合并到 claude_desktop_config.json完全重启

配置好后直接对 Claude 说「帮我看 BTC 未来一个月的期权策略」即可。

直接命令行用

# 快捷观点
bun run src/cli.ts --view bullish --asset BTC --horizon 30

# 复杂需求(结构化参数)
bun run src/cli.ts --direction bearish --hedge --position-qty 2 --position-avg-cost 60000 --asset BTC

# 直接在浏览器打开生成的页面
bun run src/cli.ts --view range --asset ETH --open

# 输出原始 JSON
bun run src/cli.ts --view bullish --json
  • stdout = 内联 HTML 片段(交给可视化 widget 渲染)。
  • stderr = Markdown 摘要 + 保存的完整 HTML 文件路径。

环境变量

| 变量 | 作用 | | ---- | ---- | | COSA_OUT_DIR | HTML 输出目录(默认系统临时目录下 cosa-strategies/) | | COSA_OPEN_BROWSER | 0 关闭自动打开浏览器(默认开启) |