MCP
Add a remote MCP server with this URL:
https://agent.uswap.net/mcp
The transport is Streamable HTTP. The server lists the same operations as the HTTP API and exposes its starting guide at uswap://guide.
Session setup
Call capabilities, then session. Store the returned token in your client's secret store. Use either:
- An
Authorization: Bearer <token>header configured on the MCP connection. - The
session_tokenargument on private tool calls if the client cannot set headers.
Keep using the same token after reconnecting. The session token works across MCP connections. Creating a new session won't recover old orders.
Example with the TypeScript MCP SDK
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
const client = new Client({ name: "my-agent", version: "1.0.0" });
const transport = new StreamableHTTPClientTransport(
new URL("https://agent.uswap.net/mcp"),
{ requestInit: { headers: { Authorization: `Bearer ${process.env.USWAP_TOKEN}` } } },
);
await client.connect(transport);
const result = await client.callTool({ name: "capabilities", arguments: {} });
console.log(result.structuredContent);
await client.close();
Create and save the token through session before running this example. Read tool results from structuredContent or the text JSON copy. Check isError and mutation state before proceeding.
Give the agent a bounded task
Provide the desired output, recipient, spending limit and wallet permission. Tell it to discover current capabilities and follow next_actions. Ask it to pause when a browser action, missing user input or an uncertain payment requires attention.
MCP makes the operations available. It does not give an agent permission to spend beyond the user's instructions.