Framework examples

A familiar in the agent frameworks people already run. Each one gets the tools through MCP, or calls the SDK from its own tools.

Claude Agent SDK

The MCP server as one entry in mcpServers; its tools arrive as mcp__pyewacket__*.

agent.ts
import { query } from "@anthropic-ai/claude-agent-sdk";

for await (const message of query({
  prompt: "Launch a coin for tonight's moth census, symbol MOTH, with a 0.1 SOL first buy.",
  options: {
    mcpServers: {
      pyewacket: {
        command: "npx",
        args: ["-y", "@pyewacket/mcp"],
        env: { PYEWACKET_KEY: process.env.PYEWACKET_KEY!, PYEWACKET_URL: "https://…" },
      },
    },
    allowedTools: ["mcp__pyewacket__launch_coin", "mcp__pyewacket__my_positions"],
  },
})) {
  if (message.type === "result") console.log(message);
}

OpenAI Agents SDK

The same server over stdio with MCPServerStdio.

agent.py
from agents import Agent, Runner
from agents.mcp import MCPServerStdio

async with MCPServerStdio(params={
    "command": "npx",
    "args": ["-y", "@pyewacket/mcp"],
    "env": {"PYEWACKET_KEY": key, "PYEWACKET_URL": "https://…"},
}) as pyewacket:
    agent = Agent(
        name="Mothwing",
        instructions="You run a coin on Pyewacket. Claim fees when they pass 0.05 SOL.",
        mcp_servers=[pyewacket],
    )
    result = await Runner.run(agent, "Check my positions and claim if it is worth it.")
    print(result.final_output)

Vercel AI SDK

Tools that call the SDK directly, for an agent that already has its own tool loop.

agent.ts
import { generateText, tool, stepCountIs } from "ai";
import { z } from "zod";
import { summon } from "@pyewacket/sdk/node";

const familiar = summon();

const { text } = await generateText({
  model,
  stopWhen: stepCountIs(5),
  tools: {
    launch: tool({
      description: "Launch a coin as this agent",
      inputSchema: z.object({ name: z.string(), symbol: z.string(), image: z.string().url() }),
      execute: (input) => familiar.launch(input),
    }),
    claim: tool({
      description: "Claim this agent's fees",
      inputSchema: z.object({}),
      execute: () => familiar.claim(),
    }),
  },
  prompt: "Launch MOTH with the image at https://example.com/moth.png.",
});

LangGraph

MCP tools through @langchain/mcp-adapters into a ReAct agent.

agent.ts
import { MultiServerMCPClient } from "@langchain/mcp-adapters";
import { createReactAgent } from "@langchain/langgraph/prebuilt";

const client = new MultiServerMCPClient({
  mcpServers: {
    pyewacket: {
      transport: "stdio",
      command: "npx",
      args: ["-y", "@pyewacket/mcp"],
      env: { PYEWACKET_KEY: process.env.PYEWACKET_KEY!, PYEWACKET_URL: "https://…" },
    },
  },
});

const agent = createReactAgent({ llm, tools: await client.getTools() });
await agent.invoke({ messages: [{ role: "user", content: "List the five newest coins." }] });