关于 GMGN Skills
GMGN Skills 是供 AI Agent 分析和交易多个支持链上代币的 MCP 服务及技能集。它通过 GMGN CLI 提供实时代币与钱包分析、Smart Money 和 KOL 跟踪及下单工作流。
主要功能
- 01查询热门代币和新上架代币
- 02分析代币安全性、持有者和交易活动
- 03查看钱包持仓、盈亏和历史记录
- 04跟踪 Smart Money、KOL 和关注的钱包
- 05提交市价单、限价单和策略订单
适用场景
- 01按启动平台和钱包信号筛选新代币
- 02评估代币基本面和持有者分布
- 03查看钱包表现与交易历史
- 04提交带止盈或止损条件的交易
MCP 相关
该项目将自身描述为面向 GMGN Agent Skills 的 MCP 服务,为 AI Agent 提供代币与钱包分析及交易工作流;README 说明通过 GMGN CLI 安装和配置。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
原文在翻译后有更新,译文可能不是最新。
GMGN Agent Skills
借助 GMGN Agent Skills,你可以使用 AI Agent 查询多个链上的实时热门代币排行、代币基本面、社交媒体信号、实时交易活动、Trenches 中的新代币、头部持有者、头部交易者、聪明钱持仓、KOL 持仓、内幕钱包、捆绑钱包敞口以及其他专业链上分析。它还支持市价单、限价单、高级止盈/止损策略单、一键 cooking 单(买入 + 条件单在单一流程中完成)以及钱包管理——包括实时持仓、近期盈亏和交易历史——全部通过自然语言完成。
为什么选择 GMGN Skills
为 AI Agent 实时高速查询和交易多链 Meme 代币而打造。gmgn-skills 让 AI Agent 直接访问 GMGN 的热门代币、Trenches 新代币列表和专业链上数据——包括聪明钱、KOL、老鼠仓交易者和捆绑者分析。
拥有 500+ 专业数据维度,你可以将 AI Agent 变成 7×24 小时实时扫链交易工具——监控多链代币动能、即时下单,并通过止盈/止损管理退出,全部自动运行。
1. 实时链上数据——更快
SOL / BSC / Base / ETH 的数据在每次查询时都是实时的。支持多参数自定义,无快照缓存——专为 AI Agent 实时决策而打造(包括但不限于):
| 数据 | 粒度 |
|---|---|
| 新代币发现(Trenches) | 实时,可按 launchpad、Dev 持仓、KOL 入场、老鼠仓交易者比例筛选 |
| 热门代币 | 实时,1m / 5m / 1h / 6h / 24h——最短 1 分钟窗口 |
| 代币信息 | 实时——交易活动 / 价格 / 成交量 / 市值 |
| 代币安全 | 实时——开源、放弃权限、蜜罐检测等 |
| 代币分析 | 实时——Dev / KOL / 聪明钱 / 老鼠仓交易者 / 捆绑钱包持仓 |
| 监控与追踪 | 实时——KOL / 聪明钱 / 关注钱包的交易活动 |
| K 线(OHLCV) | 实时,1m / 5m / 15m / 1h / 4h / 1d——最短 1 分钟K 线 |
| 钱包持仓 | 实时——持仓 / 盈亏 / 交易活动 |
2. 交易更快
- 与 GMGN 网页交易界面相同的 RPC 路由,多区域部署,毫秒级响应——端到端订单提交低于 0.3 秒。
- 自动选择最优路由,与 GMGN 网页版相同的路由引擎。
- 市价单、限价单和策略单(止盈 / 止损)一条命令完成。
- 按仓位百分比卖出(
--percent 50),无需计算精确数量。
| 订单类型 | 描述 |
|---|---|
| 市价单 | 以当前市场价格即时成交 |
| 限价单 | 在指定价格触发买入或卖出 |
| 止盈 / 止损 | 附加在兑换上的固定价格退出条件 |
| 追踪止盈 / 追踪止损 | 追踪价格峰值;在指定回撤百分比后触发——顺势而为同时保护收益 |
| 多钱包批量交易 | 同时使用多个钱包买入,每个钱包都有自己的止盈 / 止损 / 追踪止盈 / 追踪止损订单 |
3. 更全面的代币数据
无需再抓取网页,也不会被 Cloudflare 拦截。实时高并发查询高频 Meme 代币交易所需的全部专业分析数据(包括但不限于):
- 聪明钱数量(
smart_degen_count)和 KOL 持有者(renowned_wallets)——实时 - 老鼠仓交易者占比(
rat_trader_amount_rate)——来自内幕/潜伏钱包的成交量份额 - 捆绑机器人暴露度(
bundler_trader_amount_rate)——来自机器人捆绑买入的成交量 - 狙击钱包(
sniper_count)——在代币上线那一刻买入的钱包 - 疑似内幕持有率(
suspected_insider_hold_rate) - 新钱包占比(
fresh_wallet_rate) - Rug 风险评分(0–1)+ 蜜罐检测 + 刷量交易标记
- Bonding Curve 状态(
is_on_curve)——代币是否已毕业进入开放 DEX
4. 你可以用 GMGN Skills 做什么
实时链上扫描
- 实时扫描 Trenches 中的新代币,可按 launchpad(Pump.fun、letsbonk、fourmeme、clanker……)、dev 持仓、KOL 入场和老鼠仓交易者占比进行筛选
- 浏览多链热门代币排行榜(最低 1 分钟粒度),按成交量、聪明钱数量、市值等排序
- 实时追踪新代币——查看 KOL、Smart Money 和你关注的钱包正在买入哪些代币,并自动分析最新热门代币
- 获取任意代币的实时 K 线 / OHLCV 数据(1m / 5m / 15m / 1h / 4h / 1d)
代币分析
- 查询代币基本面、社交链接、Bonding Curve 状态和流动性池详情
- 安全检查:开源、放弃权限、蜜罐、刷量交易、Rug 风险评分(0–1)
- 深度持有者分析:Smart Money / KOL / 老鼠仓交易者 / 捆绑机器人 / 狙击者 / 巨鲸 / 新钱包——持仓明细和排名
钱包与追踪
- 分析任意钱包:实时持仓、已实现 / 未实现盈亏、胜率、交易风格、完整历史
- 实时追踪 Smart Money、KOL 和你关注的钱包的最新买入和卖出
自动化交易
- 市价单、限价单、止盈 / 止损策略单——端到端延迟低于 0.3 秒
- 按仓位百分比一键卖出(
--percent 50),无需手动计算
AI 工作流
- 9 个内置工作流文档:代币研究、项目深度报告、钱包分析、Smart Money 画像、风险预警、早期项目筛选、每日简报、市场发现等——开箱即用
技能
| 技能 | 描述 | 参考 |
|---|---|---|
/gmgn-token | 代币信息、安全性、流动性池、持有者、交易者 | SKILL.md |
/gmgn-contract-dd | 针对单个代币地址的合约尽职调查评分——将安全性、持有者结构和价格走势整合为 0-100 的综合评价 | SKILL.md |
/gmgn-holder-analysis | 代币持有者筹码分析——筹码分布、入场成本、巨鲸/开发者/KOL 行为、风险钱包 | SKILL.md |
/gmgn-market | K 线市场数据、热门代币 | SKILL.md |
/gmgn-portfolio | 钱包持仓、活动、统计数据 | SKILL.md |
/gmgn-wallet-analysis | 钱包决策档案——四项通过/不通过关卡,以及钱包当前持仓和买入情况 | SKILL.md |
/gmgn-wallet-score | 钱包跟单评分——交易记录、可跟单性、回测、开发者信誉 | SKILL.md |
/gmgn-wallet-style | 钱包交易风格标签——由 20 格频率 × 盈亏标题、速度副标题和徽章组成,每项均标注触发数值 | SKILL.md |
/gmgn-wallet-review | 钱包交易画像——每个周期(1D / 7D / 30D / 全部)提供一个风格标签、一句总结和一句后续建议 | SKILL.md |
/gmgn-track | 跟踪钱包交易、KOL 交易、聪明钱交易 | SKILL.md |
/gmgn-callout | 喊单——单个钱包的喊单历史和 7d/30d 命中率,以及带有 KOL/声明/安全/持仓筛选条件的全局喊单动态 | SKILL.md |
/gmgn-token-buy | 买入尽职调查——将代币名称解析为正确合约,通过三项硬性关卡,估算滑点和 Gas,并将订单卡片交给 gmgn-swap | SKILL.md |
/gmgn-swap | 兑换提交 + 限价订单 + 策略订单 + 订单查询 | SKILL.md |
/gmgn-cooking | 一条命令执行组合订单(在单个流程中完成买入 + 止盈/止损) | SKILL.md |
/gmgn-kline-pattern | 价格走势形态解读——识别图表形态并给出 0-100 的评分 | SKILL.md |
CLI 命令、参数和推荐值的详细信息,请参阅 Wiki 文档。
快速开始
给 AI 助手的说明: 如果你是帮助用户安装或配置 gmgn-cli 的 AI Agent,请直接跳转至快速开始(AI Agent)——其中包含你需要完成的所有步骤,包括如何指导用户生成 API 密钥。如果用户要求升级,请跳转至升级(AI Agent)。
准备好安装了吗?跳转至安装 →
已经安装了吗?升级技能和 CLI →
提示: 如果你的 AI Agent 尝试打开或抓取 gmgn.ai 网站,而不是使用 CLI,请将此内容添加到提示词中:
Use gmgn-cli commands. Do not call gmgn.ai web endpoints directly.
快速开始(AI Agent)
以下步骤面向 AI Agent。部分步骤需要用户在浏览器中完成操作。
步骤 1 — 安装 CLI 和 Skills
npx skills add GMGNAI/gmgn-skills
步骤 2 — 验证 CLI 安装(演示密钥)
GMGN_API_KEY=gmgn_solbscbaseethmonadtron gmgn-cli market trending --chain sol --interval 1h --limit 3
如果出现 JSON 输出,说明 CLI 已正确安装。设置尚未完成 — 这只是一个用于测试的公共演示密钥。你必须继续执行步骤 3–4,配置用户个人的 API 密钥。不要在此停下。
步骤 3 — 必需:设置个人 API 密钥
⚠️ 此步骤为强制要求。步骤 2 中的演示密钥仅支持测试,不能用于实际使用。
立即告知用户以下内容,然后无需等待用户询问即可运行密钥生成命令:
“要使用 GMGN Skills,你需要自己的 API 密钥,请前往 https://gmgn.ai/ai 获取。我现在为你生成一个 Ed25519 密钥对。”
运行:
openssl genpkey -algorithm ed25519 -out /tmp/gmgn_private.pem 2>/dev/null && \
openssl pkey -in /tmp/gmgn_private.pem -pubout 2>/dev/null
向用户展示公钥,并附上以下说明:
这是你的 Ed25519 公钥。请完成以下两个步骤:
- 前往 **https://gmgn.ai/ai**,将上面的公钥粘贴到 API Key 创建表单中并提交。
- 创建完成后,复制页面上显示的 API Key 并发回给我 — 我会为你完成步骤 4 的配置。
等待用户回复其 API Key 后,再继续执行步骤 4。
步骤 4 — 配置凭证
用户收到 API 密钥后,将其写入全局配置:
mkdir -p ~/.config/gmgn
# Write API key (replace with the actual key the user provides)
echo 'GMGN_API_KEY=<user_api_key>' > ~/.config/gmgn/.env
chmod 600 ~/.config/gmgn/.env
如果用户还需要 swap 或下单功能,请追加私钥:
# Append private key (use the PEM content from Step 3)
echo 'GMGN_PRIVATE_KEY="<pem_content>"' >> ~/.config/gmgn/.env
步骤 5 — 验证
gmgn-cli market trending --chain sol --interval 1h --limit 3
如果输出无错误,说明设置已完成。
升级(AI Agent)
运行以下两条命令,即可将 CLI 和 Skills 都升级到最新版本。
npm install -g gmgn-cli
npx skills add GMGNAI/gmgn-skills
升级后查看已安装的版本:
gmgn-cli --version
完整的升级参考,请见 第 10 节 — 升级 Skills 和 CLI。
演示案例
热门代币排行
将以下提示词发送给你的 AI Agent:
Fetch Solana 1h trending, filter for pump.fun tokens created within 6h, sort by volume descending.

实时代币交易分析
将以下提示词发送给你的 AI Agent:
Check the first token's K-line, analyze entry timing, plot price + volume chart, and provide social media links and smart money/KOL trading analysis.

1. 安装
前提条件: 安装之前,请先在 https://gmgn.ai/ai 创建你的 API Key(完整设置指南见第 3 节)。
从以下方法中选择一种:
1.1 通过 Agent(推荐)
将以下内容发送给你的 AI Agent:
npx skills add GMGNAI/gmgn-skills
1.2 npm 全局安装
npm install -g gmgn-cli
1.3 本地开发
npm install
npm run build
node dist/index.js <command> [options]
2. 验证连接
使用公共 API 密钥进行测试 — 无需注册:
GMGN_API_KEY=gmgn_solbscbaseethmonadtron gmgn-cli market trending --chain sol --interval 1h --limit 3
如果看到 JSON 输出,说明 CLI 正常工作。该公共密钥支持所有只读命令(token / market / portfolio),且仅用于测试 — 请申请自己的 API 密钥以使用任何功能(见步骤 3)。
故障排查 — 401 / 403 错误: 如果命令失败并返回
401或403,且凭证看起来正确,你的出站流量可能正在走 IPv6(不受支持)。请立即检查:(1) 运行ifconfig | grep inet6(macOS)或ip addr show | grep inet6(Linux),列出所有网络接口及其 IPv6 地址;(2) 运行curl -s https://ipv6.icanhazip.com— 如果返回 IPv6 地址,说明你的流量正在走 IPv6。请禁用网络接口上的 IPv6 — gmgn-cli 命令仅支持通过 IPv4 运行。
3. 获取你自己的 API 密钥
步骤 2 中的公共密钥仅用于测试。请在 https://gmgn.ai/ai 申请你自己的 API 密钥 — 所有实际使用(只读和 swap)都必须使用该密钥。你需要:
3.1 生成 Ed25519 密钥对
方式 1 — 询问你的 AI Agent(推荐)
将以下提示词发送给你的 Agent:
Generate an Ed25519 key pair for me using OpenSSL and show me:
1. The public key (I need to fill it in the GMGN API Key application form)
2. The private key in PEM format (I need to set it as GMGN_PRIVATE_KEY in my .env)
方式 2 — Binance 密钥生成器
下载并运行 Binance Asymmetric Key Generator。
在申请表单中输入公钥。
3.2 获取公网出口 IP
用于 IP 白名单(启用 API 密钥的兑换功能时必需):
curl ip.me
4. 配置 API 密钥
选项 1:全局配置(推荐)
创建一次 ~/.config/gmgn/.env,即可在任何目录下使用:
mkdir -p ~/.config/gmgn
cat > ~/.config/gmgn/.env << 'EOF'
GMGN_API_KEY=your_api_key_here
# Required for swap / order only:
GMGN_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n<base64>\n-----END PRIVATE KEY-----\n"
EOF
选项 2:项目 .env
cp .env.example .env
# Edit .env and fill in your values
配置查找顺序:~/.config/gmgn/.env → 项目 .env(项目配置优先)。
5. 在 AI 客户端中试用
OpenClaw
直接发送以下提示词,测试查询功能:
Show me the trending tokens on Solana in the last 1 hour.
Claude Code
将软件包安装为插件后,系统会自动发现技能。
Cursor
系统会通过 .cursor-plugin/ 配置自动发现技能。
- 完成上述安装和配置步骤
- 重启 Cursor — 技能将在 Agent 模式下通过
/gmgn-*命令提供
Cline
- 完成上述安装和配置步骤
- 在 Cline 设置 → 技能目录:指向已安装软件包的
skills/文件夹:echo "$(npm root -g)/gmgn-skills/skills" - 重启 Cline — 即可使用
/gmgn-token、/gmgn-market、/gmgn-portfolio、/gmgn-wallet-score、/gmgn-track、/gmgn-swap、/gmgn-cooking
Codex CLI
git clone https://github.com/GMGNAI/gmgn-skills ~/.codex/gmgn-cli
mkdir -p ~/.agents/skills
ln -s ~/.codex/gmgn-cli/skills ~/.agents/skills/gmgn-cli
完整说明请参见 .codex/INSTALL.md。
OpenCode
git clone https://github.com/GMGNAI/gmgn-skills ~/.opencode/gmgn-cli
mkdir -p ~/.agents/skills
ln -s ~/.opencode/gmgn-cli/skills ~/.agents/skills/gmgn-cli
完整说明请参见 .opencode/INSTALL.md。
6. 用法
示例
安装了 gmgn-cli 技能后,可以向任何 AI 助手发送以下自然语言提示词:
buy 0.1 SOL of <token_address>
sell 50% of <token_address> on BSC
sell 30% of my <token_address> position
get a quote: how much <token_address> can I get for 1 SOL?
check order status <order_id>
is <token_address> safe to buy on solana?
show top holders of <token_address>
show smart money holdings of <token_address>, sorted by buy volume
show recent KOL trades for <token_address>
show my wallet holdings on SOL
query token details for 0x1234...
show 24h K-line and volume for <token_address>
show trading stats for wallet <wallet_address> on BSC
show recent trades for wallet <wallet_address>
which wallets are linked to my API key, and what are their balances
show the latest smart money trades on SOL
show what KOLs are buying on SOL
show newly launched tokens on Solana
show Solana 1-minute trending tokens
典型工作流
研究代币:
token info → token security → token pool → token holders
分析钱包:
portfolio holdings → portfolio stats → portfolio activity
执行交易:
token info (confirm token) → portfolio token-balance (check funds) → swap → order get (poll status)
通过趋势数据发现交易机会:
market trending (top 50) → AI selects top 5 by multi-factor analysis → user reviews → token info / token security → swap
7. 工作流文档
常见分析任务的分步指南:
| 工作流 | 适用场景 |
|---|---|
| workflow-token-research.md | 买入前代币尽职调查(地址 → 买入/关注/跳过) |
| workflow-project-deep-report.md | 综合项目分析,包含评分维度和完整书面报告 |
| workflow-wallet-analysis.md | 钱包质量评估(地址 → 跟随/跳过) |
| workflow-smart-money-profile.md | 交易风格分析、跟单交易 ROI 估算、聪明钱排行榜 |
| workflow-risk-warning.md | 对持仓进行主动风险监控(巨鲸退出、流动性、开发者抛售) |
| workflow-early-project-screening.md | 筛选新上线的 launchpad 代币,寻找聪明钱入场机会 |
| workflow-daily-brief.md | 每日市场概览:趋势 + 聪明钱动态 + 早期关注项目 + 风险扫描 |
| workflow-market-opportunities.md | 从趋势数据中发现交易机会 |
| workflow-token-due-diligence.md | 代币尽职调查四步清单 |
8. CLI 参考
完整参数参考:docs/cli-usage.md。所有命令均支持 --raw,可输出单行 JSON(便于管道处理,例如 | jq '.price')。
代币
gmgn-cli token info --chain sol --address <addr>
市场
gmgn-cli market trending \
--chain sol \
--interval 1h \
--order-by volume --limit 20 \
--filter not_risk --filter not_honeypot
# Trending with numeric range filters (min_*/max_* are forwarded as query params)
gmgn-cli market trending \
--chain sol --interval 1h \
--min-liquidity 10000 --max-liquidity 1000000 \
--max-created 30m --min-smart-degen-count 1 \
--order-by volume --limit 30
gmgn-cli market trenches \
--chain sol \
--type new_creation --type near_completion --type completed \
--launchpad-platform Pump.fun --launchpad-platform pump_mayhem --launchpad-platform letsbonk \
--limit 80
# With server-side filters: safe preset + require smart money + sort by smart degen count
gmgn-cli market trenches \
--chain sol --type new_creation \
--filter-preset safe --min-smart-degen-count 1 --sort-by smart_degen_count
# Token signals — smart money buys on SOL (single group)
gmgn-cli market signal --chain sol --signal-type 12 --raw
# Token signals — multi-group: smart money OR large buys in parallel
gmgn-cli market signal --chain sol \
--groups '[{"signal_type":[12]},{"signal_type":[14,16]}]' --raw
# Hot searches — most-searched tokens (default 9-chain set, 24h)
gmgn-cli market hot-searches --raw
# Hot searches — SOL only, 1h window, top 50
gmgn-cli market hot-searches --chain sol --interval 1h --limit 50 --raw
# Hot searches — SOL with range filters (same metric names as trending)
gmgn-cli market hot-searches --chain sol --interval 1h \
--min-liquidity 10000 --min-smart-degen-count 1 --raw
投资组合
# Holdings
gmgn-cli portfolio holdings --chain sol --wallet <addr>
# Activity
gmgn-cli portfolio activity --chain sol --wallet <addr>
# Stats (supports multiple wallets)
gmgn-cli portfolio stats --chain sol --wallet <addr1> --wallet <addr2>
# P&L (supports 1–100 wallets and 1d/7d/30d/all periods)
gmgn-cli portfolio profits --chain sol --wallet <addr1> --wallet <addr2> --period 7d
# Wallets and balances linked to API key
gmgn-cli portfolio info
# Single token balance
gmgn-cli portfolio token-balance --chain sol --wallet <addr> --token <token_addr>
# Tokens created by a developer wallet
gmgn-cli portfolio created-tokens --chain sol --wallet <addr>
跟踪
# Followed token map for a wallet
gmgn-cli track follow-tokens --chain sol --wallet <wallet_address>
# Follow-wallet trade records
gmgn-cli track follow-wallet --chain sol
gmgn-cli track follow-wallet --chain sol --limit 20 --min-amount-usd 1000
# KOL trade records
gmgn-cli track kol --limit 100 --raw
gmgn-cli track kol --chain sol --side buy --limit 50 --raw
# Smart Money trade records
gmgn-cli track smartmoney --limit 100 --raw
gmgn-cli track smartmoney --chain sol --side sell --limit 50 --raw
提示
# One wallet's call-out history (last 30 days) + 7d/30d summary
gmgn-cli callout record --chain sol --wallet <wallet_address>
gmgn-cli callout record --chain sol --wallet <wallet_address> --token <token_address> --raw
# Global call-out feed (repeat --chain for multiple chains)
gmgn-cli callout global --chain sol --chain bsc --limit 20 --raw
gmgn-cli callout global --chain sol --only-kol --only-safe --min-holding-usd 1000 --raw
# Next page: pass next_page_token back verbatim
gmgn-cli callout global --chain sol --page-token <next_page_token> --raw
兑换/报价/查询
直接执行。
swap、multi-swap、order strategy create、order strategy cancel和cooking create会在验证选项后立即提交。它们不需要终端提示、--yes或GMGN_ALLOW_AUTOMATED_TRADES;这样可确保定时和无人值守策略正常运行。
# Submit swap with fixed slippage
gmgn-cli swap \
--chain sol \
--from <wallet-address> \
--input-token <input-token-addr> \
--output-token <output-token-addr> \
--amount 1000000 \
--slippage 30
# Submit swap with automatic slippage
gmgn-cli swap \
--chain sol \
--from <wallet-address> \
--input-token <input-token-addr> \
--output-token <output-token-addr> \
--amount 1000000 \
--auto-slippage
# Sell by position percentage (e.g. sell 50%)
gmgn-cli swap \
--chain sol \
--from <wallet-address> \
--input-token <token-addr> \
--output-token <usdc-addr> \
--percent 50 \
--auto-slippage
# Get quote (no transaction submitted)
gmgn-cli order quote \
--chain sol \
--from <wallet-address> \
--input-token <input-token-addr> \
--output-token <output-token-addr> \
--amount 1000000 \
--slippage 30
# Quotes use signed auth and require GMGN_PRIVATE_KEY on every chain
gmgn-cli order quote \
--chain bsc \
--from <wallet-address> \
--input-token <input-token-addr> \
--output-token <output-token-addr> \
--amount 1000000000000000000 \
--slippage 30
# Query order
gmgn-cli order get --chain sol --order-id <order-id>
# Query real-time gas price (all chains)
gmgn-cli gas-price --chain sol
gmgn-cli gas-price --chain eth
gmgn-cli gas-price --chain bsc
gmgn-cli gas-price --chain base
# Multi-wallet concurrent swap
gmgn-cli multi-swap \
--chain sol \
--accounts <addr1>,<addr2> \
--input-token <input-token-addr> \
--output-token <output-token-addr> \
--input-amount '{"<addr1>":"1000000","<addr2>":"2000000"}' \
--slippage 30
order quote在sol/bsc/base/eth上使用签名身份验证,并且需要GMGN_PRIVATE_KEY。
ETH Gas 控制(仅限 ETH)
# Pick a gas tier instead of entering gwei manually (low / average / high)
gmgn-cli swap \
--chain eth \
--from <wallet-address> \
--input-token <input-token-addr> \
--output-token <output-token-addr> \
--amount <amount> \
--slippage 30 \
--gas-level high
# Let GMGN auto-select the optimal gas fee for condition orders
gmgn-cli swap \
--chain eth \
--from <wallet-address> \
--input-token <input-token-addr> \
--output-token <output-token-addr> \
--amount <amount> \
--slippage 30 \
--condition-orders '[...]' \
--auto-fee
--gas-level和--auto-fee仅适用于 ETH。--auto-fee仅在与--condition-orders一起使用时生效。 对于其他链(SOL / BSC / BASE),请使用gas-price查询当前 Gas,然后通过--gas-price传入查询结果。
使用止盈 / 止损订单进行 Swap(需要私钥)
hold_amount 模式——每个条件订单都根据触发时的当前持仓量执行:
# Buy token A with 0.01 SOL; take-profit 50% at +100%, take-profit remaining 50% at +300%, stop-loss 100% at -65%
gmgn-cli swap \
--chain sol \
--from <wallet_address> \
--input-token So11111111111111111111111111111111111111112 \
--output-token <token_A_address> \
--amount 10000000 \
--slippage 30 \
--anti-mev \
--condition-orders '[{"order_type":"profit_stop","side":"sell","price_scale":"100","sell_ratio":"50"},{"order_type":"profit_stop","side":"sell","price_scale":"300","sell_ratio":"100"},{"order_type":"loss_stop","side":"sell","price_scale":"65","sell_ratio":"100"}]' \
--sell-ratio-type hold_amount
profit_stop的price_scale表示从入场价起的涨幅百分比("100"= +100% / 2 倍,"300"= +300% / 4 倍)。loss_stop的price_scale表示从入场价起的跌幅百分比("65"= 下跌 65%,在入场价的 35% 处触发)。hold_amount:第二个止盈订单按届时持有的数量执行(即剩余的 50%)。如果你期间增加了仓位,这些额外代币也会计入。
buy_amount 模式——每个条件订单都根据最初买入的数量执行:
# Same strategy using fixed percentages of the original bought amount
gmgn-cli swap \
--chain sol \
--from <wallet_address> \
--input-token So11111111111111111111111111111111111111112 \
--output-token <token_A_address> \
--amount 10000000 \
--slippage 30 \
--anti-mev \
--condition-orders '[{"order_type":"profit_stop","side":"sell","price_scale":"100","sell_ratio":"50"},{"order_type":"profit_stop","side":"sell","price_scale":"300","sell_ratio":"50"},{"order_type":"loss_stop","side":"sell","price_scale":"65","sell_ratio":"100"}]' \
--sell-ratio-type buy_amount
buy_amount:每个止盈订单都会卖出最初买入数量的 50%。止损订单会卖出最初买入数量的 100%。
限价订单(需要私钥)
# Create a take-profit order
gmgn-cli order strategy create \
--chain sol \
--from <wallet_address> \
--base-token <token_address> \
--quote-token <sol_address> \
--sub-order-type take_profit \
--check-price 0.002 \
--amount-in-percent 100 \
--slippage 30
# Create a stop-loss order
gmgn-cli order strategy create \
--chain sol \
--from <wallet_address> \
--base-token <token_address> \
--quote-token <sol_address> \
--sub-order-type stop_loss \
--check-price 0.0005 \
--amount-in-percent 100 \
--slippage 30
# List open strategy orders (requires private key)
gmgn-cli order strategy list --chain sol
# Cancel a strategy order
gmgn-cli order strategy cancel --chain sol --from <wallet_address> --order-id <order_id>
Cooking(需要私钥)
# Buy token and automatically attach take-profit + stop-loss condition orders
gmgn-cli cooking \
--chain sol \
--from <wallet_address> \
--input-token So11111111111111111111111111111111111111112 \
--output-token <token_address> \
--amount 1000000000 \
--slippage 30 \
--condition-orders '[{"order_type":"profit_stop","side":"sell","price_scale":"100","sell_ratio":"100"},{"order_type":"loss_stop","side":"sell","price_scale":"50","sell_ratio":"100"}]'
9. 支持的链
| 命令 | 链 | 链上货币 |
|---|---|---|
| token / market / portfolio / track | sol / bsc / base / eth / robinhood / arc / stable | — |
| swap / order | sol / bsc / base / eth / robinhood / arc / stable | sol:SOL、USDC · bsc:BNB、USDC · base:ETH、USDC · eth:ETH |
| gas-price | sol / bsc / base / eth / robinhood / arc / stable | — |
| track kol / track smartmoney · market signal | sol / bsc / base / eth / robinhood / arc / stable(kol/smartmoney) · sol / bsc / robinhood / arc / stable(signal) | — |
| cooking create | sol / bsc / base / robinhood | — |
10. 升级 Skills 和 CLI
# Upgrade CLI
npm install -g gmgn-cli
# Upgrade Skills
npx skills add GMGNAI/gmgn-skills
# Check current version
gmgn-cli --version
**通过 AI Agent:**告诉你的 Agent:“将 gmgn-cli 和 skills 升级到最新版本。”另请参阅 升级(AI Agent)。
11. 安全与免责声明(使用前请阅读)
AI Agent 可以调用此工具自动提交真实的链上交易。此工具存在固有风险,包括模型幻觉、失控执行和提示词注入。一经授权,AI Agent 将代表您关联的钱包地址提交交易——链上交易一经确认便不可撤销,并可能造成财务损失。请谨慎使用。
关于 GMGN_PRIVATE_KEY
GMGN_PRIVATE_KEY 是用于验证对 GMGN OpenAPI 服务的 API 调用的请求签名密钥。它不是区块链钱包私钥,不能直接控制链上资产。如果此密钥泄露,攻击者可能会伪造经过身份验证的 API 请求并冒用您的名义执行操作——如果怀疑密钥泄露,请立即通过 GMGN 控制面板轮换密钥。
最佳实践
- 限制配置文件权限:
chmod 600 ~/.config/gmgn/.env - 切勿将
.env文件提交到版本控制中——请将其添加到.gitignore - 请勿在日志、屏幕截图或聊天消息中分享
GMGN_API_KEY或GMGN_PRIVATE_KEY - 每次交换前,请仔细检查 AI 提供的交易摘要(链、钱包、代币地址、金额),确认其符合您的意图后再执行
- 执行大额交易前,请先用小额测试
- 始终使用最新版本的 gmgn-cli(
npm install -g gmgn-cli)。检查当前版本:gmgn-cli --version
免责声明
您使用此工具以及根据其输出作出的任何财务决策,风险均由您自行承担。对于因模型幻觉、提示词注入、凭据管理不当或用户确认错误而导致的任何交易损失、错误或未经授权的访问,GMGN 概不负责。使用此工具即表示您确认已充分了解上述风险,并自愿承担全部责任。
此 npm 软件包发布时附带来源证明,将每个版本与特定的 git 提交和 CI 流水线运行记录相关联。请使用以下命令验证:
npm audit signatures gmgn-cli
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。
