Skip to main content
Glama

RMI MCP + x402 Gateway

Model Context Protocol (MCP) server and x402 payment gateway for Rug Munch Intelligence. Exposes typed RMI crypto-security tools to AI agents and settles per-call x402 payments — so agents can discover, pay for, and consume token-risk and wallet-intelligence tools without learning a bespoke API.

license MIT Python 3.12+ x402 v1+v2 MCP

Status: Beta / active development. Tool schemas and payment flow are stable; see Honest status for what is and isn't live.

What It Is

This repo is the MCP-facing edge of the Rug Munch Intelligence platform:

  • MCP server — typed tools over streamable HTTP / stdio, consumable from Claude Code, opencode, Cursor, or any MCP-capable agent.

  • x402 gateway — gates premium tool calls behind per-request crypto micropayments, delegating verification and settlement to a self-hosted facilitator (see below).

  • Verified badge domain — the badge logic for verified RMI listings.

It is not the scanning engine (that lives in rmi-backend) or the wallet generator (that lives in walletpress).

Related MCP server: coinopai-mcp

Tool Catalog

The gateway publishes a typed catalog (app/mcp/server.py). Core tools:

Tool

Purpose

get_token_risk

0–100 token risk score with category breakdown

get_wallet_analysis

Wallet forensics: holdings, counterparties, labels

get_deployer_reputation

Deployer history and reputation signals

get_news_sentiment

News and social sentiment for an asset

generate_report

Structured investigation report

query_catalog

Search the tool/asset catalog

find_similar_tokens

Similarity lookup across indexed tokens

The stdio surface (mcp_stdio.py) exposes the catalog over fastmcp run mcp_stdio.py:mcp.

x402 Payment Rail

The gateway does not verify payments in-house. It delegates verification and settlement to a self-hosted x402-coffer facilitator over HTTP. Coffer is the source of truth for whether a payment is real; the gateway's X-Payment-ID gate fails closed when coffer cannot be reached.

Setting

Default

Meaning

X402_FACILITATOR_URL

http://localhost:8670

Base URL of the coffer deployment

Endpoints the gateway calls on coffer:

Gateway call

Coffer endpoint

Purpose

payment re-check

POST {X402_FACILITATOR_URL}/v1/x402/verify

Confirm an X-Payment-ID is verified (caller-bound, TTL'd)

settlement

POST {X402_FACILITATOR_URL}/v1/x402/settle

Settle a verified payment

Fail-closed contract: a payment-gated call is allowed through only when coffer answers verified: true. If coffer is unreachable, times out, or returns 5xx after bounded retries, the gateway answers 402 Payment Required — it never falls back to allowing the call through unverified. The gateway's local payment store is caller/tx memory only; it cannot self-verify.

Architecture

Agent (MCP client)
   │  tools/list, tools/call
   ▼
rmi-mcp-x402 gateway ──── app/mcp/         MCP server, tool catalog, tool manager
   │                 ├── app/domain/x402/  payment middleware, models, service
   │                 ├── app/domain/verified/  badge domain
   │                 └── app/api/v1/       HTTP API routes
   │  verify / settle (HTTP)
   ▼
x402-coffer (self-hosted facilitator)
   │
   ▼
RMI backend (security data) · Qdrant · Redis · Postgres

Quickstart

# Install (editable)
make install

# Run the MCP server (streamable HTTP, :8001)
make dev

# Run the x402 facilitator locally (:8001)
make run

# Full stack: coffer + redis via Docker Compose
make up

Run make help for all targets. Quality gates: make lint, make typecheck, make test, make security, and make ci (ruff + mypy + pytest).

Configuration

Wallets resolve from the environment only — there are no hardcoded wallet defaults. Unset resolves to "" and the deployment fails closed: load_settings() raises at boot and the app refuses to serve an unconfigured 402.

Env var

Chain

Purpose

X402_WALLET

EVM — default payee for all eip155:*

Receiving address

X402_WALLET_SOLANA

Solana (solana:mainnet)

Receiving address

X402_WALLET_TRON

TRON (tron:mainnet)

Receiving address

X402_FACILITATOR_URL

—

Coffer facilitator base URL

REDIS_URL

—

Payment nonce / replay store

Per-network EVM overrides: X402_WALLET_BASE / _ETH / _ARBITRUM / _OPTIMISM / _POLYGON (fall back to X402_WALLET). Old names are honored as read-time aliases only.

Honest Status

We do not overclaim. Scaffolded paths are never reported as verified:

  • TRON is structural work only — shape, price, and asset are validated, and health reports tron=scaffolded:needs_facilitator until a real facilitator implementation is registered.

  • Verifying is not settling. Self-verify paths read on-chain receipts only and fail closed with needs_facilitator rather than fabricating a settlement.

  • A bare HTTP-200 is not proof of payment — an explicit verification or settlement signal is required before reporting success.

Documentation

Repo

Purpose

x402-coffer

Self-hosted x402 payment facilitator

rmi-backend

Intelligence engine and data APIs

rmi-frontend

Web dashboard

walletpress

Wallet management

License

MIT — see LICENSE. Built by Rug Munch Media LLC.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    C
    maintenance
    MCP server that exposes T54 x402 seller SKUs from OpenAPI as tools: contract triage, audit, and monitoring plus T54 commerce tools. HTTP 402 invoices are paid via x402_broker_client (XRPL / Base USDC depending on env); stdio for Cursor/Claude, Streamable HTTP for hosted use.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP server that provides AI agents with pay-per-call access to a suite of tools (honeypot check, token market, DeFi yields, etc.) via USDC on Base using the x402 protocol.
    9 npm
    MIT