# Getting Started\: Model Context Protocol (MCP)

Source code for the Dometrain course [Getting Started Model Context Protocol (MCP)](https://dometrain.com/course/getting-started-model-context-protocol/).

The course is organized into numbered sections. Each section builds on the previous one. The code in each folder is the final version at the end of that section.

| Section | Description |
| ------- | ----------- |
| [01-mcp-server-stdio](./01-mcp-server-stdio/) | MCP server using sdtio transport - communicates via stdin/stdout for client-launched processes. |
| [02-mcp-server-local-http](./02-mcp-server-local-http/) | MCP server using StremableHTTP transport - runs as a web server at `/mcp` on localhost:8080. |
| [03-mcp-server-todolist](./03-mcp-server-todolist/) | Todo list MCP server with tools backed by Azure Table Storage (AddTodo, GetTodoList, DeleteTodo). |
| [04-chat-agent](./04-chat-agent/) | Conversational AI chat API using the .NET Agent Framework and OpenAI (no MCP yet). |
| [05-mcp-client-localhost](./05-mcp-client-localhost/) | MCP client that connects to a localhost server and exposes MCP tools to the AI agent. |
| [06-mcp-server-authenticated](./06-mcp-server-authenticated/) | Authenticated MCP server with Azure AD (Entra ID) and JWT bearer auth. |
| [07-mcp-client-authenticated](./07-mcp-client-authenticated/) | MCP client with bearer token auth, connecting to the authenticated server. |
| [08-mcp-server-tooling-with-intent](./08-mcp-server-tooling-with-intent/) | Intent-based tooling, richer tools (CompleteTodo, SetPriority, FindTodos, etc.) designed for AI and user intent. |
| [09-mcp-server-resources](./09-mcp-server-resources/) | Adds MCP Resources to the server. |
| [10-mcp-server-for-azure](./10-mcp-server-for-azure/) | Deploying the MCP server to Azure using Docker and Azure Container Apps. |

## Prerequisites

- [.NET 10 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/10.0)

## Azure Account

Several sections use Azure services:

- **Azure Table Storage** - for todo list persistence (sections 03, 06, 08, 09, 10)
- **Azure AD (Entra ID)** - for authentication (sections 06-10)
- **Azure Container Apps** - for deployment (section 10)

To get started:

1. [Create a free Azure account](https://azure.microsoft.com/en-us/free/)
2. Follow the Azure Table Storage setup in the [03-mcp-server-todolist README](./03-mcp-server-todolist/README.md)
3. For authenticated sections, you’ll need an Entra ID app registration (instructions are in the section READMEs)

## OpenAI API Key

The MCP client sections (04, 05, 07) use the OpenAI API to power the chat agent. You will need an API key.

1. Create an account at [OpenAI](https://platform.openai.com/signup)
2. [Create an API key](https://platform.openai.com/api-keys)
3. Add it to `appsettings.json` or `.vscode/launch.json` in the relevant section (or use User Secrets / environment variable `OpenAI__ApiKey`)

## Frontend

The [frontend](./frontend/) folder contains a React chat UI that talks to the MCP Client API. **You do not build this in the course** - it is provided so you can test the MCP servers and clients you build. The frontend runs at [http://localhost:5173](http://localhost:5173) and expects the MCP Client API at `https://localhost:5001`. See the [frontend README](./frontend/README.md) for setup.

## Running the Projects

Each section has its own README with run instructions and setup. Start with the section you’re working on and follow its “Before you run” steps.
