Connect AI agents to APIs with MCP
Connect an MCP client, discover API listings and inspect operation contracts before your agent makes its first call.
An agent needs more than an API URL. It needs to know what the API does, which parameters it accepts and what a call costs. AirnodeHub exposes its catalogue through MCP, so your agent can discover those facts as tools instead of relying on an integration written for each provider.
This guide gets you from an unconnected client to a readable API catalogue. Discovery does not execute a provider operation or make a payment.
1. Connect an MCP client
Add https://airnodehub.api3.org/mcp as a remote server using Streamable HTTP. The Hub's MCP endpoint needs no account
or API key. Clients differ in how they store the connection. Some accept this configuration, while others ask for the
URL and transport in their settings.
{
"mcpServers": {
"airnodehub": {
"type": "http",
"url": "https://airnodehub.api3.org/mcp"
}
}
}
Ask your connected agent: "List the APIs available through AirnodeHub and their operation names. Do not call any
provider operations yet." A catalogue returned by list-listings confirms the connection.
2. Try discovery directly
You can check the same tool from a terminal. This server accepts a standalone tools/call request, so
this example does not need an initialization handshake or a session header.
curl --request POST https://airnodehub.api3.org/mcp \
--header 'Content-Type: application/json' \
--header 'Accept: application/json, text/event-stream' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "list-listings",
"arguments": {}
}
}'
The JSON-RPC result includes readable text in content and a catalogue in structuredContent.listings. If the
response uses server-sent events, read the JSON from its data: line. Each listing names its operations. A tool
failure sets isError, so a successful HTTP status alone does not confirm that a tool succeeded.
3. Read the contract before making a call
Start with list-listings when you are exploring what is available. Use search-listings
with a few concrete subject terms when you already know what you need. A search with no matches does not prove the
capability is absent, so inspect the full catalogue before giving up.
- Choose a listing and use
get-listing-detailsto inspect its operations. - Use
get-operation-detailsfor the operation's parameters and price. Have your agent check that the result can answer your question. - Set the allowed spend and request parameters before permitting
call-operation. Discovery is free, and the operation's current contract determines whether an API call is priced. - Verify the returned attestation and decide whether the response is fresh enough for your task.
Keep the evidence with the answer
Preserve the original response and the request it answers. If an agent turns API data into a report, keeping the attestation lets a later consumer check the source response instead of trusting the agent's summary alone. Read what an AirnodeHub signature proves, and what it doesn't before using a verified signature as a reason to trust a result.
Next, explore the live catalogue or follow the MCP reference for tool arguments, payment behavior and verification examples.