---
title: "Speak AI Node SDK, use @speakai/mcp-server as a library"
description: "Install @speakai/mcp-server as a Node dependency and call registerAllTools, registerResources, registerPrompts, and createSpeakClient directly in your own code."
---

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

# Speak AI Node SDK, use @speakai/mcp-server as a library

The `@speakai/mcp-server` package is both a runnable MCP server and a Node library. Install it as a dependency when you want to call Speak AI from your own Node.js code, embed its tools inside another MCP server, or build the same capabilities into a different application. The package requires Node 22 or newer.

## When should you use the SDK instead of connecting through an AI client?

Use the SDK when you're writing Node and want Speak AI's tool definitions, resource readers, and prompt templates as functions you call directly, instead of exposing them through a connected AI assistant. Speak AI's own backend, speak-server, uses the package this way, registering its tools on its own `McpServer` instance rather than connecting to the hosted endpoint.

If you just want an agent to use Speak AI in conversation, connect through the [MCP server](/mcp) instead. Reach for the SDK when you're building the server side of that connection yourself.

## How do you install it?

Add `@speakai/mcp-server` as a dependency with your package manager.

```sh
npm install @speakai/mcp-server
pnpm add @speakai/mcp-server
yarn add @speakai/mcp-server
bun add @speakai/mcp-server
```

## What does the package export?

The package exports five functions and a static tool-name manifest for embedding Speak AI's MCP capabilities directly in your own code.

```ts
import {
  registerAllTools,
  registerResources,
  registerPrompts,
  createSpeakClient,
  formatAxiosError,
  SPEAK_MCP_TOOL_NAMES,
} from "@speakai/mcp-server";
```

- **`registerAllTools(server, client?)`** registers all 112 tools on an `McpServer` instance. Pass a `client` for server-side use with per-request auth. If you omit it, the tools fall back to a default Axios client that reads `SPEAK_API_KEY` (and optionally `SPEAK_BASE_URL`) from the environment, the same as stdio mode.
- **`registerResources(server, client?)`** registers the 5 resources, media library, folders, languages, transcript, and insights, the same way.
- **`registerPrompts(server)`** registers the 3 prompt templates: `analyze-meeting`, `research-across-media`, and `meeting-brief`.
- **`createSpeakClient({ baseUrl, apiKey, accessToken })`** returns an authenticated Axios instance for services that already manage their own access tokens, instead of letting the package fetch and refresh one for you.
- **`formatAxiosError(error)`** formats an Axios error into a readable string, redacting anything that looks like a token, secret, password, cookie, or API key before the message reaches a model's context window.
- **`SPEAK_MCP_TOOL_NAMES`** is a static array of every tool name `registerAllTools` registers, useful for validating or routing a tool call without instantiating a server.

## How do you register the tools on your own server?

Call `registerAllTools`, `registerResources`, and `registerPrompts` on your own `McpServer` instance to expose the same capabilities the hosted Speak AI MCP server does.

```ts
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { registerAllTools, registerResources, registerPrompts } from "@speakai/mcp-server";

const server = new McpServer({ name: "speak-ai", version: "1.0.0" });

registerAllTools(server);
registerResources(server);
registerPrompts(server);

const transport = new StdioServerTransport();
await server.connect(transport);
```

With `SPEAK_API_KEY` set in the environment, this is the same registration sequence the package's own stdio entry point runs.

## How do you pass a client with its own access token?

Use `createSpeakClient` when your own service already manages Speak AI access tokens, instead of letting the package authenticate with an API key on first use.

```ts
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { createSpeakClient, registerAllTools } from "@speakai/mcp-server";

const server = new McpServer({ name: "your-app", version: "1.0.0" });

const client = createSpeakClient({
  baseUrl: "https://api.speakai.co",
  apiKey: "sk_test_speak_0000000000000000",
  accessToken: "your-access-token",
});

registerAllTools(server, client);
```

## Related guides

- [MCP server overview](/mcp)
- [Connect your AI tool](/mcp)
- [Authentication](/mcp/authentication)

Source: https://docs.speakai.co/sdk/index.mdx
