MCP Study Tools
๐ MCP Study Tools โ Local MCP Study Assistant
A complete checkpoint project implementing a local Model Context Protocol (MCP) server for a study assistant.
โ ๏ธ Version compatibility
This project intentionally targets the FastMCP API:
from mcp.server.fastmcp import FastMCPand pins the MCP SDK to:
mcp[cli]>=1.26,<2This avoids the MCPServer import error that occurs when code written for a
different SDK generation is mixed with a FastMCP-based installation.
The project also uses the official MCP stdio client:
from mcp import ClientSession
from mcp.client.stdio import StdioServerParameters, stdio_clientโจ Checkpoint features
Local FastMCP server: MCP Study Tools
explain_topiccreate_study_plangenerate_revision_checklistRead-only
project://course-outlineRead-only
project://statusStructured validation errors
Empty-topic protection
Topic length and character validation
Study days clamped to 1โ14
Checklist items clamped to 1โ12
MCP client using stdio
Tool discovery
Multiple MCP tool calls
Agent-style routing
Explicit tool allow-list
Failure demonstration
Security documentation
Jupyter notebook
Pytest tests
๐ Structure
mcp-study-tools/
โโโ server.py
โโโ client_test.py
โโโ requirements.txt
โโโ pyproject.toml
โโโ README.md
โโโ .gitignore
โโโ docs/
โ โโโ mcp-checkpoint-report.md
โโโ notebooks/
โ โโโ mcp_study_tools_walkthrough.ipynb
โโโ tests/
โโโ test_server.py๐ Installation on macOS/Linux
From the project folder:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txtVerify the SDK:
python -c "import mcp; print(mcp.__version__)"
python -c "from mcp.server.fastmcp import FastMCP; print('FastMCP OK')"๐งช Run the client checkpoint
python client_test.pyThe client launches server.py through the MCP stdio transport, initializes
an MCP session, discovers the three tools, calls two tools, demonstrates an
empty-input failure, and performs an agent-style routing example.
Expected discovery:
=== MCP TOOL DISCOVERY ===
[
"explain_topic",
"create_study_plan",
"generate_revision_checklist"
]๐ฅ๏ธ MCP Inspector
The CLI development command is:
mcp dev server.pyThis starts the server through the MCP development/Inspector workflow.
๐ Jupyter
Open:
notebooks/mcp_study_tools_walkthrough.ipynbIt covers:
architecture
validation
direct tool behavior
MCP client connection
tool discovery
tool calls
failure handling
agent-style routing
checkpoint verification
๐ Security
The tools are deliberately low-risk.
Input validation
Topics:
must be strings;
cannot be empty;
maximum 160 characters;
restricted to a simple human-readable character set.
Resource limits
Study days:
1..14Checklist items:
1..12Values outside these ranges are clamped.
No dangerous capabilities
The server does not:
execute shell commands;
execute arbitrary Python;
make network requests;
read secrets;
write arbitrary files;
mutate persistent application state.
Agent allow-list
Before an agent-style request is executed:
ensure_allowed(tool_name)Only the three approved learning tools may be invoked.
โ Failure demonstration
Calling:
explain_topic(" ")returns a structured error:
{
"ok": false,
"error": {
"code": "EMPTY_TOPIC",
"message": "Please provide a topic, for example 'Python functions'.",
"field": "topic"
}
}The server does not crash.
๐งช Automated tests
pytest -q๐ Official MCP references
๐ Requirement mapping
Requirement | Implementation |
Python MCP SDK |
|
FastMCP server |
|
3 required tools |
|
Read-only resource | 2 resources |
Input validation |
|
Empty topic safe error |
|
Day limit 1โ14 |
|
Client test |
|
Agent demonstration |
|
Failure documentation |
|
Jupyter |
|
Comments/documentation | All Python files |