You'll set up a complete Python environment for building MCP (Model Context Protocol) servers and ship your first working server with tools and prompts.
Environment requirements
- - Python 3.11 or higher
- - Terminal / command-line access
- - LM Studio
- Verify and configure a Python environment for MCP development
- Install the MCP SDK and all required dependencies
- Scaffold and run an MCP server from scratch
- Expose custom tools and prompts through your server
- Connect an MCP client and test your server interactively
Step 1: Verify Python Installation
MCP requires Python 3.11 or higher. Run the following in your terminal and confirm the output shows 3.11+. If you need to update, visit python.org and download the latest stable release.
Step 2: Install MCP Dependencies
Install the MCP SDK and supporting packages. Each covers a distinct concern: the SDK for the protocol, httpx for async HTTP calls, FastAPI for remote transport, and python-dotenv for environment config.
Step 3: Create Your First Server
Create server.py and instantiate a FastMCP app. At minimum you need a name and a transport — start with stdio for local testing before moving to HTTP.
Step 4: Define Tools and Prompts
Decorate Python functions to expose them as callable tools, and use prompt decorators for reusable prompt templates. Type annotations on arguments become the tool's input schema automatically.
Step 5: Configure the MCP Client
Open LM Studio, navigate to the MCP section, and add a new server entry pointing to your server file. Set the transport and provide the Python executable path. Save and restart the client.
Step 6: Test Your Server Interactively
With the client connected, invoke one of your tools from the chat interface. You should see the function execute and the result returned inline. Use the MCP inspector for lower-level debugging without a full client.
Next Mini Course
Connecting External APIs to MCP – Building a Trello Integration – Learn how to connect your MCP server to external services like Trello, create tools that interact with real APIs, handle authentication with API keys, and build intelligent workflows that let AI assistants create and manage tasks on your boards.
Further Reading
- MCP Documentation – Official MCP specification and guides
- FastMCP GitHub – FastMCP library documentation and examples
01
Overview
02
Learning Outcomes
03
Steps
04
Completion Checklist