aipages-mcp-gateway
Officialby 2xcel-dev
README.md
<p align="center">
<img src="assets/aipages-banner.svg" alt="AIPages.tech ā The AI Agent Directory" width="750" />
</p>
<p align="center">
<a href="https://aipages.tech"><img src="https://img.shields.io/badge/Production-aipages.tech-FFD000?style=for-the-badge" alt="Live Production"></a>
<a href="https://registry.modelcontextprotocol.io/v0/servers?search=io.github.2xcel-dev/aipages-mcp-gateway"><img src="https://img.shields.io/badge/MCP_Registry-Official-brightgreen?style=for-the-badge" alt="Official MCP Registry"></a>
<a href="https://ontarioprotocol.com/listings/lst_b26feab0a87a"><img src="https://img.shields.io/badge/Ontario_Protocol-Verified-orange?style=for-the-badge" alt="Ontario Protocol Verified"></a>
<a href="https://github.com/punkpeye/awesome-mcp-servers/pull/19156"><img src="https://img.shields.io/badge/MCP-Awesome--MCP--Servers-blue?style=for-the-badge" alt="Awesome MCP Servers"></a>
<a href="https://base.org"><img src="https://img.shields.io/badge/Settlement-Base_L2_(USDC)-0052FF?style=for-the-badge" alt="Base L2"></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-slate?style=for-the-badge" alt="MIT License"></a>
</p>
<p align="center">
<strong>Machine-native discovery registry and 3072-dim vector search index for autonomous AI agent tools and Model Context Protocol (MCP) servers.</strong>
</p>
---
## š Model Context Protocol (MCP) Server Implementation
AIPages ships a native MCP Server package: **`@aipages/mcp`** (published as `io.github.2xcel-dev/aipages-mcp-gateway` on the Official MCP Registry). It runs locally over standard **stdio transport** and dynamically exposes on-demand vector discovery and execution tools to Claude Desktop, Cursor, Windsurf, Cline, and any MCP client.
### Instant Agent Setup (stdio transport)
Run directly with zero local installation:
```bash
npx -y @aipages/mcp@1.1.1
```
#### Claude Desktop Configuration (`claude_desktop_config.json`)
```json
{
"mcpServers": {
"aipages": {
"command": "npx",
"args": ["-y", "@aipages/mcp@1.1.1"]
}
}
}
```
#### Cursor Configuration (`.cursor/mcp.json`)
```json
{
"mcpServers": {
"aipages": {
"command": "npx",
"args": ["-y", "@aipages/mcp@1.1.1"]
}
}
}
```
### Exposed MCP Tools & Protocol Schema
The server implements the Model Context Protocol JSON-RPC specification over `stdio` and registers the following native MCP tools:
1. **`aipages_search`**
- **Description**: Query the 3072-dimensional Gemini vector index by natural-language intent to retrieve matching tool schemas and capability descriptors.
- **Inputs**: `query` (string, required), `limit` (number, optional).
2. **`aipages_execute`**
- **Description**: Securely invoke any indexed MCP micro-utility or AUS tool. Supports zero-friction sandbox mode or Base Mainnet x402 USDC micropayment settlement.
- **Inputs**: `namespace` (string, required), `payload` (object, required), `testMode` (boolean, optional).
3. **`aipages_list`**
- **Description**: Enumerate verified first-party tools, pricing tiers, and active health status.
- **Inputs**: `category` (string, optional).
- **Implementation Source**: Located in [`packages/mcp-gateway/bin/mcp-gateway.js`](packages/mcp-gateway/bin/mcp-gateway.js)
- **Official Specification**: Model Context Protocol Schema `2025-12-11` ([`server.json`](server.json))
---
## 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
```bash
# 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
```text
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 |
This server cannot be deployed
Maintenance
ActivityNo data
ResponsivenessNo recent community issues