内容
# gate402-mcp
[](https://x402.fuchss.app/provider/gate402.app)
MCP 服务器,用于 **[Gate402](https://gate402.app)** — 通过 HTTP 402(x402 / USDC on Base)提供按次付费的代理 API。 为任何 MCP 客户端提供完整的工具包,无需注册,首次运行即可免费使用 — 包括完整的 Base 交易循环(发现 → 验证 → 读取 → 执行):
| 工具 | 功能 | 价格 |
|---|---|---|
| `gate402_scrape` | 获取任何公共 URL,渲染 JS,剥离导航/广告 → 清洁的 LLM-ready Markdown | $0.002 |
| `gate402_scrape_stealth` | 通过住宅代理和 CAPTCHA 解决的 Cloudflare/anti-bot 获取 → 清洁的 Markdown | $0.05 |
| `gate402_minify` | 压缩文本以减少下游 LLM 代币消耗(~40%) | $0.005 / 10k tok |
| `gate402_dedup` | 语义向量缓存查找(精确 + 余弦) | $0.001 次 / $0.003 未命中 |
| `gate402_onchain` | Base 上的链上钱包/代币情报(余额,EOA/合约,交易次数,代币元数据) | $0.01 |
| `gate402_dex` | Base 代币的实时 DEX 价格 / 流动性 / 24 小时交易量 | $0.01 |
| `gate402_news` | 最近的新闻标题 + 指定 ticker/主题的牛/熊情绪 | $0.02 |
| `gate402_edgar` | 指定美国 ticker 的最新 SEC EDGAR 文件(10-K/10-Q/8-K) | $0.02 |
| `gate402_token_risk` | Base 代币的 Rug/tradeability 判决(分数 + SAFE/CAUTION/AVOID;流动性,honeypot 模拟,持有人集中度) | $0.03 |
| `gate402_momentum` | Base 代币的动量 + 订单流信号(RISING/FALLING + ACCUMULATION/DISTRIBUTION,honeypot-gated) | $0.02 |
| `gate402_best_swap` | 最佳执行情报:哪个 DEX 池 + 估计的交易规模价格影响 | $0.02 |
| `gate402_launches` | 最新 Base 代币启动雷达,轻度预筛选 | $0.02 |
…另外三个 **免费** 工具在 **此过程中本地运行** (纯计算 — 无需支付,无需密钥,无需网络):
| 工具 | 功能 |
|---|---|
| `gate402_token_count` | 估计字符串的代币数量(预算您的上下文窗口) |
| `gate402_html_to_md` | 将您已有的 HTML 字符串转换为干净的 Markdown |
| `gate402_json_repair` | 将格式错误的 / LLM-mangled JSON 强制转换为有效的 JSON |
## 计费方式
首次使用时,服务器会自行领取一个 **免费积分 API 密钥**,并将其缓存在 `~/.gate402-mcp/key.json` 中。 调用会消耗该积分。 当积分用完时,工具会返回一个充值链接而不是失败。 要跳过免费层,请将 `GATE402_API_KEY` 设置为一个已充值的账户([充值](https://gate402.app/ops/billing/checkout))。
付款 *即* 是身份验证 — 无需创建账户。
## 安装
```bash
npm install -g gate402-mcp
```
或通过 `npx gate402-mcp` 运行而无需安装。
## 配置您的 MCP 客户端
### Claude Desktop / Claude Code
添加到您的 MCP 配置(`claude_desktop_config.json` 或 `claude mcp add`):
```json
{
"mcpServers": {
"gate402": {
"command": "npx",
"args": ["-y", "gate402-mcp"]
}
}
}
```
### Cursor / Cline / Windsurf
形状相同 — 将 MCP 服务器 `command` 指向 `npx -y gate402-mcp`。
### 代理框架(LangChain,CrewAI,LlamaIndex)
gate402 是一个标准的 stdio MCP 服务器,因此任何具有 MCP 适配器的框架都可以加载所有 15 种工具:
**LangChain / LangGraph** (`langchain-mcp-adapters`):
```python
from langchain_mcp_adapters.client import MultiServerMCPClient
client = MultiServerMCPClient({"gate402": {"command": "npx", "args": ["-y", "gate402-mcp"], "transport": "stdio"}})
tools = await client.get_tools() # feed into your agent
```
**CrewAI** (`MCPServerAdapter`):
```python
from crewai_tools import MCPServerAdapter
from mcp import StdioServerParameters
params = StdioServerParameters(command="npx", args=["-y", "gate402-mcp"])
with MCPServerAdapter(params) as tools:
... # pass tools to your Crew
```
**LlamaIndex** (`McpToolSpec`):
```python
from llama_index.tools.mcp import BasicMCPClient, McpToolSpec
tools = McpToolSpec(client=BasicMCPClient("npx", args=["-y", "gate402-mcp"])).to_tool_list()
```
一旦连接,代理就会自主调用工具;免费积分密钥将在首次使用时声明,付费工具将从中扣除。
## 环境变量
| 变量 | 默认值 | 用途 |
|---|---|---|
| `GATE402_API_KEY` | _(未设置)_ | 使用已充值的账户代替免费层。 |
| `GATE402_BASE_URL` | `https://gate402.app` | 重定向网关(自托管 / 测试)。 |
| `GATE402_CONFIG_DIR` | `~/.gate402-mcp` | 缓存的免费密钥存储位置。 |
## 开发
```bash
npm install
npm run build
npm start # 或:npm run dev
```
## 许可证
MIT