Client Usage
Shows how to connect to a Delta-MCP server programmatically using DeltaClient.
What it demonstrates
- Connecting — spawn a server as a child process via
StdioClientTransport - Progressive disclosure —
listTools()returns names + short descriptions only (~115 tokens for 6 tools) - On-demand schema fetch —
describeTool(name)fetches the full JSON schema and caches it - Calling tools —
callTool(name, args)handles schema fetch + call in one step
Run
npx tsx examples/client-usage/index.tsKey API
import { DeltaClient, StdioClientTransport } from "@delta-mcp/client";
const transport = new StdioClientTransport("node", ["./server.js"]);const client = new DeltaClient(transport);
await client.initialize({ name: "my-client", version: "1.0.0" });
const tools = await client.listTools(); // names + descriptions onlyconst schema = await client.describeTool("search"); // full schema, cachedconst result = await client.callTool("search", { query: "hello" });
transport.close();For HTTP servers, swap StdioClientTransport for HttpClientTransport:
import { HttpClientTransport } from "@delta-mcp/client";
const transport = new HttpClientTransport("http://localhost:3000");Next
See stdio-server for the server side of this connection, or result-handler to understand what happens to large outputs.