@anvia/mcp API reference ​
ts
import {
McpClient,
McpClientGroup,
isMcpTool,
type McpClientOptions,
type McpClientTransport,
type McpServer,
type McpTool,
} from '@anvia/mcp'Client ​
ts
class McpClient {
constructor(options: McpClientOptions)
connect(options?: { abortSignal?: AbortSignal }): Promise<McpServer>
close(): Promise<void>
}McpClientOptions contains a stable name, one transport, and optional tool filtering or prefix configuration. Construction is lazy. One connected client owns one remote transport.
Client group ​
ts
class McpClientGroup {
static connect(options: {
clients: readonly McpClient[]
abortSignal?: AbortSignal
}): Promise<McpClientGroup>
readonly servers: readonly McpServer[]
close(): Promise<void>
}Group connection closes already-connected clients if a later client fails. Closing is explicit and safe to call during application shutdown.
Transports ​
McpClientTransport is a discriminated union:
stdio:command, optionalargs,cwd,env,stderr, and buffer limits;streamableHttp:url, optional exact-endpointheaders,authProvider, session/reconnection settings, andssrfProtection; orcustom: an application-owned factory returning an MCP SDK v2Transport.
Return to the @anvia/mcp overview.