bradygaster/UsingMcpServers
If you are the rightful owner of UsingMcpServers and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Model Context Protocol (MCP) server is a specialized server designed to facilitate communication between chat agents and custom tools, enhancing the capabilities of language models through tool integration.
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.md
file 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_ENDPOINT
user secret for the TranslationAgent project
- Run the
TranslationTools
project usingdotnet run
or 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
TranslationAgent
project usingdotnet run
or 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.md
file 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.