McpToolServerConfigurationService class
Service responsible for discovering and normalizing MCP (Model Context Protocol) tool servers and producing configuration objects consumable by the Claude SDK.
Constructors
| Mcp |
Construct a McpToolServerConfigurationService. |
Methods
| get |
Connect to the MCP server and return tools with names prefixed by the server name. Throws if the server URL is missing or the client fails to list tools. |
| list |
Return MCP server definitions for the given agent. In development (NODE_ENV=Development) this reads the local ToolingManifest.json; otherwise it queries the remote tooling gateway. |
| list |
Return MCP server definitions for the given agent. In development (NODE_ENV=Development) this reads the local ToolingManifest.json; otherwise it queries the remote tooling gateway. |
| list |
Return MCP server definitions for the given agent. In development (NODE_ENV=Development) this reads the local ToolingManifest.json; otherwise it queries the remote tooling gateway. This overload automatically resolves the agenticAppId from the TurnContext and generates the auth token if not provided. |
| send |
Sends chat history to the MCP platform for real-time threat protection. |
| send |
Sends chat history to the MCP platform for real-time threat protection. |
Constructor Details
McpToolServerConfigurationService(IConfigurationProvider<ToolingConfiguration>)
Construct a McpToolServerConfigurationService.
new McpToolServerConfigurationService(configProvider?: IConfigurationProvider<ToolingConfiguration>)
Parameters
- configProvider
Optional configuration provider. Defaults to defaultToolingConfigurationProvider if not specified.
Method Details
getMcpClientTools(string, MCPServerConfig)
Connect to the MCP server and return tools with names prefixed by the server name. Throws if the server URL is missing or the client fails to list tools.
function getMcpClientTools(mcpServerName: string, mcpServerConfig: MCPServerConfig): Promise<McpClientTool[]>
Parameters
- mcpServerName
-
string
- mcpServerConfig
- MCPServerConfig
Returns
Promise<McpClientTool[]>
listToolServers(string, string)
Warning
This API is now deprecated.
Use the overload with TurnContext and Authorization parameters instead to enable x-ms-agentid header support and automatic token generation.
Return MCP server definitions for the given agent. In development (NODE_ENV=Development) this reads the local ToolingManifest.json; otherwise it queries the remote tooling gateway.
function listToolServers(agenticAppId: string, authToken: string): Promise<MCPServerConfig[]>
Parameters
- agenticAppId
-
string
The agentic app id for which to discover servers.
- authToken
-
string
Bearer token used when querying the remote tooling gateway.
Returns
Promise<MCPServerConfig[]>
A promise resolving to an array of normalized MCP server configuration objects.
listToolServers(string, string, ToolOptions)
Warning
This API is now deprecated.
Use the overload with TurnContext and Authorization parameters instead to enable x-ms-agentid header support and automatic token generation.
Return MCP server definitions for the given agent. In development (NODE_ENV=Development) this reads the local ToolingManifest.json; otherwise it queries the remote tooling gateway.
function listToolServers(agenticAppId: string, authToken: string, options?: ToolOptions): Promise<MCPServerConfig[]>
Parameters
- agenticAppId
-
string
The agentic app id for which to discover servers.
- authToken
-
string
Bearer token used when querying the remote tooling gateway.
- options
- ToolOptions
Optional tool options when calling the gateway.
Returns
Promise<MCPServerConfig[]>
A promise resolving to an array of normalized MCP server configuration objects.
listToolServers(TurnContext, Authorization, string, string, ToolOptions)
Return MCP server definitions for the given agent. In development (NODE_ENV=Development) this reads the local ToolingManifest.json; otherwise it queries the remote tooling gateway. This overload automatically resolves the agenticAppId from the TurnContext and generates the auth token if not provided.
function listToolServers(turnContext: TurnContext, authorization: Authorization, authHandlerName: string, authToken?: string, options?: ToolOptions): Promise<MCPServerConfig[]>
Parameters
- turnContext
- TurnContext
The TurnContext of the current request.
- authorization
- Authorization
Authorization object for token exchange.
- authHandlerName
-
string
The name of the auth handler to use for token exchange.
- authToken
-
string
Optional bearer token. If not provided, will be auto-generated via token exchange.
- options
- ToolOptions
Optional tool options when calling the gateway.
Returns
Promise<MCPServerConfig[]>
A promise resolving to an array of normalized MCP server configuration objects.
sendChatHistory(TurnContext, ChatHistoryMessage[])
Sends chat history to the MCP platform for real-time threat protection.
function sendChatHistory(turnContext: TurnContext, chatHistoryMessages: ChatHistoryMessage[]): Promise<OperationResult>
Parameters
- turnContext
- TurnContext
The turn context containing conversation information.
- chatHistoryMessages
The chat history messages to send.
Returns
Promise<OperationResult>
A Promise that resolves to an OperationResult indicating success or failure.
Remarks
HTTP exceptions (network errors, timeouts) are caught and logged but not rethrown. Instead, the method returns an OperationResult indicating whether the operation succeeded or failed. Callers can choose to inspect the result for error handling or ignore it if error details are not needed.
sendChatHistory(TurnContext, ChatHistoryMessage[], ToolOptions)
Sends chat history to the MCP platform for real-time threat protection.
function sendChatHistory(turnContext: TurnContext, chatHistoryMessages: ChatHistoryMessage[], options?: ToolOptions): Promise<OperationResult>
Parameters
- turnContext
- TurnContext
The turn context containing conversation information.
- chatHistoryMessages
The chat history messages to send.
- options
- ToolOptions
Optional tool options for sending chat history.
Returns
Promise<OperationResult>
A Promise that resolves to an OperationResult indicating success or failure.
Remarks
HTTP exceptions (network errors, timeouts) are caught and logged but not rethrown. Instead, the method returns an OperationResult indicating whether the operation succeeded or failed. Callers can choose to inspect the result for error handling or ignore it if error details are not needed.