内容
# djd-agent-score-mcp
MCP 服务器,用于 **DJD 代理评分** —— 一个用于 Base 上的 AI 代理钱包的声誉评分 API。
[](https://github.com/coinbase/x402)
[](https://www.npmjs.com/package/djd-agent-score-mcp)
该服务器以 [模型上下文协议](https://modelcontextprotocol.io/) 工具的形式公开 DJD 代理评分 REST API,因此任何与 MCP 兼容的代理(Claude、GPT、Gemini、LangChain 等)都可以原生调用评分端点。
## 工具列表
| 工具 | 端点 | 费用 | 描述 |
|------|----------|------|-------------|
| `score_basic` | `GET /v1/score/basic` | 免费 | 基本评分、等级、置信度 |
| `score_full` | `GET /v1/score/full` | $0.10(x402) | 完整维度分解 |
| `score_refresh` | `GET /v1/score/refresh` | $0.25(x402) | 使用最新链数据重新评分 |
| `report_fraud` | `POST /v1/report` | $0.02(x402) | 提交欺诈报告 |
| `check_blacklist` | `GET /v1/data/fraud/blacklist` | $0.05(x402) | 检查欺诈报告 |
| `get_badge` | `GET /v1/badge/{wallet}.svg` | 免费 | 可嵌入的 SVG 徽章 |
| `get_leaderboard` | `GET /v1/leaderboard` | 免费 | 评分最高的钱包 |
| `register_agent` | `POST /v1/agent/register` | 免费 | 注册带有元数据的钱包 |
| `health_check` | `GET /health` | 免费 | 系统状态 |
## 安装
```bash
npm install -g djd-agent-score-mcp
```
或使用 npx 直接运行:
```bash
npx djd-agent-score-mcp
```
## 配置
### Claude Desktop
添加到 `~/Library/Application Support/Claude/claude_desktop_config.json`(macOS)或 `%APPDATA%\Claude\claude_desktop_config.json`(Windows):
```json
{
"mcpServers": {
"djd-agent-score": {
"command": "npx",
"args": ["-y", "djd-agent-score-mcp"]
}
}
}
```
### Cursor
在项目根目录中添加到 `.cursor/mcp.json`:
```json
{
"mcpServers": {
"djd-agent-score": {
"command": "npx",
"args": ["-y", "djd-agent-score-mcp"]
}
}
}
```
### Claude Code
在项目的 `.mcp.json` 中添加:
```json
{
"mcpServers": {
"djd-agent-score": {
"command": "npx",
"args": ["-y", "djd-agent-score-mcp"]
}
}
}
```
### 通用 MCP 客户端(可流式传输的 HTTP)
在 HTTP 模式下启动服务器:
```bash
TRANSPORT=http PORT=3000 npx djd-agent-score-mcp
```
然后将您的 MCP 客户端连接到 `http://localhost:3000/mcp`。
## 环境变量
| 变量 | 默认值 | 描述 |
|----------|---------|-------------|
| `DJD_BASE_URL` | `https://djd-agent-score.fly.dev` | API 基本 URL(本地开发使用 `http://localhost:3001`) |
| `DJD_TIMEOUT_MS` | `10000` | 请求超时毫秒数 |
| `TRANSPORT` | `stdio` | 传输模式:`stdio` 或 `http` |
| `PORT` | `3000` | HTTP 服务器端口(仅在 `TRANSPORT=http` 时使用) |
## 开发
```bash
git clone <仓库 URL>
cd djd-agent-score-mcp
npm install
npm run build
npm start
```
在开发过程中指向本地 API:
```bash
DJD_BASE_URL=http://localhost:3001 npm start
```
## x402 支付
某些端点需要 x402 微支付。当代理调用付费工具时,API 以 HTTP 402 和支付说明响应。您的代理框架必须:
1. 检测 402 响应
2. 完成 x402 支付(Base 上的 USDC)
3. 重试带有支付证明的请求
MCP 服务器在工具的错误响应中提供 402 详细信息,以便代理可以处理它。
## 许可证
MIT