Skip to main content
Glama
hussain-alsaibai

tiny-mcp-server

tiny-mcp-server

Der schnellste und kleinste Weg, Server für Model Context Protocol (MCP) in Python zu bauen. Keine Abhängigkeiten. MIT.

tiny-mcp-server ist ein Single-File-Python-Framework zum Erstellen von Model Context Protocol-Servern. Keine externen Abhängigkeiten, kein Boilerplate — dekorier einfach eine Funktion mit @tool und schon lieferst du einen MCP-Server aus.

Features

  • 🪶 Eine Datei, keine Abhängigkeiten — reine Python-Standardbibliothek, einfach in jedes Projekt einfügbar

  • 🪄 @tool-Dekorator — verwandle jede Funktion mit einer Zeile in ein MCP-Tool

  • 🚀 Mehrere Transportestdio (für Desktop-MCP-Clients) und sse (für Web/Remote)

  • Automatische JSON-Schema-Generierung — Typhinweise + Docstrings werden zu Tool-Schemas

  • �️ Integrierte Protokollierung und Fehlerbehandlung — nie bei einer fehlerhaften Nutzlast abstürzen

  • �️ MIT-lizenziert — überall einsetzbar

Related MCP server: MCP Starter

Installation

Nimm, was am einfachsten ist:

# Option 1 — pip (when published)
pip install tiny-mcp-server

# Option 2 — curl a single file and import it
curl -O https://raw.githubusercontent.com/hussain-alsaibai/tiny-mcp-server/main/tiny_mcp_server.py

# Option 3 — vendor it
cp tiny_mcp_server.py your_project/

Schnellstart

Hier ist ein vollständiger MCP-Server mit zwei Tools — unter 20 Zeilen:

from tiny_mcp_server import Server, tool

app = Server("hello-world")

@app.tool
def add(a: int, b: int) -> int:
    """Add two numbers together."""
    return a + b

@app.tool
def greet(name: str = "World") -> str:
    """Greet someone by name."""
    return f"Hello, {name}!"

if __name__ == "__main__":
    app.run("stdio")  # or "sse" for HTTP transport

Das automatisch generierte JSON-Schema des add-Tools:

{
  "name": "add",
  "description": "Add two numbers together.",
  "inputSchema": {
    "type": "object",
    "properties": {
      "a": {"type": "integer"},
      "b": {"type": "integer"}
    },
    "required": ["a", "b"]
  }
}

Transporte

stdio (Standard — für Claude Desktop, Cursor usw.)

app.run("stdio")

Der Server liest JSON-RPC-Nachrichten von stdin und schreibt Antworten auf stdout. Dies ist der Transport, der von jedem Desktop-MCP-Client verwendet wird.

SSE (HTTP — für Web-Clients)

app.run("sse", host="127.0.0.1", port=8000)

Stellt einen Server-Sent-Events-Endpunkt unter /sse und einen POST-Endpunkt unter /messages bereit. Ideal, um einen MCP-Server als lokalen Mikroservice zu betreiben.

API-Referenz

Server(name: str)

app = Server("my-server")

@app.tool

@app.tool(name="optional-name", description="optional-desc")
def my_tool(arg: str, count: int = 1) -> str:
    """Tool description (used as fallback if description not provided)."""
    return arg * count
  • name — standardmäßig der Funktionsname

  • description — standardmäßig der Docstring der Funktion

  • Argumente werden aus der Signatur abgeleitet; Typen aus Annotationen

  • Standardwerte werden im Schema optional

app.run(transport: str, **kwargs)

  • "stdio" — keine zusätzlichen Argumente

  • "sse"host (Standard 127.0.0.1), port (Standard 8000)

Beispiele

Sieh dir examples/hello_world.py für eine ausführbare Demo an.

Lizenz

MIT © hussain-alsaibai

A
license - permissive license
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    D
    quality
    D
    maintenance
    A foundation for building custom local Model Context Protocol (MCP) servers that provide tools accessible to AI assistants like Cursor or Claude Desktop.
    1
    37
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    A universal framework for creating and deploying custom Model Context Protocol (MCP) tool servers with decorator-based tool registration, supporting multiple transports and automatic JSON schema generation for AI assistants.
    1
    MIT

View all related MCP servers

Related MCP Connectors

  • A Model Context Protocol server for Wix AI tools

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

  • AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.

View all MCP Connectors

Latest Blog Posts

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/hussain-alsaibai/tiny-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server