Skip to content

Trading intelligence for AI agents. Pay-per-use via x402 micropayments on Base.

License

Notifications You must be signed in to change notification settings

the911fund/x402-docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

x402 Meta Gateway

AI-synthesized intelligence from 10+ sources. Pay per query with USDC.

x402 Meta Gateway delivers AI-powered market intelligence through eight endpoints — token analysis, trending detection, X/Twitter sentiment, neural search, deep research, prediction markets, macro economics, and news aggregation — all accessible via USDC micropayments. No API keys. No subscriptions. Just pay and receive.

Available via REST (GET /alpha/*) and MCP (POST /mcp). Same tools, same pricing.

Supported Payment Chains

REST API (GET /alpha/*)

Chain Status Payment Method USDC Contract Receiver
Base Live EIP-712 signTypedData 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 0xd86F1F35d6B15fEBef2f4a4390b584D8a7deC0B6
Ethereum Live EIP-712 signTypedData 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 0xd86F1F35d6B15fEBef2f4a4390b584D8a7deC0B6
Solana Live Solana signTransaction EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v CtbPTTFMRfULUMz7DjPDRCKXVSBEcAEXeTUq4n7fSFuf

MCP Server (POST /mcp)

Chain Status Notes
Base Live Full support — CDP facilitator verification + settlement
Solana Live (limited) Payment requirements are returned, but verification may fail depending on facilitator SVM support (often invalid_payload).
Ethereum Not available x402 SDK v1.0 does not include Ethereum mainnet in its network mappings (processPriceToAtomicAmount). Use Base (same addresses, lower fees) for EVM payments via MCP.

Why the difference? REST endpoints use a facilitator pool (Dexter primary with Coinbase CDP fallback), and Solana challenge accepts are health-gated by facilitator readiness. MCP currently verifies/settles through CDP paths and builds requirements via x402 SDK network mappings, so MCP chain behavior is more constrained. These are facilitator/SDK implementation limits, not protocol limits.

Signing Requirements by Chain

Base (EVM):

  • Uses EIP-712 TransferWithAuthorization (USDC permit-style)
  • Sign with signTypedData via viem, ethers, or any EVM wallet
  • Works with: @x402/fetch, @x402/axios, Circle Programmable Wallets, MetaMask
  • Confirmation: ~2-3 seconds

Ethereum (EVM):

  • Same signing method as Base (EIP-712 signTypedData)
  • Same tooling: @x402/fetch, @x402/axios, viem, ethers
  • Higher gas fees than Base — Base recommended for cost efficiency
  • REST API only (MCP pending SDK support)

Solana (SVM):

  • Uses SPL token transfer instruction signed as a Solana transaction
  • Sign with signTransaction via @solana/web3.js or Solana wallet adapter
  • Requires a fee payer with SOL for transaction fees (server provides extra.feePayer)
  • Works with: local Solana keypairs, Phantom, Solflare
  • Note: Circle Programmable Wallets' signMessage does NOT work — you need full transaction signing
  • Confirmation: ~400ms

Endpoints

Endpoint Price What You Get
/alpha/token $0.03 USDC Price, volume, market cap + X/Twitter engagement data + AI trading signals
/alpha/trending $0.03 USDC Top trending tokens + X/Twitter analysis + AI narrative detection
/alpha/sentiment $0.05 USDC up to 99 tweets analyzed with full engagement metrics (likes, views, retweets, followers) + bull/bear scoring
/alpha/search $0.03 USDC Neural search via Exa + X/Twitter + AI summary with sources
/alpha/deep $0.10 USDC Full research: Exa + Firecrawl + Claude + up to 99 tweets with engagement data
/alpha/prediction $0.03 USDC Prediction market intelligence with X/Twitter sentiment (Polymarket + Kalshi + X + Grok)
/alpha/macro $0.05 USDC Macro economic pulse with X/Twitter sentiment (FRED + Polymarket + Kalshi + X + Grok)
/alpha/news $0.02 USDC AI-filtered crypto news from CoinTelegraph, Decrypt, CoinDesk, Blockworks + X

X/Twitter engagement data (likes, views, retweets, followers, verified status) has no separate surcharge when available.


MCP Server

The MCP server exposes all AI Intelligence tools via Model Context Protocol over Streamable HTTP. AI agents can discover and call tools using standard MCP JSON-RPC, with x402 USDC payments on Base or Solana.

Endpoint: POST https://x402.911fund.io/mcp

MCP Tools

Tool Price Description
alpha_token $0.03 Token analysis with price, volume, X/Twitter engagement data, and AI signals.
alpha_trending $0.03 Trending tokens and narratives with X/Twitter analysis.
alpha_sentiment $0.05 up to 99 tweets with full engagement metrics + bull/bear scoring.
alpha_search $0.03 Neural search via Exa + X/Twitter + AI summary.
alpha_deep $0.10 Deep research: Exa + Firecrawl + Claude + up to 99 tweets. Up to 60s.
alpha_prediction $0.03 Prediction market odds + X/Twitter sentiment (Polymarket + Kalshi + X + Grok).
alpha_macro $0.05 Macro economic intelligence + X/Twitter sentiment (FRED + Polymarket + Kalshi + X + Grok).
alpha_news $0.02 Crypto news from major publications + Twitter with AI synthesis.
alpha_stats Free Gateway stats (uptime, memory, rate limits).

MCP Quick Start

1. Initialize the connection (free):

curl -X POST https://x402.911fund.io/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}},"id":1}'

2. List available tools (free):

curl -X POST https://x402.911fund.io/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","method":"tools/list","id":2}'

3. Call a free tool:

curl -X POST https://x402.911fund.io/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"alpha_stats","arguments":{}},"id":3}'

4. Call a paid tool (requires X-PAYMENT header):

Without payment, you get HTTP 402 with payment requirements for both Base and Solana:

curl -X POST https://x402.911fund.io/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"alpha_token","arguments":{"symbol":"SOL"}},"id":4}'

With payment:

curl -X POST https://x402.911fund.io/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "X-PAYMENT: <signed_payment>" \
  -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"alpha_token","arguments":{"symbol":"SOL"}},"id":4}'

MCP with TypeScript (Base)

import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const transport = new StreamableHTTPClientTransport(
  new URL("https://x402.911fund.io/mcp")
);

const client = new Client({ name: "my-agent", version: "1.0.0" });
await client.connect(transport);

// Discover tools (free)
const { tools } = await client.listTools();
console.log(tools.map(t => `${t.name}: ${t.description}`));

// Call free tool
const stats = await client.callTool({ name: "alpha_stats", arguments: {} });
console.log(stats);

For paid tools, the X-PAYMENT header must contain a signed payment payload. The agent chooses which chain to pay on:

  • Base: EIP-712 TransferWithAuthorization -- use @x402/fetch or viem signTypedData
  • Solana: Signed SPL transfer transaction -- use @solana/web3.js signTransaction

Agent Configuration

{
  "mcpServers": {
    "x402-alpha": {
      "url": "https://x402.911fund.io/mcp",
      "transport": "streamable-http"
    }
  }
}

MCP Technical Details

  • Transport: Streamable HTTP (POST, not SSE/WebSocket)
  • Protocol: JSON-RPC 2.0 over HTTP
  • Required headers: Content-Type: application/json, Accept: application/json, text/event-stream
  • Payment header: X-PAYMENT (Base: EIP-712 signed, Solana: signed transaction)
  • Payment chains: Base (USDC), Solana (USDC). Ethereum pending x402 SDK support.
  • Stateless: No sessions. Each request is independent.
  • Response format: SSE (event: message\ndata: {json})

REST Quick Start

Using curl (manual x402 flow)

# Step 1: Hit the endpoint -- you get a 402 with payment details
curl -i https://x402.911fund.io/alpha/token?symbol=SOL

# Step 2: Sign payment with your wallet, then retry with payment header
curl -H "X-PAYMENT: <signed_payment_payload>" \
  https://x402.911fund.io/alpha/token?symbol=SOL

Using @x402/fetch (recommended for TypeScript)

import { createX402Fetch } from "@x402/fetch";
import { createWalletClient, http } from "viem";
import { base } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
const walletClient = createWalletClient({
  account,
  chain: base,
  transport: http(),
});

const x402Fetch = createX402Fetch(walletClient);

// Token analysis -- $0.03
const res = await x402Fetch("https://x402.911fund.io/alpha/token?symbol=SOL");
const data = await res.json();
console.log(data);

Endpoint Details

GET /alpha/token -- Token Analysis

Param Required Description
symbol Yes* Token symbol (e.g., SOL, ETH, WIF)
address Yes* Contract address (alternative to symbol)
token Yes* Alias for address or symbol
chain No Chain for lookup (default: base)

X/Twitter engagement data included automatically.

GET /alpha/trending -- Market Movers

Param Required Description
category No Filter by category
limit No Number of results

X/Twitter analysis included automatically.

GET /alpha/sentiment -- X/Twitter Analysis

Param Required Description
query Yes* Search query -- cashtag ($WIF), topic, or account
topic Yes* Alias for query
token Yes* Alias for query

GET /alpha/search -- Quick Research

Param Required Description
query Yes* Research query (e.g., Jupiter DEX Solana)
q Yes* Alias for query

GET /alpha/deep -- Full Research Suite

Param Required Description
query Yes* Research question
topic Yes* Alias for query
token Yes* Alias for query
url Yes* Specific URL to research

GET /alpha/prediction -- Prediction Markets

Param Required Description
query Yes Prediction query (e.g., fed chair, trump tariff, bitcoin 150k, recession, election)
category No Filter: crypto, politics, economics, sports, other

Sources: Polymarket, Kalshi, X/Twitter. AI synthesis via Grok.

GET /alpha/macro -- Macro Economics

Param Required Description
theme No One of 20 macro themes (see below). Defaults to general.

Available Themes (20):

Theme FRED Data
inflation CPI, breakeven inflation, PCE
rates Fed funds rate, 10Y/2Y Treasury
employment Unemployment, nonfarm payrolls, jobless claims
recession Sahm rule, yield curve, consumer sentiment
energy WTI crude oil, gas prices, energy CPI
housing 30Y mortgage, housing starts, Case-Shiller, median price
trade Trade balance, dollar index, import prices
markets S&P 500, VIX, high yield credit spreads
consumer Retail sales, consumer sentiment, savings rate
debt Federal debt, debt/GDP ratio, deficit/GDP
manufacturing Industrial production, PPI, manufacturing employment
wages Avg hourly earnings, labor participation, ECI wages
credit Consumer credit, credit card + mortgage delinquencies
crypto Bitcoin + Ethereum prices (Coinbase via FRED)
money M2 money stock, monetary base, M2 velocity
currency Dollar index, USD/EUR, CAD/USD
financial_stress STL Financial Stress Index, VIX, credit spreads
commodities PPI all commodities, crude oil, energy CPI
banking C&I loans, mortgage + credit card delinquency rates
general Fed funds, CPI, unemployment, GDP, 10Y, yield curve

Sources: FRED (Federal Reserve Economic Data), Polymarket, Kalshi, X/Twitter. AI synthesis via Grok.

GET /alpha/news -- Crypto News

Param Required Description
query No Search keyword (e.g., bitcoin, ETF, regulation, solana)
category No Filter by source: coindesk, cointelegraph, decrypt, blockworks

Sources: CoinTelegraph, Decrypt, CoinDesk, Blockworks (via RSS), X/Twitter. AI synthesis via Grok.


Trust, Billing, and Query Quality

Trust/Billing Semantics

Status Code Charged? Meaning
400 invalid_params No Missing or malformed required input.
422 needs_clarification No Input is too short/ambiguous for reliable execution.
402 payment required Yes (on successful paid retry) Valid request shape, payment required before execution.
200 preview No preview=true (REST) or preview: true (MCP) returns estimate only.

Notes:

  • Trust validation runs before payment on protected /alpha/* routes.
  • Clarification and preview flows are explicitly no-charge.
  • Payment authorizes a compute attempt; it does not guarantee every upstream source is always reachable.
  • Responses include x-request-id for traceability.

X/Twitter Availability Semantics

Endpoint X/Twitter Required? Behavior if X/Twitter unavailable
/alpha/sentiment Yes Returns 503 upstream_failed
/alpha/token No Returns 200 with warnings:["twitter_unavailable"]
/alpha/trending No Returns 200 with warnings:["twitter_unavailable"]
/alpha/search No Returns 200 with warnings:["twitter_unavailable"]
/alpha/deep No Continues with available sources (partial result possible)
/alpha/prediction No Returns 200 with warnings:["twitter_unavailable"]
/alpha/macro No Returns 200 with warnings:["twitter_unavailable"]
/alpha/news No Returns 200 with warnings:["twitter_unavailable"]

Common reasons X/Twitter may be unavailable:

  • No relevant tweets found for the specific query/time window.
  • Upstream X provider timeout or transient error.
  • Upstream rate limiting.
  • Query/filter combination excludes most matches.

Best Query Patterns

Endpoint Query Playbook

Endpoint Strong query example Weak query example
/alpha/token /alpha/token?symbol=SOL or /alpha/token?address=0x... /alpha/token?symbol=x
/alpha/trending /alpha/trending or /alpha/trending?category=defi /alpha/trending?category=random
/alpha/sentiment /alpha/sentiment?query=JUP unlock schedule impact /alpha/sentiment?query=hi
/alpha/search /alpha/search?query=Solana DEX fee switch timeline 2026 /alpha/search?query=ok
/alpha/deep /alpha/deep?query=Base L2 sequencer decentralization roadmap 2026 /alpha/deep?query=coin
/alpha/prediction /alpha/prediction?query=fed rate cut by June 2026&category=economics /alpha/prediction?query=test
/alpha/macro /alpha/macro?theme=inflation /alpha/macro?theme=whatever
/alpha/news /alpha/news?query=bitcoin ETF flows&category=coindesk /alpha/news?query=hi

Use specific, intent-rich prompts. Prefer:

  • /alpha/search?query=Jupiter DEX Solana fee switch timeline
  • /alpha/prediction?query=fed rate cut by June 2026&category=economics
  • /alpha/deep?query=Base L2 sequencer decentralization roadmap 2026

Avoid low-signal prompts likely to trigger clarification:

  • hi, help, test, single-character ticker fragments, or context-free one-word queries.

How x402 Payment Works

1. Request Without Payment

GET /alpha/token?symbol=SOL  ->  HTTP 402 Payment Required

The 402 response includes payment options for each supported chain.

2. Sign Payment

  • Base: EIP-712 TransferWithAuthorization via signTypedData
  • Ethereum: Same as Base (EIP-712 signTypedData)
  • Solana: SPL token transfer instruction via signTransaction

3. Retry With Payment Proof

GET /alpha/token?symbol=SOL
X-PAYMENT: <payment_proof>

The @x402/fetch SDK handles steps 1-3 automatically for EVM chains (Base, Ethereum).


Error Reference

Status Meaning Action
402 Payment required Follow the payment flow above
400 Bad request Check required parameters
429 Rate limited (30 req/min) Wait and retry
500 Upstream service error Retry after a brief delay

Network & Payment Info

Detail Value
REST Chains Base, Ethereum, Solana
MCP Chains Base, Solana (Ethereum pending SDK support)
Token USDC
Protocol x402 (HTTP 402 Payment Required)
Facilitator REST: Dexter primary + Coinbase CDP fallback. MCP verify/settle: Coinbase CDP
Settlement Direct to wallet
Rate Limit 30 requests/minute per IP

Known Facilitator/SDK Limitations

These are current facilitator/SDK implementation limits, not protocol limitations:

  • MCP + Ethereum: The x402 SDK's processPriceToAtomicAmount does not include Ethereum mainnet in its network mappings. Use Base for EVM payments via MCP (same wallet address, lower fees). REST API supports Ethereum normally.
  • MCP + Solana verification: Solana payment requirements can be issued, but verification may return invalid_payload when the active verification path lacks SVM support. Base verification is stable.
  • Solana + Circle Wallets: Circle Programmable Wallets' signMessage does not produce valid Solana x402 payments. Use signTransaction via @solana/web3.js or a Solana wallet adapter instead.

These limitations should narrow as facilitator capabilities and SDK network support expand.

Machine-Readable Discovery

Three auto-discovery endpoints for AI clients and tooling:

GET https://x402.911fund.io/.well-known/x402.json          # x402 payment discovery
GET https://x402.911fund.io/.well-known/mcp                 # MCP manifest (SEP-1960)
GET https://x402.911fund.io/.well-known/mcp/server-card.json # MCP server card (SEP-1649)

The MCP manifest lets AI clients auto-detect the MCP endpoint, transport, and payment requirements. The server card provides tool listings and server metadata per the MCP specification.

Stats & Health

GET https://x402.911fund.io/health
GET https://x402.911fund.io/stats

Links

Built by

911Fund Studio -- Building autonomous AI agent infrastructure.

License

MIT


2026-02-18 Runtime Contract Updates

These fields are now live in production and should be used by agent clients and marketplace indexers.

Discovery (/.well-known/x402.json)

Paid resources[] entries include:

  • resource (absolute endpoint URL)
  • tags (endpoint-level capability tags)
  • serviceTags (service-level tags)
  • inputSchema (JSON Schema for request params)
  • outputSchema (JSON Schema envelope with meta/error expectations)
  • examples (structured query examples)
  • accepts[] with payment metadata (scheme, network, asset, payTo, maxAmountRequired)

Stats (/stats)

/stats now includes:

  • paymentConversion:
    • paidExecutions
    • paid5xxFailures
    • paid5xxRatePctOfPaid
    • paid5xxPerChallengePct
  • latency:
    • overallProtected rolling quantiles (p50_ms, p95_ms, p99_ms, max_ms)
    • byEndpoint rolling quantiles per paid route

Error Envelope

REST errors now include:

  • top-level request_id
  • error.code
  • error.message
  • error.action (actionable remediation hint)
  • meta (trust/billing envelope)

Trust Guardrail

Missing required input now resolves to pre-charge clarification:

  • 422 + needs_clarification
  • meta.price_charged: false

About

Trading intelligence for AI agents. Pay-per-use via x402 micropayments on Base.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •