# Creating a Python MCP Server: A Step-by-Step Guide

> A short step-by-step for scaffolding a Python MCP server with uvx — installation, virtual environment and dependencies, and what the generated project structure contains.

Source: https://chanmeng.org/blog/python-mcp-server-guide
Author: Chan Meng — https://chanmeng.org
Published: 2024-12-30
Tags: MCP

---

*Originally published on LinkedIn, 30 December 2024. Republished here with light editing.*

## Introduction

This guide will walk you through the process of creating a Python MCP (Model Control Protocol) Server from scratch using the uvx tool. We'll cover everything from initial setup to project structure.

## Prerequisites

- Python 3.12 or higher installed
- Windows PowerShell or Command Prompt
- Basic understanding of Python

---

## Step 1: Installation and Project Creation

First, navigate to your desired project directory:

```bash
cd "D:\github_repository"
```

Create a new MCP server project using the uvx command:

```
uvx create-mcp-server
```

During the creation process, you'll be prompted for:

- Project name (we used "server-google-jobs")
- Project description (optional)
- Project version (default: 0.1.0)
- Confirmation of project location

## Step 2: Virtual Environment and Dependencies

The tool automatically:

1. Creates a virtual environment in .venv directory
2. Installs necessary dependencies including: mcp==1.1.2 pydantic==2.10.4 starlette==0.45.0 httpx==0.28.1 And other required packages

To ensure all dependencies are properly installed, run:

```bash
cd server-google-jobs
uv sync --dev --all-extras
```

## Step 3: Project Structure

The generated project structure looks like this:

```
SERVER-GOOGLE-JOBS/
├── .venv/
├── Lib/
│   └── site-packages/
├── Scripts/
├── src/
│   └── server_google_jobs/
│       ├── __pycache__/
│       │   ├── __init__.cpython-312.pyc
│       │   └── server.cpython-312.pyc
│       ├── __init__.py
│       └── server.py
├── .gitignore
├── CACHEDIR.TAG
├── pyproject.toml
├── pyenv.cfg
├── .python-version
├── README.md
└── uv.lock
```

Key files and their purposes:

- src/server\_google\_jobs/server.py: Main server implementation file
- src/server\_google\_jobs/\_\_init\_\_.py: Package initialization
- pyproject.toml: Project configuration and dependencies
- .gitignore: Specifies which files Git should ignore
- README.md: Project documentation

## Notes

- The server is automatically configured for Claude.app integration if detected
- The configuration file is stored at %APPDATA%\Claude\claude\_desktop\_config.json
- The project uses Python 3.12.2 by default

## Next Steps

After setting up the project structure, you can:

1. Implement your server logic in server.py
2. Add custom routes and endpoints
3. Configure authentication if needed
4. Add tests and documentation
5. Deploy your server

## Common Issues

If you encounter the hardlink warning during installation:

```
warning: Failed to hardlink files; falling back to full copy
```

This is normal and won't affect functionality. You can suppress it by setting:

```bash
export UV_LINK_MODE=copy
```

or using the --link-mode=copy flag.

---

## Conclusion

You now have a fully configured Python MCP Server project ready for development. The structure provided gives you a solid foundation to build upon, with all necessary dependencies and configurations in place.
