Build an MCP Server in 30 Minutes

Step-by-step tutorial on creating your first MCP server

Table of Contents

Build an MCP Server in 30 Minutes is a lesson from the MCP Masterclass course that walks through building a Python MCP server with one tool, read_note, and connecting it to Claude Desktop so Claude can read local files. It uses the same server structure found in every MCP server, from simple file readers to database connectors.

What you will be able to do

  • Set up a Python virtual environment and install the official MCP SDK with pip install mcp.
  • Write an MCP server in Python that defines a tool using @server.list_tools() and @server.call_tool().
  • Configure Claude Desktop's claude_desktop_config.json with the correct Python and script paths so it can find your server.
  • Verify a server connection in Claude Desktop's Search and tools menu before testing it.
  • Ask Claude to call your custom tool inside a real conversation and see it read a local file.

Before you start

  • Python 3.8 or newer installed (check with python3 --version).
  • A code editor such as VS Code, Cursor, or PyCharm.
  • Claude Desktop installed and signed in with a free or paid Claude account.
  • About 30 minutes and basic comfort copying code and running terminal commands.

Reference

Step Command / Setting Purpose
Create virtual env (macOS/Linux) python3 -m venv .venv then source .venv/bin/activate Isolates project dependencies
Create virtual env (Windows) py -m venv .venv then .venv\Scripts\activate Isolates project dependencies
Install SDK pip install mcp Installs the official Python MCP SDK
Verify install python check_setup.py Confirms the MCP imports load without error
Find Python path which python (macOS/Linux) or where python (Windows) Gets the path to put in the config command field
Open config Claude Desktop > profile icon > Settings > Developer tab > Edit Config Opens claude_desktop_config.json
Config keys command (full path to venv python), args (full path to server.py) Tells Claude Desktop how to launch your server
Confirm connection Message box > bottom-right Search and tools icon Shows note-reader and its read_note tool if connected

Common errors and fixes

What goes wrong The fix
pip command not found Reinstall Python from python.org and check "Add Python to PATH" during install
check_setup.py prints an ImportError Run pip install mcp again while the virtual environment is active
Windows config path uses single backslashes JSON needs double backslashes (\\) in Windows paths inside claude_desktop_config.json
read_note tool returns "File not found in the server directory" Make sure the file sits directly in the project folder and the filename you send matches it exactly
Claude Desktop doesn't show the note-reader tool after editing the config Completely quit and restart Claude Desktop, and confirm both the Python path and server.py path in the config are correct

Read the full walkthrough

The complete lesson, with screenshots and any downloads, is published on Substack as part of MCP Masterclass: Connect AI to Everything.

Read Lesson 5 on Substack →

More in this section

Continue the course

Browse all lessons in the MCP Masterclass: Connect AI to Everything course, or subscribe to the GenAI Unplugged newsletter to get new lessons in your inbox.

Dheeraj Sharma

Dheeraj Sharma

AI Systems Builder
Creator of the n8n Zero to Hero course (42 lessons, 31+ hours). I help solopreneurs build AI systems that grow revenue without growing workload.

Get the n8n Mastery Bundle

All workflows, cheat sheets, and premium resources from the entire course in one package.

Read the full lesson on Substack