Token导航 LogoToken导航TokenDH.com
MCP Tool Gateway logo
AI代理stdio官方级别未说明来源级核验

MCP Tool Gateway

MCP Server

MCP Tool Gateway是一个去中心化的AI代理工具市场,集成x402支付协议,支持工具的发现、认证、支付和执行。

工具数

0

提示词数

0

GitHub Stars

1

资源数

0
PythonAI代理工具AI代理

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Rangernarock

提供方

Rangernarock

最后核验

2026/5/17 20:19

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install -e .

详细介绍

MCP工具网关

一个具有x402支付集成的去中心化、代理原生工具市场。

状态: MVP开发\ 作者 @开爪鼠李

______________________________________________________________________

概述

MCP工具网关使AI代理能够以编程方式发现、验证、支付和执行工具。基于类似于x402(HTTP 402 Payment Required)的原则,它将默认支付模型扩展到MCP(模型上下文协议)生态系统。

核心论文: 在代理经济中,工具就是基础设施。基础设施应该自动货币化、无需信任和机器可读。

______________________________________________________________________

特性

核心

  • x402支付引擎 -HTTP 402支付要求模式
  • 工具注册表 -注册、发现和管理MCP工具
  • MCP协议适配器 -JSON-RPC 2.0兼容
  • 托管经理 -通过争议解决确保资金持有

安全性(v1.0增强版)

  • DID身份验证 -去中心化身份
  • 可验证的凭据 -信任验证
  • 欺诈检测 -基于机器学习的异常检测
  • 加密实用程序 -ZK证明、签名、Merkle树

执行

  • 多级沙盒 -WASM、VM、Docker、气隙
  • 认证系统 -加密执行证明
  • 工具组成 -链式多工具

______________________________________________________________________

快速开始

安装

# Clone repository
cd mcp-tool-gateway

# Install dependencies
pip install -e .

# Or install from source
pip install poetry
poetry install

运行服务器

# Development
python -m mcp_gateway.main

# Or with uvicorn
uvicorn mcp_gateway.main:app --reload --host 0.0.0.0 --port 8000

运行测试

pytest tests/

______________________________________________________________________

建筑

┌─────────────────────────────────────────────────────────────────┐
│                        MCP Tool Gateway                          │
├─────────────────────────────────────────────────────────────────┤
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────────┐  │
│  │ Tool       │  │ Auth       │  │ Payment                 │  │
│  │ Registry   │  │ Layer      │  │ Engine                  │  │
│  │            │  │ (DID/VC)   │  │ (x402 + Escrow)        │  │
│  └─────────────┘  └─────────────┘  └─────────────────────────┘  │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────────┐  │
│  │ Executor   │  │ Discovery  │  │ Security                │  │
│  │ Pool       │  │ Engine     │  │ (Fraud + Crypto)        │  │
│  │ (Sandbox)  │  │ (Vector)   │  │                         │  │
│  └─────────────┘  └─────────────┘  └─────────────────────────┘  │
└─────────────────────────────────────────────────────────────────┘

______________________________________________________________________

API终点

MCP协议

POST /v1/execute          # MCP JSON-RPC endpoint

工具管理

GET    /api/v1/tools       # List tools
POST   /api/v1/tools       # Register tool
GET    /api/v1/tools/{id}  # Get tool
DELETE /api/v1/tools/{id}  # Delete tool
GET    /api/v1/tools/search # Search tools
GET    /api/v1/categories  # Get categories

工具执行

POST   /api/v1/execute     # Execute tool

支付

POST   /api/v1/payments/challenge  # Create payment challenge
POST   /api/v1/payments/verify     # Verify payment
POST   /api/v1/payments/authorize  # Authorize payment
GET    /api/v1/payments/spending/{agent_id} # Get spending

托管

POST   /api/v1/escrow           # Create escrow
GET    /api/v1/escrow/{id}      # Get escrow
POST   /api/v1/escrow/{id}/fund    # Fund escrow
POST   /api/v1/escrow/{id}/lock    # Lock escrow
POST   /api/v1/escrow/{id}/complete # Complete execution
POST   /api/v1/escrow/{id}/dispute  # Open dispute

______________________________________________________________________

使用示例

注册工具

import httpx

# Create tool
response = httpx.post("http://localhost:8000/api/v1/tools", json={
    "name": "web-search",
    "description": "Search the web",
    "provider_id": "my-agent",
    "provider_address": "0x1234...",
    "category": "search",
    "pricing": {
        "type": "per_call",
        "price": "500000"  # 0.0005 USDC
    }
})
tool = response.json()

使用支付执行工具

# Execute tool
response = httpx.post("http://localhost:8000/api/v1/execute", json={
    "tool_name": "web-search",
    "arguments": {"query": "latest AI news"},
    "auto_pay": True,
    "max_price": "1000000"
})

if response.status_code == 402:
    # Payment required
    challenge = response.json()["error"]["data"]
    print(f"Pay {challenge['amount']} USDC to {challenge['recipient']}")
else:
    result = response.json()
    print(result["result"])

MCP JSON-RPC

# MCP request
request = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/execute",
    "params": {
        "tool": "web-search",
        "arguments": {"query": "hello"}
    }
}

response = httpx.post("http://localhost:8000/v1/execute", json=request)

______________________________________________________________________

配置

创建 .env 文件:

# App
DEBUG=true
HOST=0.0.0.0
PORT=8000

# Network
NETWORK=base-sepolia
RPC_URL=https://sepolia.base.org

# Payment
PAYMENT_TOKEN=USDC
PAYMENT_TOKEN_ADDRESS=0x036CbD53842c5426634e7929541eC2318f3dCF7e

# Security
HIGH_VALUE_THRESHOLD=100.0
MAX_DAILY_SPENT=1000.0

# Escrow
ESCROW_TIMEOUT=300
DISPUTE_WINDOW=86400

______________________________________________________________________

项目结构

mcp-tool-gateway/
├── src/mcp_gateway/
│   ├── __init__.py
│   ├── main.py              # FastAPI app
│   ├── config.py            # Configuration
│   ├── core/
│   │   ├── payment.py       # x402 Payment Engine
│   │   ├── escrow.py        # Escrow Manager
│   │   ├── registry.py      # Tool Registry
│   │   └── mcp.py           # MCP Protocol
│   ├── security/
│   │   ├── auth.py          # DID/VC Auth
│   │   ├── fraud.py         # Fraud Detection
│   │   └── crypto.py        # Cryptography
│   ├── execution/
│   │   ├── sandbox.py       # Sandboxing
│   │   └── executor.py      # Tool Executor
│   └── discovery/
│       └── search.py        # Vector Search
├── tests/
├── examples/
└── contracts/               # Smart contracts (future)

______________________________________________________________________

路线图

v0.1(当前)-MVP

  • \[x\] 核心支付引擎
  • \[x\] 基本工具注册表
  • \[x\] 简单的MCP适配器
  • \[x\] 内存托管
  • \[x\] API基础

v0.2-安全

  • \[\]DID/VC身份验证
  • \[\]欺诈检测集成
  • \[\]速率限制

v0.3-高级执行

  • \[\]沙盒集成
  • \[\]认证系统
  • \[\]工具组成

v1.0-生产

  • \[\]链上注册表
  • \[\]真实支付集成
  • \[\]分布式执行

______________________________________________________________________

参考文献

______________________________________________________________________

许可证

麻省理工学院

目录标签

目录标签

PythonAI代理工具AI代理去中心化工具市场本地部署x402支付工具执行

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP