Build with LangChain
LangChain talks to Polypad through the MCP adapter: one client, one URL, and all 21 Polypad tools become ordinary LangChain tools your agent can call. No signup, no API key, no approval — the same open tier as the rest of the API. This page is the whole guide: install, connect, run the 5-minute check.
1 · Install
You need Node 18 or newer, a LangChain app, and a model key (this example uses OpenAI).
npm install langchain @langchain/core @langchain/mcp-adapters @langchain/openai
2 · Connect and run
The adapter turns the remote MCP server into LangChain tools. The agent decides which tools to call; the prepare tools never move money — they return an unsigned transaction, a plain summary, and a signing link, and the user signs on polypad.family/sign. The signing page then checks the result and, when the agent passed a returnUrl, offers a link back to the agent's flow. How that loop works is on the sign loop page.
import { MultiServerMCPClient } from "@langchain/mcp-adapters";
import { ChatOpenAI } from "@langchain/openai";
import { createReactAgent } from "langchain/agents";
// No Polypad account, no API key: the MCP server is open.
const client = new MultiServerMCPClient({
polypad: {
transport: "streamable_http",
url: "https://polypad.family/api/mcp",
},
});
const tools = await client.getTools(); // all 21 polypad_* tools
console.log(tools.map((t) => t.name).join(", "));
const agent = createReactAgent({
llm: new ChatOpenAI({ model: "gpt-4o" }),
tools,
});
const out = await agent.invoke({
messages: [
{
role: "user",
content:
"List the newest tokens on Polypad, quote 0.01 ETH of POLYDASH, " +
"and prepare minting 1 share of the Polyfund for wallet " +
"0x1111111111111111111111111111111111111111. " +
"Show the signing link for the mint.",
},
],
});
console.log(out.messages.at(-1)?.content);3 · The 5-minute check
Run the script above and check three things. Each one proves a different part of the wiring, and all three together mean your agent is live on Polypad:
- The agent lists tokens. The tool list prints 21 names starting with polypad_, and the agent's answer names real tokens from polypad_list_tokens — a read, no signature, no cost.
- The agent quotes a trade. The answer for 0.01 ETH of POLYDASH shows an expected output and a minimum after slippage, from polypad_quote_trade. A quote is a reading, not a promise: the price can move before signing.
- The agent prepares a mint. The answer includes a signing link for minting 1 share of the Polyfund (0.01 ETH a share) from polypad_prepare_fund_mint. Open it: the page rebuilds the mint for your connected wallet and shows the same summary. Nothing moves until you sign — close the page and nothing happened.
The wallet address in the example (0x1111…1111) is a placeholder. In real use the agent does not pass an address on every call: connect once on polypad.family/sign?connect=1, store the token, and pass it as walletToken instead — the SDKs do this for you, and the sign loop page explains how the token works. The per-call address is still there as the fallback.
What to build next
The same wiring runs a token launch (polypad_prepare_token_launch) or a tokenized fund (polypad_prepare_fund_create) from a script — that is the path Forge uses to launch a token a day; see the case studies. Every tool, with inputs and copy-paste examples, is in the tool reference, and the limits are on the rules of the road page. Contracts are unaudited.