MCPhigh

MCP Servers

An MCP server is a process that implements the MCP protocol and exposes tools, resources, and/or prompts. Configured in settings.json under mcpServers. Common examples: filesystem, git, GitHub, Slack, Postgres, Linear, Notion.

Memory anchor

MCP server is a phone tree extension — the agent dials in (stdio), navigates the menu (tool list), gets connected to the right department (tool handler).

Expected depth

Server config: command (executable), args (CLI args), env (env vars). The harness spawns the server at startup and connects via stdio. Tools the server exposes appear in the model's tool list, prefixed with mcp__<server-name>__<tool-name>. Resources are static or templated data the server can serve (file contents, query results). Prompts are reusable prompt templates. Server lifecycle: start → init handshake → tool/resource list → ready. Crashes get auto-restarted by some clients.

Deep — senior internals

Writing an MCP server: install @modelcontextprotocol/sdk (or the Python equivalent), implement Server class, register tools with handlers, listen on stdio. Tool handlers receive params, return content (text, images, or structured data). Common pitfalls: blocking the event loop (use async), holding state across tool calls (servers are stateful, so this works, but can leak), handling cancellation. Performance: tool descriptions added to every prompt — keep them tight. Security: validate all inputs (filesystem traversal, SQL injection in DB servers).

🎤Interview-ready answer

An MCP server is a process that exposes tools and data to AI agents over the MCP protocol. I configure them in settings.json with a command and args; the harness spawns each server at startup. Servers are stateful processes, so they can hold connections (DB pools, API clients) across calls. Writing one is straightforward with the official SDK — implement tool handlers, register them with the Server class, listen on stdio. The hard parts are description quality (model picks the right tool), input validation (servers run with user permissions), and not blocking the event loop.

Common trap

Stateful MCP servers leaking memory or file descriptors over a long session. A Postgres server holding a connection forever, a filesystem server caching directory listings — easy to write, hard to debug. Add resource limits and explicit cleanup.