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: MCP Starter
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 installed
Maintenance
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
- -license-quality-maintenanceA streamlined foundation for building Model Context Protocol servers in Python, designed to make AI-assisted development of MCP tools easier and more efficient.12
- AlicenseDqualityDmaintenanceA foundation for building custom local Model Context Protocol (MCP) servers that provide tools accessible to AI assistants like Cursor or Claude Desktop.137MIT
- Alicense-qualityDmaintenanceA 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
- Alicense-qualityFmaintenanceA robust server implementing the Model Context Protocol with SSE and STDIO transport, enabling real-time communication and extensible tooling for AI models.2833MIT
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.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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