> ## Documentation Index
> Fetch the complete documentation index at: https://docs.director.run/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP API Reference

The Director MCP API provides a simple interface for creating MCP servers, proxies and clients. It extends the official [Typescript SDK](https://github.com/modelcontextprotocol/typescript-sdk). The source code is available in [packages/mcp](https://github.com/director-run/director/tree/main/packages/mcp).

## API

```typescript theme={null}
import { HTTPClient } from "@director.run/sdk";
import { StdioClient } from "@director.run/sdk";
import { ProxyServer } from "@director.run/sdk";
import { serveOverSSE, serveOverStdio, serveOverStreamable } from "@director.run/sdk";

const proxy = new ProxyServer({
  id: "my-proxy",
  servers: [
    new StdioClient({
      name: "stdio-server",
      command: "npx",
      args: ["-y", "@director.run/cli", "http2stdio", "http://example.com/sse"],
    }),
    new HTTPClient({
      name: "http-server",
      // supports SSE & Streamable
      url: "http://example.com/mcp",
    }),
  ],
});

// Connect to the servers
await proxy.connectTargets();

// Helper methods to serve the proxy
await serveOverStreamable(proxy, 3673);
await serveOverSSE(proxy, 3674);
await serveOverStdio(proxy);

// Connect over Streamable or SSE
const httpClient = await HTTPClient.createAndConnectToHTTP(
  "http://localhost:3673/mcp",
);

// Connect over Stdio
const stdioClient = await StdioClient.createAndConnectToStdio(
  "server-command",
  ["server-args"],
);

// List the tools via HTTP client
console.log(await httpClient.listTools());

// List the tools via Stdio client
console.log(await stdioClient.listTools());

```
