Agent Framework: MCP Servers
The general shape of MCP servers and clients in the Agent Framework - hosting tools and calling them.
Table of Contents
Hosting a Server
Consuming a Server
Hosting an MCP Server (Shape)
A class marked [McpServerToolType], with methods marked [McpServerTool] and a
[Description], becomes a set of tools an agent can discover and call. Registration and
mounting generally look like this:
Loading Monaco Editor...
In practice you'd put real authentication (not just an authorization filter comment) and rate limiting in front of the mounted endpoint before exposing it beyond your own process.
Consuming an MCP Server from an AIAgent
The other side of the protocol is an AIAgent that discovers tools from a remote MCP server
and lets the model call them autonomously - the Agent Framework accepts MCP-discovered tools as regular
AITools on ChatOptions:
Loading Monaco Editor...
References
For more detailed information and advanced scenarios, check out these helpful resources:
Model Context Protocol
The protocol spec: tools, resources, prompts, and transports.MCP C# SDK
ModelContextProtocol.Server / ModelContextProtocol.Client, the packages an ASP.NET Core MCP server is built on.Microsoft Agent Framework overview
Includes how AIAgent tool-calling and MCP tool integration fit together.