Use 402.report with LangChain.js
Connect LangChain.js / LangGraph agents to 402.report's MCP tools and route their HTTP through the proxy — with one API key.
LangChain.js consumes MCP servers through
@langchain/mcp-adapters. 402.report exposes your x402 spend + forensics as read-only MCP tools
your agents can call.
1. Install
npm install @402report/sdk @langchain/mcp-adapters
Set your key as REPORT402_API_KEY (create one in the dashboard).
2. Load the spend tools
import { MultiServerMCPClient } from "@langchain/mcp-adapters";
import { mcpHttpConfig } from "@402report/sdk";
const { url, headers } = mcpHttpConfig({ apiKey: process.env.REPORT402_API_KEY! });
const client = new MultiServerMCPClient({
mcpServers: {
report402: { transport: "http", url, headers },
},
});
const tools = await client.getTools();
// Pass `tools` to a LangGraph/LangChain agent (e.g. createReactAgent({ llm, tools })).
3. Observe the payments your agent makes
Route outbound HTTP through the proxy so x402 activity is recorded. Anywhere your tools call a
paid API with fetch, use the proxy fetch:
import { createProxyFetch } from "@402report/sdk";
const fetch402 = createProxyFetch({ apiKey: process.env.REPORT402_API_KEY! });
const res = await fetch402("https://api.example.com/premium");
402.report is non-custodial — it observes x402 activity, it never holds or settles funds.