Constructing an MCP server requires specific tooling to handle the JSON-RPC communication and transport layers effectively. While the protocol is language-agnostic, the official Software Development Kits (SDKs) abstract much of the low-level serialization and connection management logic. This section guides you through configuring a development environment capable of running, inspecting, and debugging MCP servers.We will focus on setting up the mcp Python package and the TypeScript SDK, along with the MCP Inspector. The Inspector is a critical component of the workflow; it acts as a surrogate client, allowing you to test your server's resources and tools within a web interface before integrating with a production client like Claude Desktop.The Development LifecycleBefore installing packages, it is helpful to visualize how the components in your local environment interact. Unlike standard web development where you might use curl or Postman against a running HTTP server, MCP servers often communicate over standard input/output (stdio). This requires a host process to spawn the server and manage the input and output streams.The MCP Inspector fills the role of this host during development. It sits between your browser and your server script, translating UI actions into JSON-RPC messages sent over stdio.digraph G { rankdir=TB; node [fontname="Sans-Serif", shape=box, style=filled, color="#dee2e6", fillcolor="#f8f9fa"]; edge [fontname="Sans-Serif", fontsize=10]; subgraph cluster_browser { label = "Web Browser"; style = filled; color = "#e9ecef"; UI [label="Inspector UI\n(http://localhost:5173)", fillcolor="#a5d8ff", color="#1c7ed6"]; } subgraph cluster_host { label = "Terminal / Host Process"; style = filled; color = "#e9ecef"; InspectorProxy [label="MCP Inspector CLI\n(Node.js Process)", fillcolor="#b2f2bb", color="#2f9e44"]; ServerScript [label="Your MCP Server\n(Python/TS Script)", fillcolor="#ffc9c9", color="#e03131"]; } UI -> InspectorProxy [label="WebSockets"]; InspectorProxy -> ServerScript [label="stdin (JSON-RPC Request)", color="#495057"]; ServerScript -> InspectorProxy [label="stdout (JSON-RPC Response)", color="#495057"]; ServerScript -> InspectorProxy [label="stderr (Logs)", style=dashed, color="#868e96"]; }The development data flow showing how the Inspector mediates communication between the browser interface and the local server process via standard streams.PrerequisitesEnsure your system meets the following baselines:Python: Version 3.10 or higher is recommended for the Python SDK.Node.js: Version 18 or higher. Even if you develop primarily in Python, the MCP Inspector is a Node.js application and requires npm or npx to run.Installing the MCP InspectorThe Inspector is a global tool used to verify that your server implements the protocol correctly. It visualizes the resources, prompts, and tools your server exposes.To install the Inspector globally using npm:npm install -g @modelcontextprotocol/inspectorYou can verify the installation by running mcp-inspector --version or simply checking that npx @modelcontextprotocol/inspector executes without error. We will use this tool extensively in later chapters to debug connection lifecycles.Python Environment ConfigurationFor Python-based servers, we recommend isolating dependencies in a virtual environment. This prevents conflicts with system packages and mimics a production deployment container.Create a Project Directory Organize your workspace. Create a directory that will house your server code.mkdir mcp-server-quickstart cd mcp-server-quickstartInitialize Virtual Environment Use the built-in venv module to create an isolated environment.# On macOS/Linux python3 -m venv .venv source .venv/bin/activate # On Windows python -m venv .venv .venv\Scripts\activateInstall the MCP SDK Install the core library. This package includes the server primitives and the stdio transport layer.pip install mcpIf you intend to use uv for faster package management (common in the modern Python data stack), you can alternatively run uv pip install mcp.TypeScript Environment ConfigurationIf you prefer TypeScript, the setup involves initializing a Node.js project. The TypeScript SDK is modular, separating the core protocol from specific transport implementations.Initialize Projectmkdir mcp-ts-server cd mcp-ts-server npm init -yInstall Dependencies You need the SDK and the Type definitions.npm install @modelcontextprotocol/sdk zod npm install --save-dev typescript @types/node tsxWe include zod here as it is the standard schema validation library used within the MCP TypeScript ecosystem for defining tool inputs. tsx is included to execute TypeScript files directly during development without a separate build step.Configure TypeScript Generate a tsconfig.json to handle module resolution.npx tsc --initEnsure your tsconfig.json is configured for NodeNext module resolution to support modern ESM imports, which the MCP SDK utilizes.{ "compilerOptions": { "target": "ES2022", "module": "NodeNext", "moduleResolution": "NodeNext", "outDir": "./dist", "rootDir": "./src", "strict": true } }Verifying the InstallationTo confirm that your environment is correctly configured, create a minimal "Hello World" script that initializes a server instance. This does not yet expose data, but it confirms the library is importable and the interpreter works.Python Verification (check_env.py):from mcp.server import Server from mcp.server.stdio import StdioServerTransport def main(): # Initialize a server with a name and version server = Server("test-server") print(f"MCP SDK Version verified. Server object created: {server.name}") if __name__ == "__main__": main()Run this with python check_env.py. If it prints the success message without raising an ImportError, your Python environment is ready.Integration with Claude Desktop (Optional)While the Inspector is the primary tool for development, you may eventually want to test against the Claude Desktop application. Claude Desktop reads a configuration file to locate local MCP servers.Locate the configuration file based on your operating system:macOS: ~/Library/Application Support/Claude/claude_desktop_config.jsonWindows: %APPDATA%\Claude\claude_desktop_config.jsonYou do not need to edit this file yet. In Chapter 4, we will modify this JSON structure to register the servers you build in the upcoming chapters.Troubleshooting Common Setup IssuesStdio Buffering When running Python scripts over stdio, output buffering can sometimes cause JSON-RPC messages to hang. The MCP SDK handles this internally, but if you are writing custom wrappers, ensure you run Python with the -u (unbuffered) flag or set the environment variable PYTHONUNBUFFERED=1.Port Conflicts The MCP Inspector defaults to port 5173. If this port is in use, you can specify a different port using the --port argument when launching the inspector command.With the SDKs installed and the Inspector ready, your environment is prepared to define Resources and Prompts. In the next chapter, we will write the code to expose a local file system to an LLM, transforming static files into accessible context.