0Pricing
MCP Academy · Lesson

Project Layout for a Server

Organize files so your server is easy to grow.

Project Layout for a Server is a free MCP Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the MCP Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Structure Sets You Up

A small server fits in one file, but a good layout lets it grow without becoming a mess. A little planning now saves real pain later. 🗂️

Start with One File

Most servers begin life as a single server.py. It holds your FastMCP instance plus a tool or two, which is plenty to get running.

pyproject.toml Is the Map

At the root sits pyproject.toml, declaring your project name and its dependencies. uv reads it to know exactly what to install.

The Lockfile Stays Put

Right beside it lives uv.lock, the pinned record of every resolved version. Commit it so teammates reproduce your exact setup.

Keep .venv Out of Git

The .venv folder is generated, not source code. Add it to .gitignore so you never commit a heavy, machine-specific environment.

.venv/
__pycache__/

Group by Primitive

As you grow, split code by what it does. Putting tools, resources, and prompts in separate modules keeps each file focused and readable.

A Typical Tree

A growing server often looks like this: a server entry point next to a folder for each kind of capability. Clear folders mean fast navigation. 🌳

my-server/
  server.py
  tools/
  resources/
  prompts/

One Entry Point

Keep a single entry point that creates the FastMCP instance and registers everything. Clients only ever need to launch this one file.

Import, Don't Inline

Define tools in their own modules, then import and register them in the entry file. Your server.py stays short and easy to scan.

from tools.math import register_math
register_math(mcp)

Add a README

A short README telling others how to install and run your server makes it shareable. Future-you will thank present-you for it.

Keep Secrets Outside

Never hardcode keys in your code. Read them from environment variables and keep a sample .env so config stays safe and portable. 🔐

Quick Check

You're deciding what to commit to version control.

A Layout That Scales

You learned to start in one file, keep pyproject.toml and the lockfile tracked, ignore .venv, and split by primitive. Your server can grow cleanly. ✅

Frequently asked questions

Is the “Project Layout for a Server” lesson free?

Yes — the full text of “Project Layout for a Server” is free to read here on the web, and the MCP Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the MCP Academy course, upgrade to CoddyKit PRO.

What will I learn in “Project Layout for a Server”?

Organize files so your server is easy to grow. You practise MCP Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start MCP Academy?

No prior experience is required. MCP Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Project Layout for a Server” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this MCP Academy lesson?

Yes. Every MCP Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Install Python & uv
  2. Add the MCP Python SDK
  3. Meet the mcp CLI
  4. Project Layout for a Server
← Back to MCP Academy