AgentFX MCP MicrosoftLearn
Example of integration between Microsoft Agent Framework and Microsoft Learn MCP Server; see official documentation
Ask AI about AgentFX MCP MicrosoftLearn
Powered by Claude Β· Grounded in docs
I know everything about AgentFX MCP MicrosoftLearn. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
Agent Framework with Microsoft Learn MCP
Two .NET console applications demonstrating the integration of Microsoft Agent Framework with Model Context Protocol (MCP) to access Microsoft Learn documentation.
οΏ½ Projects
1. AgentFrameworkWithLearnMcp
Simple demo with a single question execution. Perfect for learning the basics.
2. AgentFrameworkCopilot β
Interactive ChatGPT-style experience with conversation history, commands, and enhanced UI. Uses AgentThread to maintain conversation context and state across multiple interactions. Recommended for interactive use.
β¨ Key Features
- π Connection to Microsoft Learn MCP Server
- π Dynamic tool discovery (search, fetch, code samples)
- π€ AI Agent powered by Azure OpenAI
- π§΅ AgentThread for maintaining conversation context and state
- π§ Memory Store for persistent user context and personalization
- π¬ Interactive chat loop with conversation history
- π Real-time metrics and colored UI
- πΎ Save conversations to file
π Prerequisites
- .NET 9.0 SDK
- Azure OpenAI Service with a deployment
- Azure CLI (
az login)
βοΈ Quick Setup
- Authenticate with Azure:
az login
- Configure your Azure OpenAI settings:
Edit launchSettings.json in each project's Properties folder:
{
"profiles": {
"AgentFrameworkCopilot": {
"commandName": "Project",
"environmentVariables": {
"AZURE_OPENAI_ENDPOINT": "https://your-resource.openai.azure.com/",
"AZURE_OPENAI_DEPLOYMENT_NAME": "gpt-5-mini"
}
}
}
}
- Run the project:
# Simple demo
### Option 2: Environment variables in PowerShell
```powershell
$env:AZURE_OPENAI_ENDPOINT = "https://your-resource.openai.azure.com/"
$env:AZURE_OPENAI_DEPLOYMENT_NAME = "gpt-5-mini"
Option 3: Permanent environment variables
[System.Environment]::SetEnvironmentVariable('AZURE_OPENAI_ENDPOINT', 'https://your-resource.openai.azure.com/', 'User')
[System.Environment]::SetEnvironmentVariable('AZURE_OPENAI_DEPLOYMENT_NAME', 'gpt-5-mini', 'User')
π Run
cd AgentFrameworkWithLearnMcp
dotnet run
# Interactive chat (recommended)
cd AgentFrameworkCopilot
dotnet run
π¬ Interactive Commands
Once running AgentFrameworkCopilot:
| Command | Description |
|---|---|
/help | Show available commands |
/clear | Start new conversation |
/history | View conversation history |
/memory | Show all stored memories |
/profile | Display user profile information |
/save | Save conversation to file |
/exit | Quit application |
π¦ Dependencies
Azure.AI.OpenAI(2.5.0-beta.1)Azure.Identity(1.17.0)Microsoft.Agents.AI.OpenAI(1.0.0-preview.251028.1)ModelContextProtocol(0.4.0-preview.3)
π How It Works
- Connects to Microsoft Learn MCP Server (https://learn.microsoft.com/api/mcp)
- Discovers available tools (docs search, code samples, etc.)
- Creates an AI Agent with Azure OpenAI (
gpt-5-mini) - Initializes an AgentThread to maintain conversation state
- Agent automatically uses MCP tools to fetch official documentation
- AgentThread tracks all messages and context across the conversation
- Returns answers with official Microsoft Learn references
π§΅ About AgentThreads
AgentThread is a key component of the Microsoft Agent Framework that:
- Maintains conversation context across multiple user interactions
- Automatically tracks all messages (user queries and agent responses)
- Preserves state between agent runs
- Enables multi-turn conversations with memory
- Can be reset with
/clearcommand to start fresh conversations
π§ About Memory Store
The Memory Store provides persistent context and personalization capabilities:
- User Profile: Stores personal information (name, title, interests, location)
- Contextual Awareness: Agent remembers user preferences and details across conversations
- Custom Memories: Extensible key-value storage for any user-specific data
- Integrated with System Prompt: Memory context is automatically injected into agent instructions
- Commands:
/memory- View all stored memories/profile- Display formatted user profile
Default User Profile
The application loads a default profile for demonstration:
Name: Pablo Piovano
Nickname: Pablito Piova
Title: Microsoft MVP
Interests: CafΓ©, Cocinar Asados Argentinos, Viajar
Location: Sunchales, Santa Fe
Country: Argentina
You can customize the profile by editing the LoadDefaultUserProfile() method in Program.cs.
π Authentication
Uses AzureCliCredential for Azure authentication. Ensure you have:
- Azure CLI installed
- Authenticated via
az login - Proper permissions on the Azure OpenAI resource
Happy coding! π
