# McpServer (@salmonui/mcp)

> The McpServer class of @salmonui/mcp: A Salmon UI MCP server bound to one index.

Canonical: https://salmonui.dev/docs/reference/mcp/McpServer

```ts
import { McpServer } from '@salmonui/mcp';
```

Entry index: https://salmonui.dev/docs/reference/mcp (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/mcp.md).

## Reference

Kind: class

```ts
class McpServer {
    #private;
    readonly name: string;
    readonly version: string;
    legacyVersion: string | undefined;
    constructor(options: ServerOptions);
    get tools(): SalmonTools;
    get serverInfo(): Record<string, string>;
    handleLine(line: string): string | undefined;
    handle(message: unknown): JsonRpcResponse | JsonRpcResponse[] | undefined;
    handleOne(message: unknown): JsonRpcResponse | undefined;
    dispatch(method: string, params: Record<string, unknown>): Record<string, unknown>;
    initialize(params: Record<string, unknown>): Record<string, unknown>;
    legacy(method: string, params: Record<string, unknown>): Record<string, unknown>;
    modern(method: string, params: Record<string, unknown>, meta: Record<string, unknown>): Record<string, unknown>;
    callTool(params: Record<string, unknown>): ToolResult;
}
```

A Salmon UI MCP server bound to one index.

Members (14):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `__#2@#private` | `#private;` |  |  |
| `name` | `readonly name: string;` |  |  |
| `version` | `readonly version: string;` |  |  |
| `legacyVersion` | `legacyVersion: string \| undefined;` |  | Version negotiated by a legacy `initialize` on this process. |
| `tools` | `get tools(): SalmonTools;` |  |  |
| `serverInfo` | `get serverInfo(): Record<string, string>;` |  |  |
| `handleLine` | `handleLine(line: string): string \| undefined;` |  | Handles one line of the stdio transport; returns the line to write (no trailing newline), if any. |
| `handle` | `handle(message: unknown): JsonRpcResponse \| JsonRpcResponse[] \| undefined;` |  | Handles a parsed message or batch. Returns undefined when nothing must be sent (notifications, client responses). |
| `handleOne` | `handleOne(message: unknown): JsonRpcResponse \| undefined;` |  |  |
| `dispatch` | `dispatch(method: string, params: Record<string, unknown>): Record<string, unknown>;` |  |  |
| `initialize` | `initialize(params: Record<string, unknown>): Record<string, unknown>;` |  |  |
| `legacy` | `legacy(method: string, params: Record<string, unknown>): Record<string, unknown>;` |  |  |
| `modern` | `modern(method: string, params: Record<string, unknown>, meta: Record<string, unknown>): Record<string, unknown>;` |  |  |
| `callTool` | `callTool(params: Record<string, unknown>): ToolResult;` |  |  |
