Tutorial 06

AI agent (any host).

The classic — an MCP-powered agent with the full 32-tool Sera surface. Three paths depending on how custom you want to go: bundled Sera Agent (one command), Claude Code/Cursor/ChatGPT (just register the MCP), or your own host using OpenAI Agents SDK.

15 min MCP-native Claude · GPT · others
What you'll have at the end

An interactive agent that can answer questions like "how much USDC to deliver exactly 5,000 MYR?", scan for FX deals, generate quotes, and (with policy gates) execute swaps. Pick the path that matches your existing workflow.

Path A — Bundled Sera Agent (fastest)

Best if you just want a working agent now and don't care which host it runs in. Comes pre-wired with MCP + LLM.

git clone https://github.com/Josh-sera/sera-agents
cd sera-agents/sera-agent && npm install
export OPENAI_API_KEY=sk-...
npm start

# Try:
> What stablecoins do you support for SGD?
> How much USDC to deliver exactly 5,000 MYR?
> Run sera.doctor

Path B — Claude Code (or Cursor, ChatGPT, etc.)

Best if you already use a modern MCP host. Three lines of config, the host loads the MCP at startup, the agent gets all 32 tools natively.

1Get sera-mcp on your machine

git clone https://github.com/Josh-sera/sera-mcp
cd sera-mcp && npm install && npm run build

2Register with the host

For Claude Code:

claude mcp add sera --scope user \
  --env SERA_NETWORK=mainnet \
  --env POLICY_PRESET=standard \
  -- node $(pwd)/dist/index.js

For Cursor: Settings → MCP → Add a server with the same command. For ChatGPT: Settings → Connectors → MCP. See integrations/ for per-host snippets.

3Verify

In any agent session, type:

Call sera.doctor

You should get back overall_ok: true with green checks for sera_health, network_sanity, tokens_registry, signer_mode, policy.

Path C — Your own host (OpenAI Agents SDK)

Best if you're building a custom agent product and need programmatic control over the loop.

my-agent.ts
import { Agent, MCPServerStdio } from '@openai/agents';

const sera = new MCPServerStdio({
  command: 'node',
  args: ['/abs/path/to/sera-mcp/dist/index.js'],
  env: { SERA_NETWORK: 'mainnet', POLICY_PRESET: 'standard' }
});

const agent = new Agent({
  name: 'fx-helper',
  instructions: 'You help with multi-currency FX settlement. Use sera.doctor first if anything looks off. Always show cost in basis points and absolute dollars.',
  mcpServers: [sera]
});

const response = await agent.run('Find me FX deals over 25 bps right now.');
console.log(response);

Add policy gates (any path)

For any agent that will execute swaps, set the policy preset and caps via env vars. sera-mcp reads these and refuses to exceed them — even if the LLM tries.

SERA_NETWORK=mainnet
POLICY_PRESET=standard           # or 'strict' or 'dry-run-only'
SERA_DAILY_VOLUME_CAP_USD=10000  # server-derived, not LLM-claimed
SERA_DRY_RUN=false               # true = every execute returns dry-run trace
SERA_HISTORY_DB=$HOME/.sera/history.db

Useful slash commands

The MCP exposes 4 pre-templated prompts that hosts surface as commands:

Common gotchas

Done with the tutorials. Next: browse the full API reference, copy a recipe, or read about how the layers compose.