AI services are starting to support server-side use of MCP servers. For example, Anthropic's service:
https://docs.anthropic.com/en/docs/agents-and-tools/mcp-connector
and OpenAI responses:
https://platform.openai.com/docs/guides/tools-remote-mcp
With the ModelContextProtocol library, it's easy to use any MCP server, including stdio ones, locally, treating every tool as an AIFunction, but there's not currently an abstraction for the hosted MCP server case, where the service uses the server directly.
Additional details originally captured in Follow-ups for MCP tool (#6779):
AI services are starting to support server-side use of MCP servers. For example, Anthropic's service:
https://docs.anthropic.com/en/docs/agents-and-tools/mcp-connector
and OpenAI responses:
https://platform.openai.com/docs/guides/tools-remote-mcp
With the ModelContextProtocol library, it's easy to use any MCP server, including stdio ones, locally, treating every tool as an AIFunction, but there's not currently an abstraction for the hosted MCP server case, where the service uses the server directly.
HostedMcpServer : AITool. This would be configurable with all the common stuff: server url, optional list of allowed tool names, indication of whether to allow auto invocation, etc.HostedMcpServerToolCall : AIContentto represent the call the service makes to the server (including tool name and arguments) and similarly aHostedMcpServerToolResultto represent the result of the operation.IChatClientthat don't have this capability, we can enable it via anMcpServerChatClient : IChatClientthat itself uses MCP clients. It would translate aHostedMcpServertool into creating an McpClient and replacing the tool in the tool collection with the appropriate McpClientTool instances. With a FunctionInvokingChatClient in the pipeline, it would enable then similar automatic handling of MCP Server interactions.Add UseMcpClient modelcontextprotocol/csharp-sdk#1086.
Additional details originally captured in Follow-ups for MCP tool (#6779):
UserInput Request/Response: rename id to requestId #7106