mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
* Bump Azure.AI.Projects to 2.0.0 GA - Update Azure.AI.Projects from 2.0.0-beta.2 to 2.0.0 in CPM - Update Azure.Identity from 1.19.0 to 1.20.0 (transitive dep) - Update System.ClientModel from 1.9.0 to 1.10.0 (transitive dep) - Rename types per Azure.AI.Projects.Agents 2.0.0 breaking changes: - AgentVersion -> ProjectsAgentVersion - AgentRecord -> ProjectsAgentRecord - AgentDefinition -> ProjectsAgentDefinition - AgentVersionCreationOptions -> ProjectsAgentVersionCreationOptions - PromptAgentDefinition -> DeclarativeAgentDefinition - AgentTool -> ProjectsAgentTool - AgentsClient -> AgentAdministrationClient - .Agents property -> .AgentAdministrationClient - Add using Azure.AI.Projects.Memory namespace (types moved) - Update AGENTS.md with BOM and output capture conventions * Address PR review feedback - Rename AIProjectClient parameter to aiProjectClient in AsChatClientAgent overloads - Fix XML doc: ProjectsAgentTool namespace from Azure.AI.Projects.OpenAI to Azure.AI.Projects.Agents - Rename test method to reflect DeclarativeAgentDefinition terminology
This sample demonstrates how to expose an existing AI agent as an MCP tool.
Run the sample
To run the sample, please use one of the following MCP clients: https://modelcontextprotocol.io/clients
Alternatively, use the QuickstartClient sample from this repository: https://github.com/modelcontextprotocol/csharp-sdk/tree/main/samples/QuickstartClient
Run the sample using MCP Inspector
To use the MCP Inspector, follow these steps:
- Open a terminal in the Agent_Step07_AsMcpTool project directory.
- Run the
npx @modelcontextprotocol/inspector dotnet run --framework net10.0command to start the MCP Inspector. Make sure you have node.js and npm installed.npx @modelcontextprotocol/inspector dotnet run --framework net10.0 - When the inspector is running, it will display a URL in the terminal, like this:
MCP Inspector is up and running at http://127.0.0.1:6274 - Open a web browser and navigate to the URL displayed in the terminal. If not opened automatically, this will open the MCP Inspector interface.
- In the MCP Inspector interface, add the following environment variables to allow your MCP server to access Microsoft Foundry Project to create and run the agent:
- AZURE_AI_PROJECT_ENDPOINT = https://your-resource.openai.azure.com/ # Replace with your Microsoft Foundry Project endpoint
- AZURE_AI_MODEL_DEPLOYMENT_NAME = gpt-4o-mini # Replace with your model deployment name
- Find and click the
Connectbutton in the MCP Inspector interface to connect to the MCP server. - As soon as the connection is established, open the
Toolstab in the MCP Inspector interface and select theJokertool from the list. - Specify your prompt as a value for the
queryargument, for example:Tell me a joke about a pirateand click theRun Toolbutton to run the tool. - The agent will process the request and return a response in accordance with the provided instructions that instruct it to always start each joke with 'Aye aye, captain!'.