AIPages MCP Gateway

v1.1.1
io.github.2xcel-dev/aipages-mcp-gateway Checked 1 day ago Published 2 days ago

Vector tool discovery and Base Mainnet x402 execution gateway for autonomous AI agents.

Machine-native discovery registry and 3072-dim vector search index for autonomous AI agent tools and Model Context Protocol (MCP) servers. 1. Who is it for? - Software & Autonomous AI Agents: Automated coding agents, LLMs, and multi-agent workflows that need to find external tools programmatically without human intervention. - Tool Developers: Creators and developers who build APIs, MCP servers, or micro-utilities and want their tools discovered by autonomous agents. 2.

Summary extracted from the README.


What it does

  1. Who is it for?
    • Software & Autonomous AI Agents: Automated coding agents, LLMs, and multi-agent workflows that need to find external tools programmatically without human intervention.
    • Tool Developers: Creators and developers who build APIs, MCP servers, or micro-utilities and want their tools discovered by autonomous agents.
  2. What is it? A Machine-Native Discovery Registry & Vector Search Index acting as an intelligent app store and lookup directory specifically engineered for AI agents to find, authenticate, and connect to verified software tool schemas dynamically.
  3. When does it execute?
    • On Demand (Real-Time Search): Whenever an autonomous agent encounters a task and needs a specific capability (e.g., parsing Markdown, auditing a smart contract, or running code), it queries AIPages instantly.
    • During Automated Scraping & Indexing: Background cron crawlers continuously scan public repositories like GitHub to discover and index new tools as they are published.
  4. Where does it operate? On the Web & Base Network: Hosted as a high-speed search index (aipages.tech) connected to backend nodes (aus.2xcel.net), utilizing MongoDB Atlas for vector storage and the Base network for stablecoin micropayments.
  5. Why does it exist?
    • To Solve Agent Discovery Friction: Traditional keyword searches fail for AI agents because agents think in semantic concepts, not exact search terms.
    • To Guarantee Schema Trust: By rejecting guessed or LLM-inferred schemas and requiring genuine, authoritative manifests (mcp.json or OpenAPI), it ensures agents never crash due to bad tool definitions.
    • To Keep Discovery Free: Discovery, browsing, and listing submissions are 100% free with no rate tolls, shifting monetization entirely to successful execution.
  6. How does it work?
    • Semantic Vector Search: Converts search queries and tool descriptions into 3072-dimensional mathematical vectors using Gemini (gemini-embedding-001) and matches them via MongoDB Atlas Vector Search.
    • Authoritative Ingestion: The crawler fetches tools only if they ship with a parseable mcp.json or Swagger/OpenAPI manifest, stripping out guesswork.
    • Execution-Only Monetization: Finding and searching is free; monetization happens strictly at the execution gateway via x402 stablecoin micro-fees on Base when an agent successfully invokes a premium tool.

πŸ› οΈ First-Party AUS Fleet & x402 Micropayments

The following core micro-utilities are natively hosted on the AUS node (aus.2xcel.net) and indexed within the AIPages directory. Each tool is gated by the x402 micropayment protocol utilizing USDC on the Base Mainnet:

Tool ID Namespace Price (USDC) Capabilities & Description
aus.schema.sanitizer net.2xcel.aus.schema-sanitizer Free ($0.00) sanitization, security, lead-magnet β€” Strips HTML/XSS and normalizes payload keys.
aus.parse.markdown net.2xcel.aus.parse-markdown Free ($0.00) web-scraping, markdown-extraction β€” Cleans and structures web pages into LLM-ready markdown.
aus.gas.optimizer net.2xcel.aus.gas-optimizer Free ($0.00) gas-routing, congestion-analysis β€” Predicts L2 base and priority fee envelopes.
aus.markdown.distill net.2xcel.aus.markdown-distill Free ($0.00) markdown-cleaning, token-budget β€” Strips navigational noise and retains core technical text.
aus.verification.oracle net.2xcel.aus.verification-oracle $0.05 cryptographic-attestation, hash-verification β€” Generates cryptographic hashes and proof attestation.
aus.geospatial.verifier net.2xcel.aus.geospatial-verifier $0.08 haversine, geofence, spatial-validation β€” Computes distances and verifies boundary constraints.
aus.claude.reason net.2xcel.aus.claude-reason $0.12 deep-reasoning, inference, analysis β€” Executes deep reasoning and analytical tasks.
aus.browser.stealth net.2xcel.aus.browser-stealth $0.15 web-scraping, stealth-browser, anti-bot β€” Anti-bot cloud extraction for autonomous AI agents.
aus.media.transcoder net.2xcel.aus.media-transcoder $0.15 mime-inspection, transcoding, payload-hashing β€” Inspects MIME types and normalizes media payloads.
aus.financial.audit net.2xcel.aus.financial-audit $0.20 financial-ledger, audit, anomaly-detection β€” Reconciles batch ledgers and performs risk-indexing.
aus.token.rugcheck net.2xcel.aus.rugcheck $0.25 smart-contract, security-audit, base-network β€” Audits EVM smart contract bytecode for risk indicators on Base.
aus.agentic.audit net.2xcel.aus.agentic-audit $0.25 action-loop-detection, budget-limit β€” Evaluates step loops and budget thresholds.
aus.code.sandbox_runner net.2xcel.aus.sandbox-runner $0.25 code-execution, python-runtime, secure-sandbox β€” Executes code inside a secure micro-VM runtime.
aus.sandbox.execution net.2xcel.aus.sandbox-execution $0.25 container-sandbox, micro-vm, zero-trust β€” Sandboxed isolated container execution for agents.

Quick Start

# 1. Install dependencies
npm install

# 2. Configure environment
cp .env.example .env
# Edit .env β€” set MONGODB_URI, GEMINI_API_KEY, and X402 wallet credentials.

# 3. Seed sample tools (dev)
npm run seed

```bash
npm run dev         # hot reload via tsx
# or: npm run build && npm start  # compiled

API & Protocol Architecture

  • GET / β€” Health & service status, pricing manifest, and endpoint map.
  • GET /health β€” Database and vector store connectivity.
  • GET /search?q=<query>&limit=<n> β€” Free semantic search matching natural-language intent.
  • POST /api/invoke/:namespace β€” Core execution gateway and x402 payment gate.

x402 Payment Flow

  1. Autonomous agent calls POST /api/invoke/:namespace with an X-Agent-ID header.
  2. For metered tools without payment proof, the server returns HTTP 402 with an x402 payment challenge specifying the exact USDC amount and recipient wallet on Base (eip155:8453).
  3. The agent signs and attaches the authorization (PAYMENT-SIGNATURE or x-payment-receipt) and retries the request.
  4. AIPages verifies the settlement and routes execution, returning output to the agent.

Repository Structure

src/
β”œβ”€β”€ index.ts        # Hono app β€” routes, server bootstrap
β”œβ”€β”€ config.ts       # Environment config (typed, validated)
β”œβ”€β”€ types.ts        # Tool / SearchResult interfaces
β”œβ”€β”€ embedding.ts    # Gemini gemini-embedding-001 (3072-dim)
β”œβ”€β”€ db.ts           # MongoDB Atlas Vector Search store
β”œβ”€β”€ invocation.ts   # /api/invoke proxy: verify + x402 payment gate + schema + sanitize
β”œβ”€β”€ verification.ts # caller identity: EIP-712 (Base wallet) / Ed25519 / HMAC signatures
β”œβ”€β”€ sanitizer.ts    # prompt-injection / code-execution payload scanning
β”œβ”€β”€ egress-guard.ts # SSRF protection, host allowlist, size caps
β”œβ”€β”€ crawler.ts      # background cron crawler (discover β†’ fetch manifest β†’ parse/probe)
└── scraper.ts      # GitHub code search & registry indexing
scripts/
β”œβ”€β”€ sync-notion-dashboard.ts   # Synchronizes Notion Operations Hub
β”œβ”€β”€ sync-ecosystem-catalogs.ts # Syncs x402 directories and registries
└── execute-ontario-listing.ts # Executes live x402 listing on Ontario Protocol

Tech Stack

Component Technology
Runtime Node.js 20+ / TypeScript
API Framework Hono (@hono/node-server)
Database MongoDB Atlas + Atlas Vector Search
Embeddings Google Gemini gemini-embedding-001 (3072-dim)
Payment Gateway x402 (@x402/fetch, @x402/evm, @x402/core) via USDC on Base Mainnet
Hosting Railway (aipages.tech)
License MIT