Skip to content

API Reference


API Reference / McpServer

Class: McpServer ​

Defined in: src/mcp/Server.ts:163

MCP server speaking JSON-RPC 2.0 over stdio.

Exposes the agent tool registry as MCP tools, account state as resources, and a handful of prompt templates. Every tool call goes through AgentToolRegistry, so the scope and live-trading gates apply here exactly as they do to a direct caller.

Constructors ​

Constructor ​

new McpServer(options): McpServer

Defined in: src/mcp/Server.ts:173

Parameters ​

options ​

McpServerOptions

Returns ​

McpServer

Methods ​

run() ​

run(): Promise<void>

Defined in: src/mcp/Server.ts:186

Reads newline-delimited JSON-RPC from stdin until the stream closes.

Returns ​

Promise<void>


close() ​

close(): void

Defined in: src/mcp/Server.ts:196

Returns ​

void


handleLine() ​

handleLine(line): Promise<void>

Defined in: src/mcp/Server.ts:201

Handles one JSON-RPC line. Exposed for testing.

Parameters ​

line ​

string

Returns ​

Promise<void>

Community project — not affiliated with Dhan. MIT License.