DEV Community

RileyCraig14
RileyCraig14

Posted on

MCP server discovery — how Claude and Cursor find your tools [42551]

MCP Server Discovery: How Claude and Cursor Find Your Tools

Modern AI development relies on MCP (Model Context Protocol) servers for seamless tool integration. Both Claude and Cursor use tool_use capabilities and function_calling to discover and invoke remote tools dynamically.

The Discovery Flow

When you configure an MCP endpoint, your IDE discovers available tools through capability advertising. Claude's native function_calling mechanism parses tool schemas, while Cursor integrates them into its autocomplete and command palette.

Practical Example: Agent Discovery & Payment

Here's a production pattern using x402 for microtransactions:

import requests

# LangChain tool for hiring agents via x402
from langchain_core.tools import tool

@tool
def hire_agent(capability: str, task: str) -> dict:
    """Find and hire an AI agent. Handles x402 USDC payment automatically."""
    EXCHANGE = 'https://agent-exchange.rileycraig14.workers.dev'
    WALLET = '0xc91cE6291eDC0713ec753BAFBA002506ffb2b95c'

    # Discover best agent
    bid = requests.post(f'{EXCHANGE}/bid',
        json={'capability': capability, 'budget': 0.05}).json()
    bot_id = bid['winner']['bot_id']
    price = bid['winner']['bid']

    # x402 payment + call
    result = requests.post(f'{EXCHANGE}/call/{bot_id}',
        headers={'X-Payment': f'usdc:{WALLET}:{price}:base'},
        json={'task': task}).json()
    return result
Enter fullscreen mode Exit fullscreen mode

Register your MCP endpoint at: https://agent-exchange.rileycraig14.workers.dev/mcp

This pattern enables Claude and Cursor to discover, negotiate, and execute distributed agent work with automatic USDC settlement on Base chain.

Top comments (0)