My MCP Server
My MCP Server
My MCP Server is a Python template for building a Model Context Protocol (MCP) server. It uses FastMCP to expose tools via JSON-RPC over stdio (and can be extended to HTTP), enabling secure and scalable context and tool invocation for language models.
Project Structure
├── src/ Source code (package: my_mcp_server)
│ ├── server.py Entry point and tool registrations
│ ├── main.py Console script entry
│ ├── config/ Configuration modules
│ ├── context/ Context providers for MCP
│ ├── models/ Pydantic models and schemas
│ ├── tools/ Custom tool implementations
│ └── utils/ Helper utilities
├── tests/ Unit, integration, and performance tests
├── Taskfile.yaml Common development and CI tasks
├── pyproject.toml Project metadata and build configuration
├── requirements.txt Runtime dependencies
└── docs/ Contribution & architecture guides
Prerequisites
Python >=3.13
Git
(Optional) Taskfile task runner
Setup
Create and activate virtual environment
task create-venv source .venv/bin/activate
Install runtime dependencies
task install-requirements
(Optional) Install development dependencies
task install-dev
Taskfile Tasks
Run task --list to see all available tasks. Common tasks include:
default: List available tasks
create-venv: Create a Python virtual environment in
.venvactivate-venv: Show activation commands for the venv
clean-venv: Remove the
.venvdirectoryinstall-requirements: Install runtime dependencies (
pip install -r requirements.txt)install-dev: Install the project in editable mode with dev dependencies (
pip install -e ".[dev]")flake8: Run
flake8oversrc/andtests/mypy: Run
mypyoversrc/andtests/black: Format code with
blackformat: Alias for
black(formats all Python files)lint: Run both
flake8andmypytest: Run all tests (unit, integration, performance) with
pytesttest-unit: Run unit tests only
test-integration: Run integration tests only
test-performance: Run performance tests only
coverage: Generate coverage report (HTML + terminal) with
pytest-covcheck: Run
format,lint, andtestsequentiallyrun: Start the console-based MCP server (
python -m my_mcp_server)dev: Alias for
run(start server in development mode)clean: Clean Python build artifacts and caches
build: Build distribution packages (sdist & wheel) using Hatchling
Development & Usage
After setup, you can start the server in stdio mode:
task runOr directly:
python -m my_mcp_serverTesting & Linting
Run all tests:
task testRun linters:
task lintFormat code:
task format
Build & Release
Build distributions:
task buildUpload to PyPI:
twine upload dist/*
Configuration
Environment variables can be managed via a .env file (loaded by python-dotenv/pydantic-settings).
Contributing
See docs/CONTRIBUTING.md for guidelines on contributing and architecture details.
License
MIT License
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/jairosoft-com/mcp-server-template-python'
If you have feedback or need assistance with the MCP directory API, please join our Discord server