Skip to main content
Glama
rplryan

x402-discovery-mcp

x402_register

Register a new x402 service in the discovery index, providing service details, endpoint, price, and capabilities, to make it discoverable by agents.

Instructions

Register a new x402 service with the discovery index. Free. Your service will appear in the catalog and be discoverable by agents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
endpoint_urlYes
descriptionYes
price_per_callYes
capability_tagsYes
wallet_addressYes
networkNobase

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The x402_register function is the core handler for registering a new x402 service. It accepts name, endpoint_url, description, price_per_call, capability_tags, wallet_address, and network, then POSTs to the discovery API's /register endpoint and returns a confirmation with service ID.
    def x402_register(
        name: str,
        endpoint_url: str,
        description: str,
        price_per_call: float,
        capability_tags: str,
        wallet_address: str,
        network: str = "base",
    ) -> str:
        """Register an x402 service with the discovery index.
    
        Args:
            name: Service name (e.g. 'My Weather API').
            endpoint_url: Your x402-gated endpoint URL.
            description: One sentence: what input it takes, what it returns.
            price_per_call: Price in USD per call (e.g. 0.005).
            capability_tags: Comma-separated tags: research, data, compute, monitoring, etc.
            wallet_address: Your Base wallet address that receives USDC payments.
            network: Payment network (default: 'base').
    
        Returns:
            Registration confirmation with your service ID.
        """
        tags = [t.strip() for t in capability_tags.split(",") if t.strip()]
        payload = {
            "name": name,
            "endpoint_url": endpoint_url,
            "description": description,
            "price_per_call": price_per_call,
            "capability_tags": tags,
            "provider_wallet": wallet_address,
            "network": network,
            "payment_token": "USDC",
            "pricing_model": "flat",
            "agent_callable": True,
            "auth_required": False,
        }
    
        try:
            with httpx.Client(timeout=15.0) as client:
                resp = client.post(f"{DISCOVERY_API}/register", json=payload)
                resp.raise_for_status()
                data = resp.json()
        except Exception as e:
            return f"Registration error: {e}\nTry manually: POST {DISCOVERY_API}/register"
    
        service_id = data.get("service_id", "?")
        return (
            f"✅ Service registered successfully!\n"
            f"Service ID: {service_id}\n"
            f"Name: {name}\n"
            f"Endpoint: {endpoint_url}\n"
            f"Price: ${price_per_call}/call\n"
            f"Tags: {', '.join(tags)}\n\n"
            f"Your service is now discoverable at:\n"
            f"{DISCOVERY_API}/health/{service_id}\n\n"
            f"Full catalog: {DISCOVERY_API}/catalog"
        )
  • The input parameters (name, endpoint_url, description, price_per_call, capability_tags, wallet_address, network) define the expected schema/type definitions for the tool. The handler also constructs a payload with fixed fields (payment_token='USDC', pricing_model='flat', agent_callable=True, auth_required=False).
    def x402_register(
        name: str,
        endpoint_url: str,
        description: str,
        price_per_call: float,
        capability_tags: str,
        wallet_address: str,
        network: str = "base",
    ) -> str:
  • server.py:263-274 (registration)
    The @mcp.tool decorator registers x402_register as an MCP tool with FastMCP. It sets the description and annotations (readOnlyHint=False, destructiveHint=False, idempotentHint=False, openWorldHint=True).
    @mcp.tool(
        description=(
            "Register a new x402 service with the discovery index. "
            "Free. Your service will appear in the catalog and be discoverable by agents."
        ),
        annotations=ToolAnnotations(
            readOnlyHint=False,
            destructiveHint=False,
            idempotentHint=False,
            openWorldHint=True,
        ),
    )
  • The DISCOVERY_API constant (https://x402-discovery-api.onrender.com) is used as the base URL for the registration POST request in the handler.
    DISCOVERY_API = "https://x402-discovery-api.onrender.com"
    WALLET_ADDRESS = os.getenv("WALLET_ADDRESS", "0xDBBe14C418466Bf5BF0ED7638B4E6849B852aFfA")
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate readOnlyHint=false and openWorldHint=true, which align with the 'Register' action. The description adds useful behavioral context: the service will appear in the catalog and be discoverable, and it is free. No contradictions. It does not detail side effects beyond creation, but the disclosure is adequate for the tool's simplicity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences, front-loaded with the action verb 'Register'. No redundant or filler content; every sentence adds distinct value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

While the outcome (service appears in catalog) is mentioned, the description omits details about the response (though an output schema exists), required prerequisites, or parameter constraints. Given 7 parameters and a creation operation, the description is minimally complete but leaves gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description provides no information about any of the 7 parameters (name, endpoint_url, etc.). The description entirely fails to add meaning beyond the schema, leaving the agent to infer from parameter names alone.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Register a new x402 service with the discovery index,' specifying the exact verb and resource. It also distinguishes itself from sibling tools like x402_browse or x402_discover by focusing on registration.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides context on when to use the tool ('Register a new x402 service') and states that it is free, implying cost is not a concern. However, it does not explicitly mention when not to use it or suggest alternatives, lacking exclusionary guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rplryan/x402-discovery-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server