If you have been wondering how to build MCP server projects that do more than return a string, this tutorial is for you. We will build StudyOps, a complete Model Context Protocol (MCP) server in Python using the official MCP Python SDK. It manages a student’s study notes and shows the three features everyone started talking about this week: Skills over MCP (ship SKILL.md playbooks with your server), Tasks (run slow work in the background) and Elicitation (ask the user to confirm before anything is deleted). The full source code, with 52 passing pytest tests, is free on GitHub.
This project is a good fit for BTech, MCA and MTech students who want a modern final-year or mini project that they can actually explain in a viva. You only need basic Python and a terminal. No paid API key is needed.
Table of Contents
What You Will Build: A Python MCP Server With Skills, Tasks and Elicitation
MCP is an open standard that lets AI apps such as Claude, Claude Code, VS Code or Google Antigravity talk to outside tools and data. An MCP server exposes those tools. The AI app (the client) discovers them and calls them when the user asks for something. Understanding this client and server split is the first thing to learn about how to build MCP server software.
Our server, StudyOps, keeps a student’s notes (DBMS, Operating Systems, Computer Networks and so on). Here is what it can do:
- 12 tools: add, list, search and read notes, a skills catalogue, an audit log, two destructive tools (
delete_note,clear_subject) and four task tools. - 3 skills:
safe-notes-cleanup,weekly-study-reportandviva-prep. Each is a SKILL.md playbook that tells the AI how to use the tools safely. - A background task:
start_study_reportreturns a task ID at once. The report (key terms, revision minutes, a day-by-day plan) is built in the background, and the client polls it withtasks/get. - Elicitation forms: before deleting anything, the server pauses and shows the user a form. The note is deleted only if the user types the exact title and ticks “understood”.
- An audit log: every delete attempt (deleted, declined, cancelled or mismatched) is written to a JSONL file.

Why Learning How to Build MCP Server Features Matters Now
On 24 November 2026, Anthropic announced that MCP servers can now ship skills, run tasks, and more with Claude. Skills over MCP went into public beta in Claude and Claude Code, and Tasks and Elicitation became generally available. Anthropic gives real examples of Elicitation in production: Supabase confirms costs before creating a paid project and before running destructive SQL, Railway asks before removing a service, and GitHub makes users type a repository’s name before an agent deletes it. Our delete_note tool copies exactly that GitHub pattern.
The same post says MCP now sees over 700 million monthly SDK downloads and that there are over 10,000 MCP connectors for Claude. The New Stack (24 Nov 2026) adds context from the MCP maintainers: these features are extensions, not part of the core protocol, so a server that supports them works in any compatible client, not only Claude. It also notes that the July 2026 spec deprecated sampling, which is why our server does not use it.
Google moved in the same direction. On 24 November 2026, Google made the Google Workspace MCP servers and the Workspace CLI generally available, with admin rules that make users confirm sensitive actions (human-in-the-loop) and audit logs that record agent actions and user confirmations. From 1 February 2027, AI agents must use the Workspace MCP servers or CLI instead of calling Workspace REST APIs directly.
So the skills recruiters and examiners will ask about are clear: build an MCP server, ship guidance with it, handle long jobs without blocking, and never let an agent delete data without a human saying yes. This project covers all four.
Features, Tech Stack and Prerequisites
| Item | Details |
|---|---|
| Language | Python 3.10 or newer (tested on 3.10, 3.12 and 3.13) |
| MCP library | Official MCP Python SDK, mcp 2.3 (MCPServer, Resolve, Elicit, Extension) |
| Transports | stdio (desktop apps, IDEs) and Streamable HTTP |
| Storage | JSON file for notes, JSONL file for the audit log (no database) |
| Testing | pytest + pytest-asyncio, 52 tests, GitHub Actions CI |
| OS | Windows, macOS or Linux |
| Cost | Free. No API key needed to run the server, demo or tests |
You should know Python functions, type hints and a little async/await. If you have never used type hints, read the code slowly: the SDK builds each tool’s JSON schema from them.
Project File Structure
MCP-Server-Skills-Tasks-Elicitation-Python/
├── studyops_mcp/
│ ├── __main__.py # CLI: python -m studyops_mcp [--transport streamable-http]
│ ├── server.py # MCPServer, the 12 tools, elicitation forms
│ ├── skills.py # Skills over MCP: skills/list, skills/get, skill:// resources
│ ├── tasks.py # TaskManager + Tasks extension: tasks/get, tasks/cancel
│ ├── report.py # the slow job: weekly study report
│ ├── store.py # JSON note store (thread-safe)
│ └── audit.py # JSONL audit log
├── skills/
│ ├── safe-notes-cleanup/SKILL.md
│ ├── weekly-study-report/SKILL.md
│ │ └── references/report-format.md
│ └── viva-prep/SKILL.md
├── examples/
│ ├── demo_client.py # walks through every feature
│ └── mcp-client-config.json # sample client config
├── tests/ # 52 pytest tests
├── .github/workflows/tests.yml
├── pyproject.toml requirements.txt requirements-dev.txt
└── README.md LICENSE
How to Build MCP Server in Python: Step-by-Step
Follow the steps in order. Each one adds one idea, and you can run the tests after every step. This is the same order we recommend whenever someone asks how to build MCP server projects from scratch.
Step 1: Set Up the Project
git clone https://github.com/GetProjectsIdea/MCP-Server-Skills-Tasks-Elicitation-Python.git
cd MCP-Server-Skills-Tasks-Elicitation-Python
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements-dev.txt
One important note before you copy old tutorials: version 2 of the SDK renamed FastMCP to MCPServer. If you write from mcp.server.fastmcp import FastMCP with mcp 2.x, you get a ModuleNotFoundError that points to the v2 migration guide. Use from mcp.server.mcpserver import MCPServer instead.
Step 2: Create the Server and Your First Tools
A tool is just a Python function with a decorator. The docstring becomes the description the AI reads, and the type hints become the input schema. We also add annotations so the client knows which tools only read data:
mcp = MCPServer(
"studyops",
title="StudyOps MCP Server",
version=__version__,
instructions=INSTRUCTIONS,
extensions=[skills_ext, TasksExtension(tasks)],
)
for resource in skills_ext.resources_to_register():
mcp.add_resource(resource)
# handy handles for tests and the demo client
mcp.studyops = {"store": store, "audit": audit, "tasks": tasks, "skills": skills_ext} # type: ignore[attr-defined]
# ------------------------------------------------------------------ read-only tools
ro = types.ToolAnnotations(read_only_hint=True, destructive_hint=False, open_world_hint=False)
@mcp.tool(annotations=types.ToolAnnotations(destructive_hint=False, open_world_hint=False))
def add_note(title: str, subject: str, body: str, tags: list[str] | None = None) -> dict[str, Any]:
"""Save a study note under a subject (for example 'DBMS' or 'Operating Systems')."""
note = store.add(title, subject, body, tags)
return {"saved": note.title, "subject": note.subject, "tags": note.tags}
@mcp.tool(annotations=ro)
def list_notes(subject: str | None = None) -> dict[str, Any]:
"""List note titles, optionally for one subject, with per-subject counts."""
notes = store.list(subject)
return {"count": len(notes), "subjects": store.subjects(), "notes": [{"title": n.title, "subject": n.subject, "tags": n.tags} for n in notes]}
@mcp.tool(annotations=ro)
def search_notes(query: str, limit: int = 5) -> dict[str, Any]:
"""Keyword search over titles, subjects, tags and note text."""
hits = store.search(query, max(1, min(limit, 20)))
return {"query": query, "hits": [{"title": n.title, "subject": n.subject, "snippet": n.body[:160]} for n in hits]}
@mcp.tool(annotations=ro)
def read_note(title: str) -> dict[str, Any]:
"""Read one note in full."""
try:
return store.get(title).to_dict()
except NoteNotFound:
raise ValueError(f"no note called {title!r}") from None
@mcp.tool(annotations=ro)
def skills_catalog() -> dict[str, Any]:
"""List the SKILL.md playbooks this server ships (fallback for clients without Skills over MCP)."""
return {"skills": [{"name": s.name, "description": s.frontmatter["description"], "uri": s.uri} for s in skills_ext.skills.values()]}
Notice the instructions string. Clients show it to the model when it connects, and ours points the model to the skills it should read first.
Step 3: Ship Skills Over MCP (SKILL.md Playbooks)
Tool descriptions say what a tool does. A skill says how to do a multi-step job well. A skill is a folder with a SKILL.md file: YAML frontmatter with a name and description, then plain Markdown steps. Here is our cleanup skill:
---
name: safe-notes-cleanup
description: Clean up old or duplicate study notes safely. Use before calling delete_note or clear_subject.
---
# Safe notes cleanup
Deleting notes cannot be undone, so follow these steps in order.
1. Call `list_notes` (optionally with a subject) and show the user what exists.
2. Find candidates: duplicate titles, empty notes, or notes the user named.
Use `search_notes` to check for near-duplicates before suggesting a delete.
3. Ask the user which notes to remove. Never pick them on your own.
4. Delete one note at a time with `delete_note`. The server shows the user a
confirmation form; the user must type the exact title and tick "understood".
5. For a whole subject use `clear_subject`. The form asks for the subject name
**and** the number of notes, so tell the user the count first.
6. If the result says `declined`, `cancel` or `confirmation did not match`,
stop. Do not retry the same delete without asking the user again.
7. Finish by calling `audit_log` and summarising what was deleted.
Never try to bypass the confirmation form, and never fill it in for the user.
The convention (SEP-2640) serves every file in the skill folder as an ordinary MCP resource under a skill:// URI, and adds two methods: skills/list returns every skill with a manifest of its files (URI, SHA-256 digest and size), and skills/get returns one skill. The SDK documentation describes a built-in Skills helper, but the mcp 2.3.0 release on PyPI does not include a skills module yet. So we build it ourselves on the SDK’s public Extension API, which takes about 40 lines:
class SkillsExtension(Extension):
"""Advertise ``io.modelcontextprotocol/skills`` and serve skills/list + skills/get."""
identifier = SKILLS_EXTENSION_ID
def __init__(self, skills: list[Skill]) -> None:
names = [s.name for s in skills]
if len(names) != len(set(names)):
raise SkillError("duplicate skill names")
self.skills = {s.uri: s for s in skills}
def resources_to_register(self) -> list[TextResource]:
return [
TextResource(uri=f.uri, name=f"{s.name}/{f.rel_path}", mime_type=f.mime_type, text=f.text,
description=s.frontmatter["description"] if f.rel_path == "SKILL.md" else None)
for s in self.skills.values() for f in s.files
]
def methods(self) -> list[MethodBinding]:
async def list_skills(ctx: Any, params: SkillParams) -> SkillsResult:
return SkillsResult(skills=[s.to_wire() for s in self.skills.values()])
async def get_skill(ctx: Any, params: SkillParams) -> SkillsResult:
skill = self.skills.get(params.uri or "")
if skill is None:
raise MCPError(code=types.INVALID_PARAMS, message=f"unknown skill: {params.uri}")
return SkillsResult(skill=skill.to_wire())
return [
MethodBinding(method="skills/list", params_type=SkillParams, handler=list_skills),
MethodBinding(method="skills/get", params_type=SkillParams, handler=get_skill),
]
The server then registers each file as a TextResource, so resources/read skill://safe-notes-cleanup/SKILL.md works in every client. On the 2026-07-28 protocol the SDK also advertises io.modelcontextprotocol/skills under capabilities.extensions. For older clients we added a plain skills_catalog tool as a fallback.

The loader also checks that the folder name matches the name field, that names are lowercase-hyphen-case, and that hidden files such as .env are never served.
Step 4: Run Slow Work as Background Tasks
Some jobs take time: parsing many PDFs, calling an LLM for each subject, or indexing a large folder. If a tool blocks for a minute, the agent is stuck. With Tasks, the tool returns a task handle straight away, the work runs in the background, and the client checks back later.
Our TaskManager runs jobs in a thread pool and tracks status (working, then completed, failed or cancelled), progress, a TTL and a suggested pollInterval, following the MCP task lifecycle. The SDK’s own what’s new page says it does not implement the new Tasks extension (SEP-2663) yet, and the work is tracked in issue #2806. So, like skills, we add tasks/get and tasks/cancel through an Extension:
class TasksExtension(Extension):
"""Advertise ``io.modelcontextprotocol/tasks`` and serve tasks/get + tasks/cancel."""
identifier = TASKS_EXTENSION_ID
def __init__(self, manager: TaskManager) -> None:
self.manager = manager
def methods(self) -> list[MethodBinding]:
async def get(ctx: Any, params: TaskParams) -> TaskResult:
try:
return TaskResult(task=self.manager.get(params.taskId).to_wire())
except KeyError as exc:
raise MCPError(code=types.INVALID_PARAMS, message=str(exc.args[0])) from None
async def cancel(ctx: Any, params: TaskParams) -> TaskResult:
try:
return TaskResult(task=self.manager.cancel(params.taskId).to_wire())
except KeyError as exc:
raise MCPError(code=types.INVALID_PARAMS, message=str(exc.args[0])) from None
return [
MethodBinding(method="tasks/get", params_type=TaskParams, handler=get),
MethodBinding(method="tasks/cancel", params_type=TaskParams, handler=cancel),
]
The tool that starts the job is tiny. The job itself receives a reporter so it can report progress and stop early if the user cancels:
@mcp.tool(annotations=types.ToolAnnotations(read_only_hint=True, open_world_hint=False))
def start_study_report(subject: str | None = None) -> dict[str, Any]:
"""Start building a weekly study report in the background. Returns a task handle immediately."""
record = tasks.submit("study_report", lambda rep: build_report(store, rep, subject, report_step_delay))
return {"task": record.to_wire(), "next": "poll with tasks/get or the get_task tool"}

For clients that do not know the Tasks extension yet, the same data is available through the normal tools get_task, cancel_task and list_tasks. Keep that fallback in your own servers too.
Step 5: Ask for Confirmation With Elicitation Before Destructive Tools
This is the most important step. Elicitation lets a server pause in the middle of a tool call and ask the user for input through a form. We use it as a safety gate. First, define the form as a small Pydantic model. The MCP spec only allows flat forms with simple fields (text, number, boolean, enum):
class ConfirmDelete(BaseModel):
"""Form shown to the user before one note is deleted."""
type_title: str = Field(description="Type the exact title of the note to delete it")
understood: bool = Field(default=False, description="I understand the note cannot be recovered")
Next, write a resolver that returns an Elicit request, and attach it to the tool parameter with Resolve:
def ask_delete(title: str) -> Elicit[ConfirmDelete] | None:
if not store.exists(title):
return None # nothing to confirm; the tool reports "not found"
note = store.get(title)
return Elicit(
f"Delete the note '{note.title}' ({note.subject}, {len(note.body.split())} words)? "
"This cannot be undone. Type the title to confirm.",
ConfirmDelete,
)
@mcp.tool(annotations=types.ToolAnnotations(destructive_hint=True, idempotent_hint=False, open_world_hint=False))
def delete_note(
title: str,
confirmation: Annotated[ElicitationResult[ConfirmDelete], Resolve(ask_delete)],
) -> dict[str, Any]:
"""Delete one note. The user must confirm through an elicitation form first."""
# A resolver that returns a plain value (here None: no such note) arrives as "accepted" with that data.
if isinstance(confirmation, AcceptedElicitation) and confirmation.data is None:
audit.record("delete_note", "not_found", title=title)
return {"deleted": False, "reason": f"no note called {title!r}"}
if not isinstance(confirmation, AcceptedElicitation):
audit.record("delete_note", confirmation.action, title=title)
return {"deleted": False, "reason": f"user chose {confirmation.action}"}
form = confirmation.data
if not _same(form.type_title, title) or not form.understood:
audit.record("delete_note", "confirmation_mismatch", title=title, typed=form.type_title, understood=form.understood)
return {"deleted": False, "reason": "confirmation did not match: type the exact title and tick 'understood'"}
note = store.delete(title)
audit.record("delete_note", "deleted", title=note.title, subject=note.subject)
return {"deleted": True, "title": note.title}
Why a resolver instead of calling ctx.elicit() inside the tool? Because MCP now has two protocol versions in use. On 2025-11-25 the server sends a separate elicitation/create request in the middle of the call. On 2026-07-28 the server returns an InputRequiredResult and the client retries the call with the user’s answers. A plain ctx.elicit() worked on the old version but raised NoBackChannelError on the new one in our tests. A Resolve(...) parameter works on both, and the SDK hides the confirmation parameter from the tool’s input schema, so the AI cannot fill it in itself.
Inside the tool we treat everything except an exact, accepted answer as “do not delete”. The elicitation spec defines three actions (accept, decline, cancel), and we audit all of them:

Two more safety details: delete_note and clear_subject carry destructiveHint=true, and clear_subject also asks the user to type the number of notes that will be deleted, so an accidental “yes” is much harder.
Step 6: Run the Server and Connect a Client
# see everything working, no AI app needed
python examples/demo_client.py
python examples/demo_client.py --legacy # same demo on protocol 2025-11-25
# run for a real client
python -m studyops_mcp # stdio
python -m studyops_mcp --transport streamable-http --port 8000 # http://127.0.0.1:8000/mcp
To add it to Claude Code, run claude mcp add studyops -- python -m studyops_mcp from the project folder. For Claude Desktop or an IDE, copy examples/mcp-client-config.json and set cwd to the project folder. Notes are saved in ~/.studyops/.
Installation, Running and Testing
Testing is the part of how to build MCP server projects that most tutorials skip, so this repo treats it as a first-class feature. Run the full test suite with one command:
python -m pytest -q
The 52 tests cover the note store, skill loading and validation, skills/list and skills/get, task progress, failure and cancellation, every elicitation outcome (accept, decline, cancel, wrong title, unticked box, wrong count), a client without elicitation support, and end-to-end runs over stdio and Streamable HTTP. Most protocol tests run twice, once on 2025-11-25 and once on 2026-07-28.

The repo’s GitHub Actions workflow runs the same tests on Python 3.10, 3.12 and 3.13 on every push, and the first runs passed.
Common Errors When You Build an MCP Server (and Fixes)
| Error | Cause | Fix |
|---|---|---|
No module named 'mcp.server.fastmcp' | Old v1 tutorial code with mcp 2.x | Use from mcp.server.mcpserver import MCPServer |
InvalidSignature: Unable to evaluate type annotations | from __future__ import annotations plus a resolver defined inside a function | Remove the future import from that module, or define resolvers at module level |
NoBackChannelError: Cannot send 'elicitation/create' | ctx.elicit() on the 2026-07-28 protocol | Use Annotated[..., Resolve(fn)] with an Elicit marker |
Client did not declare the form elicitation capability | The client cannot show forms | Expected: the delete is refused. Use a client with elicitation support |
| Tool blocks for minutes | Slow work inside the tool body | Return a task handle and run the work in the background |
Security Best Practices for Your MCP Server
An MCP server gives an AI agent real power over real data, so security is part of how to build MCP server software, not an extra. Design it defensively from day one:
- Confirm every destructive action with elicitation, and make the user type something specific (a title, a name, a count). A single “Yes” button is easy to click by mistake.
- Never let the model answer the form. Keep the confirmation out of the tool’s input schema, as the resolver pattern does.
- Fail closed. Decline, cancel, a mismatch or a client without elicitation support must all mean “nothing happens”.
- Audit everything, including refusals. Google’s Workspace update logs user confirmations for the same reason.
- Mark read-only tools with
readOnlyHintand risky ones withdestructiveHint, so clients can apply their own policies. - Never serve secrets: our skill loader skips hidden files, and the store validates input sizes.
- Bind HTTP to localhost (the default here) and add authentication before exposing a server on a network. For more defensive patterns, see our hardened LLM gateway and prompt injection firewall projects.
Learning Outcomes and Future Scope
After finishing this project you will know how to build MCP server code that is safe and testable, and you can explain, with working code:
- How MCP clients discover and call tools, and how type hints become JSON schemas
- How Skills over MCP package workflow knowledge next to tools, with digests for caching
- How background tasks, polling and cancellation work, and why agents need them
- How elicitation adds a human-in-the-loop step, and how it differs between protocol versions
- How to test an MCP server end to end with an in-process client, stdio and HTTP
Ideas to extend it into a bigger final-year project: store notes in SQLite or PostgreSQL; add PDF upload and summarisation with a local model through Ollama; add OAuth for the HTTP transport; swap the in-memory tasks for a persistent queue such as Redis; add URL-mode elicitation for sign-in flows; or build a small web dashboard that shows the audit log.
Viva Questions You Should Prepare
- What is the difference between an MCP tool, a resource and a skill?
- Why does a skill manifest include a SHA-256 digest and a size for each file?
- Why should a long-running tool return a task handle instead of blocking?
- What are the three elicitation actions, and how does your server treat each one?
- How does elicitation work differently on the 2025-11-25 and 2026-07-28 protocols?
- Why is the confirmation parameter hidden from the tool’s input schema?
- What do
readOnlyHintanddestructiveHinttell a client?
FAQs: How to Build MCP Server in Python
What is the easiest way to learn how to build MCP server projects in Python?
Install the official SDK with pip install mcp, create an MCPServer, and turn a few Python functions into tools with the @mcp.tool() decorator. Then add one feature at a time: resources, then skills, then tasks, then elicitation. This project follows exactly that order and has tests for every step.
Which Python version and SDK version do I need?
Python 3.10 or newer and mcp 2.3 or newer (below 3.0). The project is tested on Python 3.10, 3.12 and 3.13. If you are on mcp 1.x, the class is called FastMCP instead of MCPServer.
Do I need Claude or a paid API key to run this MCP server?
No. The demo client and all 52 tests run locally without any API key. To use the server with an AI app, connect it to any MCP client such as Claude Desktop, Claude Code, VS Code or Google Antigravity.
What happens if the MCP client does not support elicitation?
The destructive tools refuse to run. The SDK returns an error saying the client did not declare the form elicitation capability, and no note is deleted. All read-only tools keep working.
Are the Skills and Tasks parts official SDK features?
Skills over MCP and Tasks are official MCP extensions, but the mcp 2.3.0 release does not ship ready-made helpers for them. This project builds both on the SDK’s public Extension API. The task part is a small in-memory version for learning; swap it for the SDK’s own implementation when a release includes one.
Can I use this MCP server project as my final-year project?
Yes. It is MIT licensed, so you can use and extend it. Add your own features from the future scope section, and be ready to explain the code. The source is on GitHub.
Download the Source Code
The complete project (server, skills, demo client, 52 tests, CI workflow and screenshots) is on GitHub: GetProjectsIdea/MCP-Server-Skills-Tasks-Elicitation-Python. It is released under the MIT License, so you can use it for coursework, college projects and your own experiments. If you only remember one resource on how to build MCP server projects in Python, make it this repo and its tests.
Related Projects on GetProjects
- AI coding agent security scanner in Python: audit agent config files for risky settings
- Sandboxed coding agent in Python: run agent-written code safely
- Prompt injection firewall for LLM apps: filter untrusted input before it reaches a model
- Local AI coding assistant with Ollama: a free, offline coding helper
- Gemini student assistant in Python: timetable, notes and campus FAQ chatbot
- AI agent detection rules in Python: spot risky agent and MCP activity in logs
- Top 20 AI project ideas for beginners and 50 major project ideas for BTech and MCA
References
- Anthropic: MCP servers can now ship skills, run tasks, and more with Claude (24 Nov 2026)
- The New Stack: As MCP turns two, Claude gets Skills over MCP and better support for long-running tasks (24 Nov 2026)
- Google Workspace Updates: MCP servers, CLI, standardized usage tiers, and admin policies (24 Nov 2026)
- MCP Python SDK on GitHub, What’s new in v2 and Skills guide
- python-sdk issue #2806: Implement SEP-2663 Tasks Extension
- MCP specification: Elicitation and Tasks (2025-11-25)
Conclusion
You now know how to build MCP server projects in Python that go beyond simple tools: StudyOps ships its own skills, runs slow work in the background and never deletes anything without a typed confirmation from a human. These are the same patterns Anthropic, Google, Supabase and GitHub announced or described this week, and you have them in about 850 lines of Python, backed by 52 tests. Clone the repo, run the demo, then make it your own.