cgjdparashar/template-mcp-server-in-python-fastmcp
If you are the rightful owner of template-mcp-server-in-python-fastmcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The FastMCP Greet Server is a Model Context Protocol (MCP) server designed to provide greeting functionality using the FastMCP framework.
FastMCP Greet Server
A Model Context Protocol (MCP) server built with FastMCP that provides greeting functionality.
🚀 Quick Deploy
One-Click Deployments:
- GitHub: Deployed automatically - Container Registry + GitHub Pages
- Railway: Deploy Now - Automatic deployment with Docker
- Render: Deploy Now - Free tier available
Your deployed server will be available at:
ghcr.io/cgjdparashar/template-mcp-server-in-python-fastmcp:latest # GitHub Container Registry
https://your-app-name.up.railway.app # Railway
https://your-app-name.onrender.com # Render
Features
- Simple greeting tool that accepts a name and returns a personalized greeting
- Built with FastMCP for easy integration with MCP clients
- Support for both streaming and SSE transport modes
- Docker support for easy deployment
- Comprehensive CI/CD pipeline
- Health check endpoint for monitoring
- Production-ready configuration
Installation
From PyPI (when published)
pip install fastmcp-greet-server
From Source
git clone https://github.com/cgjdparashar/template-mcp-server-in-python-fastmcp.git
cd template-mcp-server-in-python-fastmcp
uv sync
Usage
Running the Server
# Using uv
uv run python greet.py
# Or if installed via pip
python greet.py
The server will start on http://127.0.0.1:8002 by default.
Using with MCP Clients
The server provides the following tools:
greet(name: str) -> str: Returns a personalized greeting for the given namehealth() -> str: Health check endpoint for monitoring
Testing the Deployed Server
Once deployed, you can test your server:
# Test the greet tool
curl -X POST "https://your-deployed-url/mcp" \
-H "Content-Type: application/json" \
-d '{"method": "tools/call", "params": {"name": "greet", "arguments": {"name": "World"}}}'
# Test health check
curl "https://your-deployed-url/health"
Docker Deployment
# Build and run with Docker Compose
docker-compose up -d
# Or build and run manually
docker build -t fastmcp-greet .
docker run -p 8002:8002 fastmcp-greet
Configuration
The server can be configured using environment variables:
HOST: Bind address (default:127.0.0.1, use0.0.0.0for cloud deployment)PORT: Port number (default:8002)TRANSPORT: Transport mode (sseorstreamable-http, default:sse)
Development
Setup Development Environment
# Clone the repository
git clone https://github.com/cgjdparashar/template-mcp-server-in-python-fastmcp.git
cd template-mcp-server-in-python-fastmcp
# Install with development dependencies
uv sync --all-extras
Running Tests
uv run pytest
Code Quality
# Linting
uv run ruff check .
# Formatting
uv run ruff format .
# Type checking
uv run mypy .
Deployment Options
1. One-Click Deployments (Recommended)
2. GitHub Container Registry
The project includes GitHub Actions that automatically build and push Docker images to GitHub Container Registry on releases.
docker pull ghcr.io/cgjdparashar/template-mcp-server-in-python-fastmcp:latest
3. Manual Cloud Deployment
Railway (Manual)
- Visit railway.app
- Connect your GitHub account
- Deploy from this repository
Render (Manual)
- Visit render.com
- Create a new Web Service
- Connect this GitHub repository
Heroku
heroku create your-app-name
heroku container:push web
heroku container:release web
Fly.io
flyctl launch
flyctl deploy
4. Self-Hosted
Use the provided docker-compose.yml for production deployment with nginx reverse proxy.
API Documentation
When running, the server exposes MCP protocol endpoints. You can test the greeting tool using any MCP client or the provided test client.
Example Usage
from greetclient import test_greet_tool
# Test the greeting tool
result = test_greet_tool("Alice")
print(result) # Output: Hello, Alice!
MCP Client Configuration
Add this to your MCP client configuration:
{
"servers": {
"fastmcp-greet": {
"type": "http",
"url": "https://your-deployed-url",
"transport": "sse"
}
}
}
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes and add tests
- Run the test suite:
uv run pytest - Submit a pull request
License
This project is licensed under the MIT License - see the file for details.
Acknowledgments
Support
- Create an issue on GitHub Issues
- Check the FastMCP documentation
- Review the MCP specification