Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
6,000+ web scrapers for your AI agent, start free logo6,000+ web scrapers for your AI agent, start free

Apify gives your agent live web data: 6,000+ prebuilt scrapers and actors, MCP-ready. Sign up free with $5 in usage credits.

Try Apify free
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 48,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

Minimal FastMCP Python server demonstrating basic MCP functionality with a cowsay tool for generating ASCII art.

README.md

Demo MCP Server

A minimal FastMCP Python server demonstrating basic MCP (Model Context Protocol) functionality with a simple cowsay tool.

Features

  • FastMCP Server: Simple MCP server implementation
  • Cowsay Tool: Generate ASCII art of a cow saying custom messages
  • Environment Configuration: .env file support with Pydantic settings
  • Docker Support: Full Docker and docker-compose setup
  • Testing: Basic unit tests with pytest
  • KISS Principle: Keep It Simple, focused implementation

Quick Start

Local Development

  1. Install dependencies:
   make install-dev
  1. Run the server (http mode on port 8005):
   make run-http
  1. Run tests:
   make test

Docker

  1. Build and run:
   make docker-build
   make docker-run
  1. For HTTP transport:
   make docker-run-http

Project Structure

my-mcp-server/
├── src/
│   ├── config/
│   │   └── settings.py          # Environment configuration
│   └── mcp/
│       ├── __main__.py          # Entry point
│       ├── server.py            # FastMCP server setup
│       └── tools/
│           └── cowsay.py        # Cowsay MCP tool
├── tests/                       # Unit tests
├── .env.example                 # Environment variables template
├── docker-compose.yml           # Docker compose configuration
├── Dockerfile                   # Docker container definition
├── Makefile                     # Common commands
└── pyproject.toml              # Python project configuration

Available Tools

cowsay

Generate ASCII art of a cow saying a message.

Parameters:

  • message (str): The message for the cow to say
  • cow (str, optional): The type of cow to use (default: "default")

Example: ``python result = await cowsay("Hello, World!") ``

Output: `` _______________ < Hello, World! > --------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || ``

Configuration

The server uses environment variables for configuration. Copy .env.example to .env and customize:

cp .env.example .env

Available Settings

| Variable | Default | Description | |----------|---------|-------------| | APP_NAME | "Demo MCP Server" | Application name | | LOG_LEVEL | "INFO" | Logging level | | MCP_TRANSPORT | "stdio" | MCP transport method | | MCP_HOST | "127.0.0.1" | Host for HTTP transport | | MCP_PORT | "8000" | Port for HTTP transport | | MAX_MESSAGE_LENGTH | "500" | Maximum cowsay message length |

Usage with MCP Clients

Claude Desktop

Add to your MCP settings:

{
  "mcpServers": {
    "demo-mcp-server": {
      "command": "python",
      "args": ["-m", "src.mcp"],
      "cwd": "/path/to/my-mcp-server"
    }
  }
}

Command Line

# STDIO transport (default)
python -m src.mcp --transport stdio

# HTTP transport
python -m src.mcp --transport http --port 8000

# Help
python -m src.mcp --help

Development

Available Make Commands

make help              # Show all available commands

# Development
make install           # Install dependencies
make install-dev       # Install with dev dependencies
make test             # Run tests
make test-verbose     # Run tests with verbose output

# Running
make run              # Run server locally (STDIO)
make run-http         # Run server locally (HTTP)
make health           # Check server health

# Docker
make docker-build     # Build Docker image
make docker-run       # Run in Docker (STDIO)
make docker-run-http  # Run in Docker (HTTP)
make docker-stop      # Stop containers
make docker-clean     # Clean containers and images

# Cleanup
make clean            # Clean build artifacts

Testing

# Run all tests
make test

# Run with coverage
python -m pytest --cov=src --cov-report=html

# Run specific test
python -m pytest tests/test_cowsay.py -v

Adding New Tools

  1. Create a new tool file in src/mcp/tools/
  2. Implement the tool using FastMCP patterns
  3. Register it in src/mcp/server.py
  4. Add tests in tests/

Example tool structure: ```python from fastmcp.tools import Tool

def create_my_tool() -> Tool: async def my_tool(param: str) -> dict:

Tool implementation

return {"success": True, "result": param}

return Tool( name="my_tool", description="Description of my tool", func=my_tool, ) ```

Docker

Building

docker-compose build

Running

STDIO mode (for MCP clients): ``bash docker-compose up demo-mcp-server ``

HTTP mode (for testing): ``bash docker-compose --profile http up demo-mcp-http ``

Environment Variables in Docker

Create a .env file or set environment variables in docker-compose.yml:

environment:
  - APP_NAME=My Custom MCP Server
  - LOG_LEVEL=DEBUG

Health Checks

Check server health: ``bash make health ``

Or directly: ``bash python -c "from src.mcp.server import get_server_health; import json; print(json.dumps(get_server_health(), indent=2))" ``

License

MIT License - feel free to use this as a starting point for your own MCP servers.

Contributing

This is a demo/seed project. Feel free to fork and extend it for your own needs.

---

Happy MCP Development! 🐄

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use Other servers.