Server Development in Model Context Protocol

Lessons in this section

  1. Server Architecture

    Designing MCP servers: one domain per server, modular handlers with handler, service and backend layers, atomic tools, least privilege, and explicit approval contracts for risky tools.

  2. Development Environment

    The tools for building MCP servers: the TypeScript and Python SDKs, the MCP Inspector, project structure, environment variables and secrets, pinned dependencies, and publishing to the MCP Registry.

  3. Host Configuration

    Connecting MCP servers to hosts: stdio and HTTP entries, VS Code mcp.json with inputs and dev mode, Visual Studio config locations, servers vs mcpServers, keeping secrets out, and start-up checks.

  4. Building Servers with SDKs

    Building a complete MCP server: McpServer setup, registering tools, resources and prompts, stdio and HTTP transports, the same server in Python, and testing with handler tests, the Inspector and CI.