UsingMcpServers
No description available
Ask AI about UsingMcpServers
Powered by Claude Β· Grounded in docs
I know everything about UsingMcpServers. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
Translation Agent with MCP Tools
A demonstration application that uses Model Context Protocol (MCP) to provide custom tools to an Azure OpenAI-powered chat agent.
Project Structure
/
βββ TranslationAgent/ # Main chat client application
β βββ Program.cs # Application entry point and DI setup
β βββ ChatClientUI.cs # Console-based chat interface
β βββ Extensions/
β β βββ IHostApplicationBuilderExtensions.cs # Azure OpenAI client configuration
β β βββ IServiceCollectionExtensions.cs # MCP client registration
β βββ TranslationAgent.csproj # Project file with dependencies
β
βββ TranslationTools/ # MCP server hosting custom tools
β βββ Program.cs # Kestrel web server setup for MCP
β βββ Tools/
β β βββ LeetSpeakTool.cs # Converts text to leet speak (1337)
β β βββ CodeSpeakTool.cs # Text transformation tool
β β βββ ReverseTool.cs # Reverses input text
β βββ TranslationTools.csproj # Project file with MCP dependencies
β
βββ prompt.md # Azure provisioning prompt for Copilot
βββ TranslationAgent.sln # Visual Studio solution file
Key Components
- TranslationAgent: Console application that provides a chat interface using Azure OpenAI with access to custom MCP tools
- TranslationTools: ASP.NET Core web application that hosts MCP tools via Server-Sent Events (SSE) transport
- Infrastructure: Bicep templates and scripts for provisioning required Azure resources
Architecture
graph TD
A[User Input] --> B[TranslationAgent Console UI]
B --> C[Azure OpenAI Chat Client]
C --> D[LLM decides which tools to call]
D --> E[MCP Client]
E --> F[HTTP/SSE Transport]
F --> G[TranslationTools Kestrel Server]
G --> H[MCP Tool Registry]
H --> I[LeetSpeakTool]
H --> J[CodeSpeakTool]
H --> K[ReverseTool]
I --> L[Tool Response]
J --> L
K --> L
L --> F
F --> E
E --> C
C --> M[LLM processes tool results]
M --> B
B --> N[Display Response to User]
Azure Resource Provisioning
This project uses GitHub Copilot for Azure to provision the required Azure resources. The prompt.md file contains a structured prompt that Copilot can use to create an Azure OpenAI resource with the gpt-4o-mini model deployment.
Create a new Azure Open AI resource in my Azure subscription, in a new resource group, and use random names for the resources and group. Then add a gpt-4o-mini model deployment to that resource instance. Once the resources have been provisioned, set the AZURE_OPENAI_ENDPOINT user secret to be the new Azure OpenAI instance's endpoint for the TranslationAgent project. My code optimizes for security and best practices when creating and managing Azure resources, so please don't use any secrets and connect to resources using managed identity.
Using GitHub Copilot for Azure
- Open the
prompt.mdfile in this repository - Activate GitHub Copilot for Azure in Visual Studio 2022 (Preview feature)
- Use the prompt to have Copilot provision:
- New Azure Resource Group (random name)
- Azure OpenAI resource (random name)
- gpt-4o-mini model deployment
- Set the
AZURE_OPENAI_ENDPOINTuser secret for the TranslationAgent project
- Run the
TranslationToolsproject usingdotnet runor the Visual Studio or Visual Studio Code debuggers. The tools will need to be hosted and available prior to running the next step. - Run the
TranslationAgentproject usingdotnet runor the Visual Studio or Visual Studio Code debuggers. - Provide a prompt to be translated.
The solution is designed with security best practices, using Azure Managed Identity for authentication rather than connection strings or API keys.
Learn more: GitHub Copilot for Azure Preview Launches in Visual Studio 2022 with Azure MCP Support
Getting Started
- Use GitHub Copilot for Azure with the
prompt.mdfile to provision Azure resources - Run the TranslationTools MCP server:
dotnet run --project TranslationTools - Run the TranslationAgent client:
dotnet run --project TranslationAgent - Start chatting and try prompts that would benefit from text transformation tools
The agent will automatically determine when to use the available tools based on your conversation context.
