TellWorldAI World Archive
Ask中文

Home›Practice›Practice

Practice

Practical MCP: building servers with the official SDKs

Survey the official MCP SDKs, then deploy a remote MCP server to Azure with azd and test it with MCP Inspector, with API Management in front for security.

Who this is for and what you will be able to do

If you already know the basics of MCP and want to build a working server that can run in the cloud, this guide is for you. By the end you will be able to tell the three core features of an MCP server apart, see what each official SDK offers, deploy a remote server to Azure step by step, and connect to it with MCP Inspector to call a tool.[1]

Three core features: resources, prompts and tools

An MCP server can implement any combination of three core features.[1]

Resources provide context and data for the user or the AI model. Examples include document repositories, knowledge bases, structured data sources and file systems.[1]

Prompts are templated messages and workflows for users. Examples include pre-defined conversation templates, guided interaction patterns and specialized dialogue structures.[1]

Tools are functions the AI model can execute. Examples include data processing utilities, external API integrations, computational capabilities and search functionality.[1]

Decide which kind of capability you need before you write code. Expose data as resources, fixed user workflows as prompts, and actions the model should take as tools. The three often appear together. A server that looks up orders might expose order data as a resource, a lookup as a tool, and a reply template as a prompt.[1]

Choosing an SDK

The official SDK list covers C#, Java with Spring, TypeScript, Python, Kotlin and Go.[1][2] Start from the language and framework your team already uses, then check whether the SDK supports the features you need. The sections below summarize each option.[1]

C#

The C# SDK is in preview, so its APIs may change. Its official samples include a basic client, a basic server, an advanced server with tool registration, authentication and error handling, ASP.NET Core integration, and several tool implementation patterns. The SDK is published on NuGet as ModelContextProtocol.[1]

Java with Spring

The Java with Spring SDK offers Spring Framework integration, strong type safety, reactive programming support and comprehensive error handling. Its repository notes that it requires a dependency on Project Reactor, so account for that when you plan the project. The sample is in the samples/java/containerapp directory.[1]

JavaScript

The JavaScript SDK supports both Node.js and browser environments. It has a promise-based API, integrates easily with Express and other frameworks, and supports WebSocket streaming.[1]

Python

The Python SDK supports async/await with asyncio, makes tool registration simple, and integrates natively with popular machine learning libraries.[1]

Check version compatibility first

SDK support for MCP 2026-07-28 rolls out independently for each SDK. Before you assume protocol compatibility, check each SDK's release notes and the package version used in the example. This matters at selection and upgrade time, because a server built against the wrong SDK version may not match the client.[1]

Deploy a remote server to Azure

The remote deployment example comes from an Azure sample repository. It builds an MCP server on Azure Functions and secures it with Azure API Management.[1][3]

Prepare

Clone the repository and change into its directory:[1]

git clone https://github.com/Azure-Samples/remote-mcp-apim-functions-python.git
cd remote-mcp-apim-functions-python

Register the Microsoft.App resource provider. With Azure CLI, run az provider register --namespace Microsoft.App --wait. With Azure PowerShell, run Register-AzResourceProvider -ProviderNamespace Microsoft.App, then check the registration state with (Get-AzResourceProvider -ProviderNamespace Microsoft.App).RegistrationState after some time.[1]

Deploy

Run azd up. It provisions the API Management service, the function app with its code, and the other Azure resources the sample needs:[1]

azd up

Test with MCP Inspector

In a new terminal window, install and run MCP Inspector:[1]

@@shell:c:npx @modelcontextprotocol/inspector@@

In the Inspector, set the transport type to SSE and set the URL to the API Management SSE endpoint printed by azd up, then click Connect. Once connected, list the tools, select one, and run it:[1]

https://<apim-servicename-from-azd-output>.azure-api.net/mcp/sse

If every step works, you are connected to the remote MCP server and have called a tool. Note that this example uses an SSE endpoint. For new remote servers, the MCP 2026-07-28 specification points to Streamable HTTP, so check both the transport and your SDK's version support.[1]

Secure the server with API Management

Azure API Management is a good way to secure an MCP server. You place an API Management instance in front of the server, and it handles rate limiting, token management, monitoring, load balancing and security.[1]

In the Azure sample, authentication and authorization use Microsoft Entra. API Management acts as a gateway and applies policies to direct and manage traffic, and Azure Monitor logs every request for later analysis.[1][3]

For the authorization details, see the MCP authorization specification, which is published for 2026-07-28 at modelcontextprotocol.io.[4]

Other Azure templates

If you would rather start from a template, Azure offers quickstart templates for remote MCP servers built on Azure Functions, in Python, C# .NET and Node/TypeScript.[1]

These templates protect the server with keys and HTTPS, support OAuth through built-in authentication and/or API Management, and allow network isolation with Azure Virtual Networks. They also support local development and debugging, and deployment to Azure with azd up. Clients can connect from VS Code's Copilot agent mode or from MCP Inspector.[1]

For large result sets, a guide to cursor-based pagination for tools, resources and large datasets.[1]

Exercise: design an MCP workflow

Pick a real problem in a domain you know. Identify three or four tools that would help solve it, draw a workflow diagram that shows how they interact, implement one of the tools in a language you prefer, and write a prompt template that helps the model use that tool.[1]

Key points

Implementing MCP solutions requires attention to security, performance and error handling. Well-designed workflows can orchestrate complex tasks with several tools, and debugging and testing are critical to reliable MCP applications.[1]

Adapted from lesson 4 of Microsoft's open-source course *MCP for Beginners*[1], released under the MIT License.

Sources

  1. 1
    Practical ImplementationMicrosoft mcp-for-beginners (MIT)
  2. 2
    MCP SDKsModel Context Protocol
  3. 3
    remote-mcp-apim-functions-pythonAzure-Samples (GitHub)
  4. 4
    MCP Authorization specificationModel Context Protocol

Cite this page: Practical MCP: building servers with the official SDKs. TellWorld, https://www.tellworld.net/practice/practice-mcp-practical-implementation. Updated 2026-11-14

Related news

View all