An AI console application built with Semantic Kernel and Microsoft.Extensions.AI, featuring MCP (Model Context Protocol) tool integration.
- Conversational AI - Chat with context maintained across turns
- Tool Calling - Automatic function invocation via MCP servers
- File System Access - Read, write, search, and manage files in allowed directories
- Extensible Architecture - Built for adding subagents, tools, and evaluation
| Component | Technology |
|---|---|
| Framework | .NET 10.0 |
| AI Orchestration | Semantic Kernel 1.68.0 |
| Abstractions | Microsoft.Extensions.AI 10.0.1 |
| Tool Protocol | Model Context Protocol (MCP) |
| LLM Provider | Azure OpenAI (gpt-4.1-mini) |
| Hosting | Microsoft.Extensions.Hosting |
TeddyBot/
├── Program.cs # Entry point with DI host setup
├── appsettings.json # Configuration
├── Configuration/
│ ├── AzureOpenAISettings.cs # Azure OpenAI connection settings
│ ├── TeddyBotSettings.cs # Agent name and system prompt
│ └── McpSettings.cs # MCP server configuration
├── Agents/
│ ├── ITeddyAgent.cs # Agent abstraction
│ └── TeddyAgent.cs # ChatCompletionAgent wrapper
├── Services/
│ ├── IChatService.cs # Chat orchestration interface
│ ├── ChatService.cs # Message handling
│ └── ConversationContext.cs # Conversation state
├── Plugins/
│ └── McpPluginLoader.cs # MCP tool loader
├── Hosting/
│ └── TeddyBotHostedService.cs # Console interaction loop
└── workspace/ # Directory for file operations
- .NET 10.0 SDK
- Node.js (for MCP filesystem server via npx)
- Azure OpenAI resource or Azure AI Foundry project
- Set your Azure OpenAI credentials:
cd TeddyBot
dotnet user-secrets set "AzureOpenAI:Endpoint" "https://your-resource.cognitiveservices.azure.com/"
dotnet user-secrets set "AzureOpenAI:ApiKey" "your-api-key"- Update
appsettings.jsonif using a different model deployment:
"AzureOpenAI": {
"DeploymentName": "your-deployment-name",
"ModelId": "your-model-id"
}cd TeddyBot
dotnet runCommands:
- Type your message and press Enter to chat
clear- Reset conversation historyexit- Quit the application
You: What can you do?
TeddyBot: I can assist you with questions, writing, and file operations...
You: Create a file called notes.txt with "Meeting at 3pm"
TeddyBot: I have created notes.txt with your content.
You: List files in workspace
TeddyBot: There is one file: notes.txt
The filesystem MCP server provides 14 tools:
| Tool | Description |
|---|---|
read_file |
Read contents of a file |
write_file |
Create or overwrite a file |
read_multiple_files |
Read multiple files at once |
create_directory |
Create a new directory |
list_directory |
List directory contents |
move_file |
Move or rename files |
search_files |
Search for files by pattern |
get_file_info |
Get file metadata |
list_allowed_directories |
Show accessible directories |
| And more... |
- Multiple Subagents - Specialized agents for different tasks (coding, research, etc.)
- Additional MCP Servers - GitHub, SQLite, web browsing, and custom tools
- Custom Plugins - Native C# plugins with
[KernelFunction]attributes - Agent Evaluation - Microsoft.Extensions.AI.Evaluation integration for measuring performance
- Prompt Iteration - Data-driven prompt optimization based on evaluation metrics
- Memory/RAG - Long-term memory and retrieval-augmented generation
- Multi-turn Planning - Complex task decomposition and execution
- Azure AI Foundry Agents
- OpenTelemetry observability
- Structured output / JSON mode
- Image and multimodal support
┌─────────────────────────────────────────────────────────┐
│ TeddyBotHostedService │
│ (Console Loop) │
└─────────────────────┬───────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ ChatService │
│ (Message Orchestration) │
└─────────────────────┬───────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ TeddyAgent │
│ (ChatCompletionAgent Wrapper) │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Semantic Kernel │ │
│ │ ┌─────────────┐ ┌──────────────────────────┐ │ │
│ │ │ Azure OpenAI│ │ MCP Plugins │ │ │
│ │ │ Service │ │ (filesystem, etc.) │ │ │
│ │ └─────────────┘ └──────────────────────────┘ │ │
│ └─────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
Edit appsettings.json to add more MCP servers:
"Mcp": {
"Servers": [
{
"Name": "filesystem",
"Command": "npx",
"Arguments": ["-y", "@modelcontextprotocol/server-filesystem", "./workspace"],
"Enabled": true
},
{
"Name": "github",
"Command": "npx",
"Arguments": ["-y", "@modelcontextprotocol/server-github"],
"Enabled": true
}
]
}MIT