Order SMM services from a LangChain agent
A runnable tool-calling agent against a local OpenSMM node: search_services, get_quote, create_order — the same tools an MCP-equipped LangChain agent gets from @langchain/mcp-adapters. The example calls them directly over POST /mcp: no LLM key, no @langchain/* install, no money. Node.js ≥ 22.18 is enough.
1. Start the node (about 2 minutes)
git clone https://github.com/opensmm-protocol/mcp-server.git cd mcp-server npm ci npm run gateway
The node prints a line like gateway listening on http://localhost:8080 (REST /v0, MCP /mcp; provider: mock, mock catalog — not real supply) on stderr. Port taken? PORT=8081 npm run gateway. Other startup fixes: node startup failures.
2. Run the agent (a second terminal)
node examples/langchain/agent.mjs http://127.0.0.1:8080 --client-reference my-first-order
node: http://127.0.0.1:8080
transport: MCP tools over POST /mcp (LangChain-style tool calls)
tools: search_services, get_quote, create_order
tool: search_services({})
catalog: MOCK — every service is marked synthetic: not real supply, no real money
service: osmm_svc_tg_members_std — Telegram Channel Members — Standard
tool: get_quote({"serviceId":"osmm_svc_tg_members_std","quantity":100,"link":"https://t.me/opensmm_example"})
quote: osmm_quote_... — 0.241200 USDC for 100 (mock rate)
tool: create_order({"quoteId":"osmm_quote_...","link":"https://t.me/opensmm_example","clientReference":"my-first-order"})
order: osmm_order_... — REQUIRES_PAYMENT, clientReference "my-first-order"
tool: create_order({"quoteId":"osmm_quote_...","link":"https://t.me/opensmm_example","clientReference":"my-first-order"})
replay: osmm_order_... — same orderId, no second order created
done: LangChain-style agent OK
Options: [base-url] (default http://127.0.0.1:8080), --client-reference <ref>, --quote <quote-id> to reuse a quote printed by another run, --help.
3. The protocol invariant
- That is the whole scenario: catalog → quote → order → replay. The
order:andreplay:lines are the sameorderId: oneclientReferenceyields one order on any transport. - The order stays
REQUIRES_PAYMENT— the example never pays and nothing is executed. - A quote is consumed once: each order needs its own;
--quotereuses one issued earlier.
4. Use it with a real LangChain agent
Keep the three tool names and argument shapes printed by TOOLS in agent.mjs, expose them through LangChain's MCP adapter pointed at http://127.0.0.1:8080/mcp, and let the model emit the same calls.
search_services— find a service; on the mock node every service issynthetic;get_quote— requiresserviceId,quantity,link;create_order— requiresquoteId,link,clientReference.
REST equivalents of the same operations: GET /v0/services, POST /v0/quotes, POST /v0/orders — see examples/rest-client.mjs.
5. The mock-only guard
- The script reads the first service the node returns — it invents no service ID — and stops immediately if that service is not marked
synthetic: true. - The error message:
refusing to place a demo order: ... is not marked synthetic. This example orders only on the mock catalog — see examples/README.md. - That makes it safe against a node that has a live provider connected: the demo order cannot reach real supply.
Honest limits
- This page retells examples/langchain/README.md; the exact script output and options are there.
- The scenario for all stacks at once: docs/AGENT_QUICKSTART.md.
- The catalog is a mock (
synthetic: true): no real services, prices or orders here; the rate in the example is a test one, nothing is paid. - Other stacks: agent quickstart, ordering from Claude Desktop, ordering from Cursor.
Next: your own node
The example runs on a local node. To be counted in the census, run a node and report its address.
The step-by-step guide, verification and reporting your node are on the “Run a node” page.