How an AI Agent Pays $0.01 for Live SEC Data — Without an API Key
AI agents need real-world data to be useful. The problem: most data providers require API keys, monthly billing accounts, and rate-limit agreements negotiated by a human. That model breaks down when agents are autonomous — no human to sign up, no process to rotate keys, no budget owner to approve a subscription. There's a better pattern.
What x402 Is
x402 is an HTTP-native micropayment protocol built on Base mainnet. Instead of an API key in a header, a client sends a signed USDC authorization using EIP-3009 transferWithAuthorization. The server verifies the signature on-chain, releases the data, and the payment settles — all within a single HTTP round-trip.
The key detail: the agent's own wallet pays, not a developer's credit card. The agent holds a small USDC balance, signs a one-time authorization scoped to that exact call, and the data arrives. No API key. No subscription. No human involved.
This is what "pay-per-call" actually means at the protocol level.
The Toolstem SEC EDGAR MCP Server
Toolstem runs an MCP server at https://mcp.toolstem.com/mcp/sec that exposes five SEC EDGAR tools over x402. Pricing is tiered by data richness:
| Tool | What it returns | Price per call |
|---|---|---|
get_company_filings_summary |
Filing counts, types, recency for a ticker | $0.005 |
get_insider_signal |
Insider buy/sell activity with net direction | $0.05 |
get_institutional_signal |
13F institutional ownership changes | $0.05 |
get_material_events_digest |
8-K material event summaries, last 90 days | $0.50 |
compare_disclosure_signals |
Side-by-side disclosure comparison across tickers | $0.50 |
The server speaks standard MCP protocol — any MCP-compatible client connects without modification. Payment is handled transparently by the client library; the agent sees a normal tool call.
The server is also listed in the Coinbase x402 Bazaar under payTo wallet 0xB009DA692cF3EFF7567bF727b8B2F3b5BFc3383E, which matters for autonomous discovery (more on that below).
Code Walkthrough
Install the package:
# TypeScript / Node
npm install langchain-toolstem
# Python
pip install langchain-toolstem
Here's a complete working agent in TypeScript that calls get_insider_signal for NVDA. The agent pays automatically — no API key anywhere in the code.
import { ChatOpenAI } from "@langchain/openai";
import { AgentExecutor, createOpenAIToolsAgent } from "langchain/agents";
import { ChatPromptTemplate } from "@langchain/core/prompts";
import { createSecTools } from "langchain-toolstem";
async function main() {
// Your agent's wallet — holds a small USDC balance on Base mainnet
const walletPrivateKey = process.env.AGENT_WALLET_PRIVATE_KEY!;
// Initialize the SEC EDGAR tools
// Payment is handled by the x402 client internally — no API key needed
const tools = await createSecTools({
privateKey: walletPrivateKey,
mcpEndpoint: "https://mcp.toolstem.com/mcp/sec",
});
const llm = new ChatOpenAI({ model: "gpt-4o", temperature: 0 });
const prompt = ChatPromptTemplate.fromMessages([
["system", "You are a financial research agent. Use the available tools to answer questions about SEC filings."],
["human", "{input}"],
["placeholder", "{agent_scratchpad}"],
]);
const agent = await createOpenAIToolsAgent({ llm, tools, prompt });
const executor = new AgentExecutor({ agent, tools });
const result = await executor.invoke({
input: "What is the insider trading signal for NVDA over the last 30 days?",
});
console.log(result.output);
// Payment: ~$0.05 USDC deducted from agent wallet, settled on Base mainnet
}
main();
What happens under the hood when get_insider_signal is called:
-
langchain-toolstemconstructs an HTTP request to the MCP server - The x402 client signs a
transferWithAuthorizationusing EIP-3009 — a one-time USDC transfer authorization scoped to$0.05 - The authorization is attached to the request header
- The server verifies the signature, fetches the SEC data, and returns the result
- The $0.05 settles on Base mainnet
The Python equivalent uses createsectools from the same package (v0.1.0 on PyPI). The pattern is identical — wallet key in, tools out, payment automatic.
How Agent Discovery Works
The x402 Bazaar is a registry where x402-compatible servers list their endpoints, pricing, and payTo addresses. An autonomous agent can query the Bazaar to discover available data providers without any human configuration — the same way a browser discovers a webpage.
For Toolstem specifically: an agent searching the Bazaar for SEC or financial disclosure tools will find the Toolstem entry, read the tool manifest, fund its wallet with a few dollars of USDC, and start making paid calls — end-to-end autonomous, no developer intervention.
This closes the loop. The agent's wallet is its identity and payment method. The Bazaar is its service registry. No API keys, no SaaS accounts, no human standing in the middle.
Where to Go Next
Try the tools interactively at the Toolstem playground before writing any code. The npm package (langchain-toolstem@0.1.4) is on npm; the Python package (langchain-toolstem@0.1.0) is on PyPI. Both connect to the same MCP endpoints at https://mcp.toolstem.com/mcp/finance and https://mcp.toolstem.com/mcp/sec.
Top comments (0)