template-mcp-server-in-python-fastmcp

cgjdparashar/template-mcp-server-in-python-fastmcp

3.2

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.

Tools
2
Resources
0
Prompts
0

FastMCP Greet Server

GitHub Deployment Deploy on Railway Deploy to Render

A Model Context Protocol (MCP) server built with FastMCP that provides greeting functionality.

🚀 Quick Deploy

One-Click Deployments:

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 name
  • health() -> 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, use 0.0.0.0 for cloud deployment)
  • PORT: Port number (default: 8002)
  • TRANSPORT: Transport mode (sse or streamable-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)

  • Railway - Best for beginners, automatic HTTPS
  • Render - Free tier available

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)
  1. Visit railway.app
  2. Connect your GitHub account
  3. Deploy from this repository
Render (Manual)
  1. Visit render.com
  2. Create a new Web Service
  3. 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

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes and add tests
  4. Run the test suite: uv run pytest
  5. Submit a pull request

License

This project is licensed under the MIT License - see the file for details.

Acknowledgments

Support


🌟 Star this repository if you find it helpful!# Last deployment: 10/10/2025 20:22:40