Skip to content

Client Usage

Shows how to connect to a Delta-MCP server programmatically using DeltaClient.

What it demonstrates

  1. Connecting — spawn a server as a child process via StdioClientTransport
  2. Progressive disclosurelistTools() returns names + short descriptions only (~115 tokens for 6 tools)
  3. On-demand schema fetchdescribeTool(name) fetches the full JSON schema and caches it
  4. Calling toolscallTool(name, args) handles schema fetch + call in one step

Run

Terminal window
npx tsx examples/client-usage/index.ts

Key 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 only
const schema = await client.describeTool("search"); // full schema, cached
const 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");

View on GitHub →

Next

See stdio-server for the server side of this connection, or result-handler to understand what happens to large outputs.