MCP Python Learning Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Python Learning Serversearch for Python functions"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Servers in Python
Description
This beginner project demonstrates how to build, test and consume a local Model Context Protocol (MCP) server with Python and FastMCP.
The server exposes a small programming-topic dataset through two tools and one read-only resource. A deterministic agent-like client connects to the server through MCP, searches for a relevant topic, retrieves its complete details and creates a short study recommendation.
Completed tasks:
Task 0 — Project structure
Task 1 — MCP architecture explanation
Task 2 — Basic FastMCP server
Task 3 — Local topic dataset
Task 4 —
search_topicstoolTask 5 —
get_topic_detailstoolTask 6 — Read-only catalogue resource
Task 7 — Direct MCP server testing
Task 8 — MCP-connected agent-like client
Task 9 — Third-party MCP server review
Task 10 — Complete documentation and reflection
Project structure:
mcp-intro/
├── server/
│ ├── __init__.py
│ └── learning_server.py
├── client/
│ ├── __init__.py
│ ├── mcp_client.py
│ ├── agent.py
│ └── test_server.py
├── data/
│ └── topics.json
├── output/
│ └── sample_agent_response.md
├── README.md
├── requirements.txt
├── .env.example
└── .gitignoreRelated MCP server: agentic-patterns
MCP Architecture Summary
MCP gives an AI application a standard way to connect to external tools and data sources.
Student
↓
Agent-like application
↓
FastMCP client
↓
Programming Learning Server
↓
Tools or resource
↓
data/topics.jsonThe main parts are:
MCP host: the application that manages the overall interaction.
MCP client: the connection between the host or application and one MCP server.
MCP server: the program that publishes focused capabilities.
Tool: a callable operation that accepts input and returns a result.
Resource: readable data exposed through a stable URI.
The server should expose only the capabilities and data that the client needs.
Requirements
Python 3.10 or newer
A Python virtual environment
Packages listed in
requirements.txt
The current Python dependencies are:
fastmcp
python-dotenvSetup
cd ~/mcp-intro
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtValidate the local dataset:
python -m json.tool data/topics.json > /dev/nullCompile the Python files:
python -m py_compile \
server/learning_server.py \
client/mcp_client.py \
client/test_server.py \
client/agent.pyNo output from these validation commands means they completed successfully.
How to Run the Server
The server uses FastMCP's default stdio transport.
cd ~/mcp-intro
source .venv/bin/activate
python server/learning_server.pyThe process waits for an MCP client to communicate through standard input and output. Stop it with Ctrl+C.
Do not add ordinary debug print() calls to the server's standard output because they can interfere with stdio MCP messages.
How to Test the Server
Run the cumulative FastMCP integration test:
cd ~/mcp-intro
source .venv/bin/activate
python client/test_server.pyThe test client starts the server through stdio and verifies that:
the server responds to a ping;
both tools are listed;
search_topicsreturns a valid match;get_topic_detailsreturns a complete topic;blank and unknown inputs return understandable messages;
topics://catalogis listed and can be read;the catalogue contains five topic ids and titles.
Expected final line:
All MCP server tests passed.The server can also be inspected manually:
fastmcp dev server/learning_server.pyUseful manual inputs are:
search_topics: functions
search_topics: methods
search_topics: networking
get_topic_details: python-functions
get_topic_details: unknown-topic
resource: topics://catalogHow to Run the Agent
Run the agent-like client with a student question:
cd ~/mcp-intro
source .venv/bin/activate
python client/agent.py "I want to study Python functions. What should I review first?"It can also prompt for a question interactively:
python client/agent.pyThe agent:
receives the student's question;
connects to
server/learning_server.pythrough a FastMCP client;calls
search_topicsthrough MCP;calls
get_topic_detailsthrough MCP;formats the returned data as a student-facing answer;
saves the answer to
output/sample_agent_response.md.
It does not import the server's tool functions directly.
Available Tools
search_topics
Searches topic titles and key concepts.
Input:
{"query": "functions"}It returns up to three compact matches containing:
idtitlesummaryprerequisiteskey_concepts
A blank query or a query with no match returns a clear message.
get_topic_details
Retrieves one complete topic by its stable id.
Input:
{"topic_id": "python-functions"}A successful result contains:
idtitlesummaryprerequisiteskey_conceptscommon_mistakespractice_idea
A blank or unknown id returns a clear message.
Available Resources
topics://catalog
This read-only resource returns a JSON string containing only the available topic ids and titles.
Example:
[
{"id": "python-functions", "title": "Python Functions"},
{"id": "python-lists", "title": "Python Lists"}
]The resource reads the existing dataset and does not create, edit or delete files or topic records.
Third-Party MCP Server Review
The reviewed third-party server is the official reference Filesystem MCP Server from the modelcontextprotocol/servers repository.
Purpose: It allows an MCP client to read files, inspect directories and metadata, search files, create directories, write or edit files, and move files or directories.
Where it runs: It runs locally as a Node.js process and normally communicates through stdio. It can be started with npx or Docker.
Exposed tools: Its documented tools include file reading, directory listing, directory trees, file search, file information, directory creation, file writing, file editing, moving files and listing allowed directories. The reviewed documentation describes tools rather than MCP resources.
Permissions and credentials: It does not require an API key or personal account. It requires explicit filesystem directory access and runs with the current user's permissions inside the allowed directories.
Restricted configuration example:
{
"mcpServers": {
"filesystem-review": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/tmp/mcp-filesystem-review"
]
}
}
}Risk: Broad access could expose private files or allow important files to be overwritten, edited or moved.
Safety measure: Grant access only to a dedicated test directory containing disposable files. Never expose the complete home directory, SSH keys, browser profiles, password stores or project secrets. Prefer a read-only mount when write access is unnecessary.
Documentation reviewed:
https://github.com/modelcontextprotocol/servers/tree/main/src/filesystemhttps://modelcontextprotocol.io/docs/develop/connect-local-servers
Example Output
A real generated example is saved in output/sample_agent_response.md.
Recommended topic: Python Functions
Why it is relevant:
Functions group reusable instructions under a name so that code can be organised and called when needed.
Prerequisites:
- Variables
- Basic Python syntax
Key concepts:
- Defining functions
- Parameters and arguments
- Return values
Practice idea:
Create a function that receives two numbers and returns their total.
Common mistakes to avoid:
- Calling a function before defining it
- Using print when a return value is neededKnown Limitations
The local dataset contains only five topics.
Search uses simple case-insensitive substring matching rather than semantic search.
The agent chooses the first matching topic rather than ranking several possibilities intelligently.
The agent is deterministic and does not use an LLM.
A question about a missing topic, such as Python decorators, cannot produce a detailed recommendation.
The server currently uses local stdio only; it does not expose an authenticated HTTP endpoint.
The dataset is loaded from disk on every tool or resource call.
The agent overwrites
output/sample_agent_response.mdeach time it runs.The project has no database, user accounts, authentication, rate limiting or persistent conversation memory.
Expected invalid searches return result messages rather than formal MCP error objects.
During development, the most important errors to check were an incorrect path to data/topics.json, accidentally bypassing MCP by importing server functions directly, and writing debug output to stdout while using stdio.
Reflection
What problem does MCP solve?
MCP provides a standard connection between AI applications and external capabilities. Without it, every application and data source would need a custom integration. MCP lets a client discover and call tools or read resources through a consistent protocol.
What is the difference between an MCP tool and an MCP resource?
A tool is called with input to perform an operation or computation. A resource exposes readable data at a URI. In this project, topic searching and exact lookup are tools, while the topic catalogue is a read-only resource.
What does this MCP server expose?
The server exposes search_topics, get_topic_details and the topics://catalog resource. These capabilities use the five records in data/topics.json.
How does the agent use the MCP server?
The agent starts an MCP client connection over stdio. It calls search_topics to discover a candidate, then calls get_topic_details with the selected id. It formats only the returned topic data into a short study recommendation and saves the answer as Markdown.
What should be checked before using a third-party MCP server?
Check who published it, whether it runs locally or remotely, which tools and resources it exposes, which files or systems it can access, which credentials it requires, whether it can modify data, and whether its permissions can be restricted. Its documentation and source should be reviewed before granting access.
What limitation was observed in this implementation?
The clearest limitation is the small dataset combined with literal substring search. A reasonable question can fail simply because the requested topic or wording is not present. For example, the supplied dataset has no decorators topic, so the agent must report that no match exists rather than inventing an answer.
Git Validation, Commit and Push
cd ~/mcp-intro
source .venv/bin/activate
python -m json.tool data/topics.json > /dev/null
python -m py_compile \
server/learning_server.py \
client/mcp_client.py \
client/test_server.py \
client/agent.py
python client/test_server.py
python client/agent.py "I want to study Python functions. What should I review first?"
git remote -v
git status
git add README.md
git commit -m "Complete MCP project documentation"
git push origin mainSelf-Validation
Cumulative Project
Tasks 0–10 are documented as complete.
The project structure is documented.
The JSON dataset contains five valid topic records.
The FastMCP server has a script entry point.
search_topicsis exposed through MCP.get_topic_detailsis exposed through MCP.topics://catalogis exposed as a read-only resource.The direct MCP integration test checks tools, errors and the resource.
The agent calls both tools through MCP rather than direct imports.
A real sample response is saved in the output directory.
A third-party MCP server and its risks are reviewed.
Task 10 — Complete Documentation and Reflection
README.mdincludes all required sections.README.mdexplains what the server does.README.mdexplains how to run the server.README.mdexplains how to test the server.README.mdexplains how to run the agent.README.mdlists the available tools.README.mdlists the available resources.README.mdincludes the third-party MCP server review.README.mdincludes one example output.README.mdincludes known limitations.README.mdincludes a reflection answering every required question.No secrets are included.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityDmaintenanceProvides programmatic access to SAP Fiori Jetpack Compose UI SDK documentation, including API references and feature guides. It enables users to list, search, and retrieve content from over 6,000 documentation files to support Android development.Last updated
- AlicenseAqualityCmaintenanceExposes the Agentic Patterns Catalog as MCP resources and tools for AI coding agents to search, retrieve, and recommend patterns, recipes, frameworks, methodologies, and anti-patterns.Last updated12MIT
- Flicense-qualityCmaintenanceProvides synthetic catalog search, metadata retrieval, similar titles, trending, and new releases via MCP tools.Last updated
- Flicense-qualityBmaintenanceProvides access to self-contained, runnable implementation patterns across multiple programming languages via MCP tools for searching and retrieving documentation and code examples.Last updated
Related MCP Connectors
Discover available topics and explore up-to-date, topic-tagged web content. Search to surface the…
Search PayU docs, browse the payment integration catalog, and fetch production-ready code.
Search Codeforces problems and inspect public problem metadata through the official Codeforces API.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/aloladze88-afk/mcp-intro'
If you have feedback or need assistance with the MCP directory API, please join our Discord server