Skip to content

Latest commit

 

History

History

README.md

MCP Server: Todo List

This is an MCP server that manages to-do lists.

Install

Install in VS Code Install in VS Code Insiders Install in Visual Studio

Prerequisites

What's Included

To-do List MCP server includes:

Building Block Name Description Usage
Tools add_todo_item Adds a to-do item. #add_todo_item
Tools get_todo_items Gets a list of to-do items. #get_todo_items
Tools update_todo_item Updates a to-do item. #update_todo_item
Tools complete_todo_item Completes a to-do item. #complete_todo_item
Tools delete_todo_item Deletes a to-do item. #delete_todo_item

Getting Started

Getting repository root

  1. Get the repository root.

    # bash/zsh
    REPOSITORY_ROOT=$(git rev-parse --show-toplevel)
    # PowerShell
    $REPOSITORY_ROOT = git rev-parse --show-toplevel

Running MCP server

On a local machine

  1. Run the MCP server app.

    cd $REPOSITORY_ROOT/todo-list
    dotnet run --project ./src/McpSamples.TodoList.HybridApp

    Make sure take note the absolute directory path of the McpSamples.TodoList.HybridApp project.

    Parameters:

    • --http: The switch that indicates to run this MCP server as a streamable HTTP type. When this switch is added, the MCP server URL is http://localhost:5240.

    With this parameter, you can run the MCP server like:

    dotnet run --project ./src/McpSamples.TodoList.HybridApp -- --http

In a container

  1. Build the MCP server app as a container image.

    cd $REPOSITORY_ROOT
    docker build -f Dockerfile.todo-list -t todo-list:latest .
  2. Run the MCP server app in a container.

    docker run -i --rm -p 8080:8080 todo-list:latest

    Alternatively, use the container image from the container registry.

    docker run -i --rm -p 8080:8080 ghcr.io/microsoft/mcp-dotnet-samples/todo-list:latest

    Parameters:

    • --http: The switch that indicates to run this MCP server as a streamable HTTP type. When this switch is added, the MCP server URL is http://localhost:8080.

    With this parameter, you can run the MCP server like:

    # use local container image
    docker run -i --rm -p 8080:8080 todo-list:latest --http
    # use container image from the container registry
    docker run -i --rm -p 8080:8080 ghcr.io/microsoft/mcp-dotnet-samples/todo-list:latest --http

On Azure

  1. Navigate to the directory.

    cd $REPOSITORY_ROOT/todo-list
  2. Login to Azure.

    # Login with Azure Developer CLI
    azd auth login
  3. Deploy the MCP server app to Azure.

    azd up

    While provisioning and deploying, you'll be asked to provide subscription ID, location, environment name.

  4. After the deployment is complete, get the information by running the following commands:

    • Azure Container Apps FQDN:

      azd env get-value AZURE_RESOURCE_MCP_TODO_LIST_FQDN

Connect MCP server to an MCP host/client

VS Code + Agent Mode + Local MCP server

  1. Copy mcp.json to the repository root.

    For locally running MCP server (STDIO):

    mkdir -p $REPOSITORY_ROOT/.vscode
    cp $REPOSITORY_ROOT/todo-list/.vscode/mcp.stdio.local.json \
       $REPOSITORY_ROOT/.vscode/mcp.json
    New-Item -Type Directory -Path $REPOSITORY_ROOT/.vscode -Force
    Copy-Item -Path $REPOSITORY_ROOT/todo-list/.vscode/mcp.stdio.local.json `
              -Destination $REPOSITORY_ROOT/.vscode/mcp.json -Force

    For locally running MCP server (HTTP):

    mkdir -p $REPOSITORY_ROOT/.vscode
    cp $REPOSITORY_ROOT/todo-list/.vscode/mcp.http.local.json \
       $REPOSITORY_ROOT/.vscode/mcp.json
    New-Item -Type Directory -Path $REPOSITORY_ROOT/.vscode -Force
    Copy-Item -Path $REPOSITORY_ROOT/todo-list/.vscode/mcp.http.local.json `
              -Destination $REPOSITORY_ROOT/.vscode/mcp.json -Force

    For locally running MCP server in a container (STDIO):

    mkdir -p $REPOSITORY_ROOT/.vscode
    cp $REPOSITORY_ROOT/todo-list/.vscode/mcp.stdio.container.json \
       $REPOSITORY_ROOT/.vscode/mcp.json
    New-Item -Type Directory -Path $REPOSITORY_ROOT/.vscode -Force
    Copy-Item -Path $REPOSITORY_ROOT/todo-list/.vscode/mcp.stdio.container.json `
              -Destination $REPOSITORY_ROOT/.vscode/mcp.json -Force

    For locally running MCP server in a container (HTTP):

    mkdir -p $REPOSITORY_ROOT/.vscode
    cp $REPOSITORY_ROOT/todo-list/.vscode/mcp.http.container.json \
       $REPOSITORY_ROOT/.vscode/mcp.json
    New-Item -Type Directory -Path $REPOSITORY_ROOT/.vscode -Force
    Copy-Item -Path $REPOSITORY_ROOT/todo-list/.vscode/mcp.http.container.json `
              -Destination $REPOSITORY_ROOT/.vscode/mcp.json -Force

    For remotely running MCP server in a container (HTTP):

    mkdir -p $REPOSITORY_ROOT/.vscode
    cp $REPOSITORY_ROOT/todo-list/.vscode/mcp.http.remote.json \
       $REPOSITORY_ROOT/.vscode/mcp.json
    New-Item -Type Directory -Path $REPOSITORY_ROOT/.vscode -Force
    Copy-Item -Path $REPOSITORY_ROOT/todo-list/.vscode/mcp.http.remote.json `
              -Destination $REPOSITORY_ROOT/.vscode/mcp.json -Force
  2. Open Command Palette by typing F1 or Ctrl+Shift+P on Windows or Cmd+Shift+P on Mac OS, and search MCP: List Servers.

  3. Choose todo-list then click Start Server.

  4. When prompted, enter one of the following values:

    • The absolute directory path of the McpSamples.TodoList.HybridApp project
    • The FQDN of Azure Container Apps.
  5. Enter prompts. These are just examples:

    - Show me the list to do
    - Add "meeting at 11am"
    - Complete the to-do item #1
    - Delete the to-do item #2
    
  6. Confirm the result.