cpateldev/TodoMCPServer
If you are the rightful owner of TodoMCPServer and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The Model Context Protocol (MCP) server is a versatile tool that extends traditional REST APIs with AI agent tooling capabilities, allowing seamless interaction with AI assistants.
Todo MCP Server (.NET Minimal API with MCP server support)
Table of contents
- Todo MCP Server (.NET Minimal API with MCP server support)
- Table of contents
- Overview
- Architecture Diagram
- Features
- Tools and MCP Clients
- Prerequisites
- Create a New Project named
TodoMCPServer - How to Run the Application
- Package Dependencies
- Web API REST Endpoints
- MCP Tools Details
- MCP JSON Config Files and Usage
- Visual Studio Github Copilot Configuration
- VS Code GitHub Copilot Configuration
- GitHub Copilot responses to Todo MCP
- Claude Desktop Configuration
- Claude Desktop response to Todo MCP
- Gemini Code Assist Configuration
- Gemini Code Assists responses to Todo MCP
- Configuration Comparison
- Testing MCP Tools
- Testing using MCP Inspector
- Deploy to Azure App Service
- Test Todo REST API in Azure
- Secure Your Endpoint (Optional)
- Monitor & Scale
- End to end flow diagram
- Client communication flow
- Project Structure
- Troubleshooting MCP Connections
- Security Notes
- References
Overview
TodoMCPServer is a modern .NET 10 application that combines a traditional REST API with Model Context Protocol (MCP) server capabilities for todo list management. The project serves as both a standard web API and an MCP-enabled service that can be integrated with AI assistants like Claude Desktop, Gemini Code Assist, and other MCP-compatible tools.
TodoMCPServer is a comprehensive implementation that combines a Todo web API with Model Context Protocol (MCP) server support. This project demonstrates how traditional REST APIs can be extended with AI agent tooling capabilities through MCP, allowing AI assistants to interact with your application directly.
Architecture Diagram
requires mermaid extension in VS Code
flowchart TD
A[Client Applications] --> B{Interaction Layer}
B --> C[REST API<br/>11 Endpoints]
B --> D[MCP Server<br/>11 Tools]
C --> E[Business Logic Layer]
D --> E
E --> F[Data Access Layer]
F --> G[In-Memory EF Context]
H[Swagger UI] --> C
I[Claude Desktop] --> D
J[VSCode Gemini Code Assist] --> D
K[VSCode GitHub Copilot] --> D
L[Visual Studio GitHub Copilot] --> D
Features
- Dual Interface: Both REST API (11 endpoints) and MCP server (11 tools)
- Modern Stack: .NET 10 with Minimal API architecture
- Database: Entity Framework Core with In-Memory DB provider
- API Documentation: OpenAPI/Swagger UI integration
- MCP Server Support: MCP Server support using both HTTP and STDIO transport types
- MCP Integration: Pre-configured with Claude Desktop, Gemini Code Assist, Visual Studio Github Copilot, and VSCode MCP Client for major AI development tools
- ** MCP Inspector Support**: Easily test MCP tools using MCP Inspector using HTTP or STDIO transport types
- Cross-Platform: Runs on any platform supporting .NET 10
Tools and MCP Clients
Prerequisites
- .NET 10 SDK or later
- Visual Studio 2025+ or VS Code with C# Dev Kit
- Git for version control
- For MCP testing: GitHub Copilot in VS Code, Claude Desktop, Gemini Code Assist, or any MCP-compatible client
Create a New Project named TodoMCPServer
dotnet new webapi -n TodoMCPServer
cd TodoMCPServer
Add Required NuGet Packages
dotnet add package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore --version 10.0.0
dotnet add package Microsoft.AspNetCore.OpenApi --version 10.0.0
dotnet add package Microsoft.EntityFrameworkCore.InMemory --version 10.0.0
dotnet add package ModelContextProtocol --version 0.4.1-preview.1
dotnet add package ModelContextProtocol.AspNetCore --version 0.4.1-preview.1
dotnet add package Swashbuckle.AspNetCore.SwaggerUI --version 10.0.1
Update Program.cs to Configure MCP Server
builder.Services
.AddMcpServer()
.WithStdioServerTransport() // Use stdio transport for local AI clients
.WithHttpTransport() // Use HTTP transport for web-based clients
.WithToolsFromAssembly(); // Automatically register all MCP tools in the assembly
[!WARNING] NOTE: .WithStdioServerTransport() is commented out to allow deployment to Azure App Service as stdio transport is not supported there.
Map REST Endpoints and add MCP Tools
Create a new class Tools\TodoService.cs and implement the MCP tools for todo operations. Each tool corresponds to a REST API endpoint.
using ModelContextProtocol.AspNetCore.Tools;
using TodoMCPServer.Models;
public static class TodoService
{
public static void MapEndPoints(this IEndpointRouteBuilder app)
{
app.MapGroup("/todoitems");
app.MapGet("/", TodoTools.GetAllTodos)
.WithSummary("Get All Todo Items")
.WithDescription("Retrieve all todo items, optionally filtered by status query parameter (e.g., ?status=completed).");
app.MapPost("/complete", TodoTools.CompleteTodoItem)
.WithSummary("Complete Todo Item")
.WithDescription("Mark a todo item as complete by its ID.");
// Rest of the code
}
}
[McpServerToolType]
public static class TodoTools
{
// Get all todo items
[McpServerTool(Name = "get_all_todos"), Description("Retrieve all todo items optionally filtered by status.")]
public static async Task<List<Todo>> GetAllTodos(string? status, TodoDb db)
{
if (string.Equals(status, "completed", StringComparison.OrdinalIgnoreCase))
{
return await db.Todos.Where(t => t.IsComplete).ToListAsync();
}
else
{
return await db.Todos.ToListAsync();
}
}
// Other MCP tool implementations go here...
}
How to Run the Application
1. Clone and Navigate if you want to just try it out existing project
git clone https://github.com/cpateldev/TodoMCPServer.git
cd TodoMCPServer
2. Restore Dependencies
dotnet restore
3. Run the Application
dotnet run
# or for development with hot reload
dotnet watch run
4. Access Interfaces
- Swagger UI: http://localhost:5000/swagger
- REST API: http://localhost:5000/api/todos
- MCP Server: Available via stdio transport on port 5000
5. Alternative Launch Methods
- Visual Studio: Open
TodoMCPServer.slnand press F5 - VS Code: Open folder and use
.NET Core Launchconfiguration
Package Dependencies
Here are the NuGet packages used in this project:
| Package | Version | Description |
|---|---|---|
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore | 10.0.0 | ASP.NET Core middleware for Entity Framework Core error pages. |
Microsoft.AspNetCore.OpenApi | 10.0.0 | Provides APIs for generating and serving OpenAPI documents for web APIs built with ASP.NET Core. |
Microsoft.EntityFrameworkCore.InMemory | 10.0.0 | Entity Framework Core in-memory database provider. |
ModelContextProtocol | 0.4.1-preview.1 | A protocol for synchronizing models between a client and a server. (not needed in this project) |
ModelContextProtocol.AspNetCore | 0.4.1-preview.1 | ASP.NET Core middleware for ModelContextProtocol. |
Swashbuckle.AspNetCore.SwaggerUI | 10.0.1 | Middleware to expose an embedded version of the Swagger UI to visualize and interact with your web APIs. |
See comparison between
ModelContextProtocolvsModelContextProtocol.AspNetCore
Web API REST Endpoints
The API follows RESTful conventions with 11 endpoints for comprehensive Todo management.
Endpoint Details Table
| # | HTTP Method | Endpoint | Description | Parameters | Request Body | Response Type |
|---|---|---|---|---|---|---|
| 1 | GET | /todoitems | Get all todo items | status (query, optional) - Filter by status | None | Array of Todo |
| 2 | POST | /todoitems | Create a new todo item | None | Todo object | Single Todo |
| 3 | GET | /todoitems/complete | Mark a todo as complete | id (query, required) - Todo ID | None | boolean |
| 4 | GET | /todoitems/completed | Get all completed todos | None | None | Array of Todo |
| 5 | GET | /todoitems/{id} | Get a specific todo by ID | id (path, required) - Todo ID | None | Single Todo |
| 6 | PATCH | /todoitems/{id} | Update a specific todo | id (path, required) - Todo ID | Todo object (partial update) | boolean |
| 7 | DELETE | /todoitems/{id} | Delete a specific todo | id (path, required) - Todo ID | None | Single Todo (deleted item) |
| 8 | POST | /todoitems/ids | Get multiple todos by IDs | None | Array of integers (IDs) | Array of Todo |
| 9 | GET | /todoitems/search/{name} | Search todos by name | name (path, required) - Search term | None | Array of Todo |
| 10 | POST | /todoitems/batch | Create multiple todos in batch | None | Array of Todo objects | Array of Todo |
| 11 | GET | /todoitems/exists/{id} | Check if a todo exists | id (path, required) - Todo ID | None | boolean |
Swagger UI Usage
- Navigate to http://localhost:5000/swagger
- Click on any endpoint to expand
- Use "Try it out" button for interactive testing
- View request/response schemas and examples
MCP Tools Details
The MCP server provides 11 tools that mirror the REST API functionality, enabling AI assistants to interact with the Todo system.
MCP Tools Table
| # | Tool Name | Description | Input Parameters | Return Type | HTTP Equivalent |
|---|---|---|---|---|---|
| 1 | get_all_todos | Retrieve all todo items optionally filtered by status. | status (string, optional) - "completed" or null | List<Todo> | GET /todoitems |
| 2 | get_todo_by_id | Retrieve a todo item by its ID. | id (int) - Todo ID | Todo? (nullable) | GET /todoitems/{id} |
| 3 | get_todos_by_ids | Retrieve multiple todo items by their IDs. | ids (int[]) - Array of Todo IDs | List<Todo> | POST /todoitems/ids |
| 4 | search_todos_by_name | Search todo items by name. | name (string) - Search term | List<Todo> | GET /todoitems/search/{name} |
| 5 | add_todo_item | Add a new todo item. | todo (Todo) - Todo object to create | Todo | POST /todoitems |
| 6 | update_todo_item | Update an existing todo item by id. | id (int) - Todo IDinputTodo (Todo) - Updated todo data | bool (success) | PATCH /todoitems/{id} |
| 7 | batch_update_todo_items | Batch update todo items. | todos (Todo[]) - Array of todos to update | List<Todo> (updated items) | Multiple PATCH calls |
| 8 | delete_todo_item | Delete a todo item by its ID. | id (int) - Todo ID | Todo? (deleted item or null) | DELETE /todoitems/{id} |
| 9 | get_completed_todos | Retrieve all completed todo items. | None | List<Todo> | GET /todoitems/completed |
| 10 | complete_todo_item | Mark a todo item as complete by its ID. | id (int) - Todo ID | bool (success) | POST /todoitems/complete?id={id} |
| 11 | todo_exists | Check if a todo item exists by its ID. | id (int) - Todo ID | bool (exists) | GET /todoitems/exists/{id} |
Prompt to Request Flow
sequenceDiagram
participant Client as MCP Client Prompt (Github Copilot / Claude / Gemini)
participant MCPServer as Todo MCP Server
participant API as REST API Layer
participant DB as (EF Core) In-Memory DB
Client->>MCPServer: Prompt to Tool Request (e.g., get_all_todo)
MCPServer->>API: Process MCP Request
API->>DB: Execute Database Operation
DB-->>API: Return Data
API-->>MCPServer: Format Response
MCPServer-->>Client: Return Tool Result
MCP JSON Config Files and Usage
Visual Studio Github Copilot Configuration
Visual Studio supports MCP integration using both HTTP and stdio transport types. Create a new file:
<SOLUTIONDIR>\.mcp.jsonor%USERPROFILE%\.mcp.json. We recommend that you use Visual Studio to edit this file so that its JSON schema is automatically applied.
Transport type: http
{
"servers": {
"TodoMcpServer": {
"type": "http",
"url": "http://localhost:5000/api/mcp"
}
}
}
Visual Studio MCP support


Usage with Visual Studio GitHub Copilot: http:
- Only works in Visual Studio 2026.
- Place config in
.mcp.jsonfile in solution directory or user profile directory. - Run project using VS 2026 or using
dotnet runordotnet watchcommands - Click
Startlink above json block in.mcp.json - Access todo tools via GitHub Copilot AI assistant panel shown in above image

VS Code GitHub Copilot Configuration
VS Code supports MCP integration using both HTTP and stdio transport types.
.vscode\mcp.json
Transport type: http
{
"servers": {
"TodoMcpServer": {
"type": "http",
"url": "http://localhost:5000/api/mcp"
}
}
}

Usage with VS Code GitHub Copilot: http:
- Make sure chat.mcp.enabled is true in VS Code settings.
- Place config in
.vscode\mcp.json. See VSCode MCP docs for more details. - Run project using
dotnet runordotnet watchcommand - Click
Startlink above json block in.vscode\mcp.json - Access todo tools via AI assistant panel
Transport type: stdio
{
"servers": {
"TodoMcpHttpServer": {
"type": "stdio",
"command": "dotnet",
"args": ["run", "--project", "ToDoMCPServer.csproj"]
}
}
}
Usage with VS Code GitHub Copilot: stdio
- Make sure chat.mcp.enabled is true in VS Code settings.
- Place config in
.vscode\mcp.json. See VSCode MCP docs for more details. - Click
Startlink above json block in.vscode\mcp.json
- DONT NEED TO run project using
dotnet runordotnet watchcommand as stdio transport will start the project
- Wait for "MCP server started" message in output console
- Access todo tools via GitHub Copilot AI assistant panel
GitHub Copilot responses to Todo MCP

Claude Desktop Configuration
Transport type: stdio only
claude-desktop-config.json
{
"mcpServers": {
"TodoMcpHttpServer": {
"type": "stdio",
"command": "dotnet",
"args": [
"run",
"--project",
"<path to project directory>\\TodoMCPServer.csproj"
]
}
}
}
Usage with Claude Desktop:
- Locate Claude config:
~/Library/Application Support/Claude/claude_desktop_config.json(macOS) or%APPDATA%\Claude\claude_desktop_config.json(Windows) - Update configuration with existing settings shown above. Make sure to provide full path to
TodoMCPServer.csproj - Restart Claude Desktop
- Use natural language like "Show me all my todos" or "Create a new todo for meeting tomorrow"
Claude Desktop response to Todo MCP

Gemini Code Assist Configuration
** Transport type: stdio only **
.gemini\settings.json
{
"mcpServers": {
"TodoMcpHttpServer": {
"type": "stdio",
"command": "dotnet",
"args": ["run", "--project", "ToDoMCPServer.csproj"]
}
}
}
Usage with Gemini Code Assist:
- Open VS Code > Gemini Code Assist chat window
- Enter /mcp
- Open command palette (
Ctrl + Shift + P) and selectDeveloper: Reload Windowsoption. - Gemini Code Assist will show MCP servers from settings.json. 11 tools will be shown in this case
Gemini Code Assists responses to Todo MCP

Configuration Comparison
| AI MCP Tool | Config Location | Key Properties | Notes |
|---|---|---|---|
| VS Code:GitHub Copilot | Project > .vscode\mcp.json | type,command, argsor http, url | supports both stdio or http transport |
| Claude Desktop | Claude Desktop Config | type,command, args | supports stdio transport only |
| VS Code: Gemini Code Assist | Project > .gemini\settings.json | type,command, args | supports stdio transport only |
Testing MCP Tools
- Start the server:
dotnet runordotnet watch - Connect a client using one of the configs above
- Test with natural language:
- "get all todos"
- "Create a todo for fixing the bug report"
- "Mark todo #3 as complete"
Testing using MCP Inspector
- Testing with MCP Inspector
- Use MCP Inspector to test MCP tools directly by sending requests and viewing responses.
- Configure MCP Inspector to connect to the TodoMCPServer using HTTP or stdio transport as per your setup.
- Run MCP Inspector and connect to the Todo MCP server
- Open PowerShell or terminal and run
npx -y @modelcontextprotocol/inspectorcommand, see below examples for http and stdio transport - This should open MCP Inspector UI in browser
- Configure connection to Todo MCP server using HTTP or stdio transport shown in images below
- Open PowerShell or terminal and run
Testing using MCP Inspector - HTTP
MCP Inspector Command for
HTTPtransport:For http transport use:
http://localhost:5000/api/mcp, you must start the server first usingdotnet runcommand.
npx -y @modelcontextprotocol/inspector http http://localhost:5000/api/mcp

Testing using MCP Inspector - STDIO
MCP Inspector Command for
STDIOtransport:For stdio transport: click
Connectbutton from MCP Inspector UI, no need to start the server first as stdio transport will start the server process.
npx -y @modelcontextprotocol/inspector stdio "dotnet run --project ToDoMCPServer.csproj"

Deploy to Azure App Service
Option A: Using Azure CLI
- Login:
az login - Create resource group:
az group create --name TodoMcpRG --location eastus - Deploy App Service:
az webapp up --runtime "DOTNET|10.0" --sku B1 \ --name TodoMcpServerApp --resource-group TodoMcpRG
This command builds, publishes, and deploys your app.
Option B: Using Visual Studio
- Configure Publish Profile in Visual Studio.
- Right‑click project → Publish → Azure App Service (Windows/Linux).
- Select subscription, resource group, and App Service plan.
- Publish.
Test Todo REST API in Azure
- REST:
curl https://TodoMcpServerApp.azurewebsites.net/todos - MCP tools:
get_todos→ returns itemsadd_todo→ adds new item
Secure Your Endpoint (Optional)
Add JWT/OAuth authentication:
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
options.Authority = "https://login.microsoftonline.com/<tenant-id>/v2.0";
options.Audience = "<app-client-id>";
});
builder.Services.AddAuthorization();
app.MapMcp("api/mcp").RequireAuthorization();
Then configure Azure AD App Registration for your server.
Monitor & Scale
- Enable Application Insights for logging MCP requests.
- Configure autoscaling in App Service Plan for load handling.
End to end flow diagram
flowchart TD
subgraph "MCP Clients Ecosystem"
A[Claude Desktop]
B[VS Code with MCP]
C[Cursor IDE]
D[Gemini Code Assist]
E[Custom MCP Client]
end
subgraph "Azure App Service Deployment"
F[Azure App Service<br/>TodoMCPServer]
G[Web API Layer<br/>ASP.NET Core 10]
H[MCP Server Layer<br/>Stdio Protocol]
I[Business Logic<br/>TodoTools.cs]
J[Data Access<br/>Entity Framework]
subgraph "Database Options"
K1[Azure SQL Database]
K2[Cosmos DB]
K3[In-Memory<br/>Dev/Test]
end
L[Azure Key Vault<br/>Secrets Management]
M[Application Insights<br/>Monitoring]
N[Azure Monitor<br/>Logging & Alerts]
end
subgraph "Development & CI/CD"
O[GitHub Repository]
P[GitHub Actions<br/>CI/CD Pipeline]
Q[Azure Container Registry]
R[Docker Container]
end
%% Client Connections
A -->|STDIO Protocol<br/>over SSH/WebSocket| F
B -->|STDIO Protocol<br/>VS Code Extension| F
C -->|STDIO Protocol<br/>Integrated Client| F
D -->|STDIO Protocol<br/>Google Extension| F
E -->|Custom MCP Protocol| F
%% Internal Azure Flow
F --> G
F --> H
G --> I
H --> I
I --> J
J --> K1
J --> K2
J --> K3
%% Security & Monitoring
F --> L
F --> M
M --> N
%% Deployment Flow
O --> P
P --> Q
Q --> R
R --> F
%% External Services
S[Azure Active Directory<br/>Authentication]
T[Azure API Management<br/>Optional Gateway]
U[Azure Front Door<br/>CDN & WAF]
S --> F
T --> F
U --> F
Client communication flow
sequenceDiagram
participant C as MCP Client (Claude/VS Code)
participant APIM as Azure API Management (Optional)
participant AS as App Service
participant MCP as MCP Server
participant API as Web API
participant DB as Azure SQL
Note over C,DB: Initial Connection
C->>APIM: MCP Handshake Request
APIM->>AS: Forward Request
AS->>MCP: Initialize MCP Server
MCP-->>AS: Server Ready
AS-->>APIM: Handshake Response
APIM-->>C: Connection Established
Note over C,DB: Tool Execution Flow
C->>APIM: Tool Request (e.g., get_all_todos)
APIM->>AS: Forward with Auth
AS->>MCP: Parse & Validate Request
MCP->>API: Call Internal API
API->>DB: Database Query
DB-->>API: Results
API-->>MCP: Formatted Data
MCP-->>AS: MCP-formatted Response
AS-->>APIM: Response
APIM-->>C: Final Result
Project Structure
TodoMCPServer/
├── .gemini/ # gemini Code Assist configuration folder
│ └── settings.json # config for Gemini Code Assist (MCP)
├── .vscode/ # VS Code configuration (MCP + editor settings)
│ └── mcp.json # MCP configuration for Visual Studio GitHub Copilot
├── ClaudeDesktopConfig/ # Cache folder of Claude Desktop config (MCP)
│ └── claude_desktop_config.json # MCP configuration for Claude Desktop
├── Properties/ # project properties (auto-generated by .NET)
│ └── … # (typically AssemblyInfo, launchSettings, etc.)
├── images/ # static image assets (if any)
│ └── … # (files here)
├── Program.cs # main entry point (ASP.NET minimal API + MCP setup)
├── Readme.md # project README / documentation
├── ToDo.cs # model/entity class (Todo item)
├── ToDoDb.cs # EF Core in-memory DB context
├── TodoItemDTO.cs # Data Transfer Object for Todo (for API / MCP)
├── TodoMCPServer.csproj # .NET project file
├── TodoMCPServer.sln # Solution file
├── TodoMCPServer.http # HTTP request collection (e.g. for testing via REST)
├── TodoService.cs # REST minimal api endpoints + MCP Tools for Todo operations logic
├── appsettings.json # general configuration file
├── appsettings.Development.json # development-specific configuration
└── .mcp.json # MCP configuration for Visual Studio 2026 GitHub Copilot (placed at solution root or user profile root)
Troubleshooting MCP Connections
- Server not starting: Ensure .NET 10 SDK is installed
- Connection refused: Check if port 5000 is available
- Tools not appearing: Verify config file syntax and paths
- Permission issues: Ensure execute permissions on the project
- Database empty: The in-memory DB resets on restart; seed data may be needed
Security Notes
- Development Only: In-memory database resets on application restart
- No Authentication: Configure authentication for production use
- Local Network: By default runs on localhost; update for network access
- Input Validation: Ensure all inputs are validated in production
References
- Model Context Protocol (MCP)
- Microsoft partners with Anthropic to create official C# SDK for Model Context Protocol
- Create a minimal MCP server using C# and publish to NuGet
- MCP Servers in Visual Studio
- MCP Servers in VS Code
- Claude Desktop MCP Configuration
- Gemini Code Assist MCP Configuration
- C# SDK Samples: MCP
- DevBlogs: Build a Model Context Protocol (MCP) server in C#
- Building a Sports-Themed MCP Server using .NET
- Azure App Service: Tutorial - AI Model Context Protocol Server (.NET)
- Connect to a Model Context Protocol Server Endpoint in Foundry Agent Service (Preview) - Microsoft Foundry
- How to use MCP Inspector