Your First MCP Server: A Complete Beginner’s Guide

If you’ve been exploring the Model Context Protocol (MCP) ecosystem and want to set up your first MCP server, you’re in the right place.
This guide will take you from “Zero to MCP hero” – even if you’ve never touched MCP before.

We’ll set up an MCP server, connect it to a client using MCP Inspector, and run it interactively.

🧐 What is MCP?

MCP (Model Context Protocol) is an open protocol designed to make AI model interactions more powerful, structured, and interoperable.
Think of it as a way for different AI tools, models, and resources to talk to each other in a standardized format.

With MCP, you can:

  • Create servers that expose tools and resources.
  • Build clients that consume and interact with those servers.
  • Use it in multiple environments like local development, production, or cloud.

🛠️ Tools & Technologies We’ll Use

Here’s what we’ll be working with:

  • Python 3 – To write and run our MCP server.
  • mcp – The official Python MCP SDK for building servers.
  • uv – A modern Python package/dependency manager for running MCP commands efficiently.
  • MCP Inspector – A visual client that lets you interact with MCP servers in real time.
  • Node.js – Required to run MCP Inspector via npx.

📦 Step 1: Project Setup

First, let’s create a fresh directory for our MCP server:

mkdir my-first-mcp-project
cd my-first-mcp-project

Create and activate a Python virtual environment:

python3 -m venv .venv
source .venv/bin/activate

Install the required packages:

pip install mcp
pip install uv
pip install mcp[cli]

📜 Step 2: Create Your First MCP Server

In this directory, create a file named main.py.
This will be your MCP server script.

🚀 Step 3: Run the MCP Server

Run the following command in the terminal to start your MCP server with uv in active development mode:

uv run --active mcp dev main.py

You should see something like:

📜 Step 4: Create MCP Client

Firstly, to create mcp client, we need to check node is available or not?

node -v
npx -v
npm -v

If Node is not installed, you can install it on Ubuntu using:

sudo apt-get install nodejs -y

And for Windows or MacOS, you can install it by reference

🖥 Step 5: Open MCP Inspector

Open your browser and go to:

1️⃣ Change Transport Type

On the left panel, change Transport Type to:

STDIO

2️⃣ Set the Command

Command:

uv

3️⃣ Set the Arguments

Arguments:

run --with mcp mcp run main.py

4️⃣ (Optional) Set Environment Variables

If you’re in a virtual environment, add:

VIRTUAL_ENV=/path/to/your/venv
PATH=/path/to/your/venv/bin:${PATH}

5️⃣ Make Script Executable

Run:

chmod +x /path/to/your/file/MCP/my-first-mcp-project/main.py

6️⃣ Add Proxy Session Token

Copy the MCP_PROXY_AUTH_TOKEN from your server output and paste it into the Proxy Session Token field in MCP Inspector.

Click Connect — and boom! 🎉
You’re now connected to your MCP server via the MCP Inspector client.

Here’s one snapshot of tool –

🎯 Next Steps

Let’s rock now! Show your creativity and build your own MCP server!

Now that you’ve successfully connected your MCP server and client, you can:

  • Create custom tools inside your MCP server.
  • Expose resources like files, APIs, or databases.
  • Explore more MCP clients beyond Inspector.

💡 Final Thoughts

Setting up your first MCP server might seem daunting, but once you break it down, it’s actually pretty straightforward.
With MCP Inspector, you can visually debug and test your server, making it an amazing starting point for building more advanced AI-driven tools.

If you want to dive deeper:

📂 Visit My Repo & Connect

If you want to see some of my work and explore more projects:

🔗 Repo: OpHRate on GitHub
💼 LinkedIn: Abhishek Dhondalkar
📧 Email: jainabhishek1925@gmail.com

Happy coding! 🚀

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.