Mcp Client
Classes
Classes
MCPClient
Constructor
constructor(config: MCPClientConfig)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
config | MCPClientConfig | Yes |
Methods
listTools
List all available tools from MCP HTTP Server
listTools(): Promise<Tool[]>
Returns:
Promise<Tool[]> -
callTool
Call a specific tool with arguments
callTool(toolName: string, args?: Record<string, any> | undefined): Promise<any>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
toolName | string | Yes | |
args | Record<string, any> | undefined | No |
Returns:
Promise<any> -
health
Check MCP HTTP server health
health(): Promise<{ status: string; initialized: boolean; }>
Returns:
Promise<{ status: string; initialized: boolean; }> -
updateAuthToken
Update the auth token (useful when token is refreshed)
updateAuthToken(authToken: string): void
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
authToken | string | Yes |
updateConfig
Update client configuration
updateConfig(updates: Partial<MCPClientConfig>): void
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
updates | Partial<MCPClientConfig> | Yes |
MCPClientError
Constructor
constructor(message: string, statusCode?: number | undefined, response?: any)
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
message | string | Yes | |
statusCode | number | undefined | No | |
response | any | No |