AgentSkillsCN

xgate-server

为电力系统实施发电经济调度与成本优化。无论是最小化发电成本、计算最优机组出力点、评估运行裕度,还是处理发电成本函数,这一技能都能助你事半功倍。

SKILL.md
--- frontmatter
name: xgate-server
description: |
  Queries the xgate-server API for services, agents, and on-chain data. Use when
  looking up x402 services, ERC-8004 agents, or token transfer history.
allowed-tools: [Bash, Read]

xgate-server CLI

Query the xgate-server API for X402 services, ERC-8004 agents, and on-chain token transfers.

When to Use

  • "Search for services on xgate"
  • "Find agents that support MCP"
  • "Query xgate for resources"
  • "Get token transfers for address"
  • "Search xgate agents"
  • "List services on xgate-server"
  • "Set up xgate MCP"
  • "Connect xgate to Claude"
  • "How do I use x402 tools in Claude?"

MCP Setup

The xgate MCP lets Claude call x402 APIs directly with automatic micropayments. The human must authenticate — the agent cannot do this step.

Tell the human:

  1. Go to xgate.run and connect their wallet to generate an MCP connector URL
  2. Add to Claude — paste the URL into their Claude config:

Claude Code:

bash
claude mcp add xgate --transport http https://xgate.run/user/<walletSlug>/mcp?token=<token>

Claude Desktop (Settings → Developer → Edit Config):

json
{
  "mcpServers": {
    "xgate": {
      "url": "https://xgate.run/user/<walletSlug>/mcp",
      "headers": { "Authorization": "Bearer <token>" }
    }
  }
}

Once connected, the agent can:

  • Search resources: ask Claude to call xgate_search({ query: "weather" })
  • Add tools: xgate_add_resource({ url: "..." }) to add x402 APIs to the toolset
  • Use tools: call discovered APIs directly — payments settle automatically via server wallet

Important: If MCP tools aren't available, prompt the human to complete auth first. The agent cannot generate the connector URL — it requires wallet signing.

CLI Usage

Use the bundled CLI at plugins/xgate-server/scripts/xgate:

bash
# Health check
./plugins/xgate-server/scripts/xgate health

# Search services
./plugins/xgate-server/scripts/xgate services -q "token" -n ethereum

# Get a specific service
./plugins/xgate-server/scripts/xgate service SERVICE_ID

# Search agents
./plugins/xgate-server/scripts/xgate agents -p MCP --min-score 0.8

# Query token transfers
./plugins/xgate-server/scripts/xgate transfers -c 8453 --totals

# Resource transfers
./plugins/xgate-server/scripts/xgate resource-transfers 0xADDRESS -c 1

Run ./plugins/xgate-server/scripts/xgate --help for full option reference.

API Base URL

https://api.xgate.run

Override via XGATE_URL environment variable.

Service Query Parameters

ParameterTypeDescription
qstringFree-text search query
networkstringComma-separated networks (ethereum, base, polygon)
assetstringComma-separated assets (USDC, ETH)
schemestringService scheme filter
versionnumberX402 version filter
maxAmountbigintMaximum amount required
limitnumberResults per page (1-50, default: 10)
offsetnumberPagination offset
debugbooleanReturn scoring diagnostics

Agent Query Parameters

ParameterTypeDescription
qstringFree-text search query
chain_idnumberBlockchain chain ID
protocolsstringComma-separated (MCP, A2A)
identity_registrystringIdentity registry address
agent_idstringSpecific agent ID
walletstringWallet address
has_metadatabooleanFilter by metadata presence
supported_truststringComma-separated trust types
mcp_versionstringMCP protocol version
mcp_capabilitiesstringComma-separated capabilities
a2a_skillsstringComma-separated A2A skills
a2a_interfacesstringComma-separated interfaces
validation_statusenumpending, completed, expired, revoked
min_scorenumberMinimum reputation score (0-1)
min_confidencenumberMinimum confidence threshold
min_pass_ratenumberMinimum validation pass rate
limitnumberResults per page (1-50)
offsetnumberPagination offset
debugbooleanReturn rank breakdown

Transfer Query Parameters

ParameterTypeDescription
facilitator_idstringFacilitator identifier
chain_idnumberBlockchain chain ID
token_contractstringToken contract address (0x)
from_addressstringSource address (0x)
to_addressstringDestination address (0x)
wallet_addressstringWallet address filter
block_number_fromnumberStarting block
block_number_tonumberEnding block
block_timestamp_fromstringISO timestamp
block_timestamp_tostringISO timestamp
limitnumberResults limit
cursorstringPagination cursor
orderenumasc or desc
include_totalsbooleanInclude value totals

Response Format

Services

json
{
  "query": {},
  "total": 42,
  "results": [
    {
      "id": "service_id",
      "resource": "0x...",
      "type": "http",
      "networks": ["ethereum"],
      "assets": ["USDC"],
      "score": 0.95
    }
  ],
  "diagnostics": { "latencyMs": 125 }
}

Agents

json
{
  "query": {},
  "total": 25,
  "results": [
    {
      "agentKey": "key",
      "agentId": "0x...",
      "name": "Agent Name",
      "protocols": ["MCP", "A2A"],
      "reputationScore": 0.95,
      "rankScore": 87.5
    }
  ]
}

Error Handling

StatusMeaning
400Invalid query parameters
401Unauthorized (missing/invalid x-internal-key)
404Resource not found
503Search engine unavailable
500Internal server error

Chain IDs

ChainID
Ethereum Mainnet1
Base8453
Sepolia11155111
Polygon137

Tips

  1. Use --debug flag (or debug=true) to understand scoring/ranking
  2. Use pagination for large result sets (cursor-based for transfers, offset-based for services/agents)
  3. Check xgate health first if queries fail
  4. Pipe output through jq filters to extract specific fields