tiny-mcp-server
tiny-mcp-server
La forma más rápida y ligera de construir servidores de Model Context Protocol (MCP) en Python. Cero dependencias. MIT.
tiny-mcp-server es un framework de Python de un solo archivo para construir servidores de Model Context Protocol. Sin dependencias externas, sin código repetitivo — solo decora una función con @tool y ya tienes un servidor MCP.
Características
🪶 Un solo archivo, cero dependencias — stdlib puro de Python, colócalo en cualquier proyecto
🪄 Decorador
@tool— convierte cualquier función en una herramienta MCP con una sola línea🚀 Múltiples transportes —
stdio(para clientes MCP de escritorio) ysse(para web/remoto)� Generación automática de JSON Schema — las anotaciones de tipo y los docstrings se convierten en esquemas de herramientas
�️ Registro y manejo de errores integrados — nunca falla con un payload malformado
�️ Con licencia MIT — úsalo en cualquier lugar
Related MCP server: Berry MCP Server
Instalación
Elige la que te resulte más fácil:
# 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/Inicio rápido
Aquí tienes un servidor MCP completo con dos herramientas — en menos de 20 líneas:
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 transportEl JSON Schema autogenerado de la herramienta add:
{
"name": "add",
"description": "Add two numbers together.",
"inputSchema": {
"type": "object",
"properties": {
"a": {"type": "integer"},
"b": {"type": "integer"}
},
"required": ["a", "b"]
}
}Transportes
stdio (predeterminado — para Claude Desktop, Cursor, etc.)
app.run("stdio")El servidor lee mensajes JSON-RPC desde stdin y escribe las respuestas en stdout. Este es el transporte que usa todo cliente MCP de escritorio.
SSE (HTTP — para clientes web)
app.run("sse", host="127.0.0.1", port=8000)Expone un endpoint de Server-Sent Events en /sse y un endpoint POST en /messages. Ideal para ejecutar un servidor MCP como microservicio local.
Referencia de la API
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 * countname— por defecto, el nombre de la funcióndescription— por defecto, el docstring de la funciónLos argumentos se infieren de la firma; los tipos, de las anotaciones
Los valores por defecto se vuelven opcionales en el esquema
app.run(transport: str, **kwargs)
"stdio"— sin argumentos adicionales"sse"—host(por defecto127.0.0.1),port(por defecto8000)
Ejemplos
Consulta examples/hello_world.py para ver una demo ejecutable.
Licencia
MIT © hussain-alsaibai
This server cannot be deployed
Maintenance
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…
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Related MCP Servers
- AlicenseDqualityDmaintenanceA foundation for building custom local Model Context Protocol (MCP) servers that provide tools accessible to AI assistants like Cursor or Claude Desktop.137MIT
- AlicenseNot gradedqualityDmaintenanceA 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.1MIT
- AlicenseNot gradedqualityFmaintenanceA robust server implementing the Model Context Protocol with SSE and STDIO transport, enabling real-time communication and extensible tooling for AI models.284 npm4MIT
- AlicenseNot gradedqualityDmaintenanceA simple toolkit for creating MCP servers with stdio and SSE transport, auto-validating tools via Pydantic.MIT