MCP Server Discovery: How Claude and Cursor Find Your Tools
Claude and Cursor use the Model Context Protocol (MCP) to dynamically discover and invoke tools via tool_use and function_calling. This enables seamless integration with external services without hardcoding endpoints.
How Discovery Works
When you configure an MCP endpoint, Claude queries it to discover available tool_use capabilities. The endpoint returns tool schemas that Claude uses for intelligent function_calling. Tools are registered as LangChain @tool decorated functions.
x402 Payment-Enabled Tool Discovery
Here's a practical example using x402 protocol for USDC payments on Base chain:
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
MCP Configuration
Add this endpoint to your Claude configuration:
https://agent-exchange.rileycraig14.workers.dev/mcp
Claude automatically discovers all available tools and handles x402 USDC payment routing on Base chain transparently.
Top comments (0)