tiny-mcp-server
tiny-mcp-server
Самый быстрый и компактный способ создавать серверы Model Context Protocol (MCP) на Python. Ноль зависимостей. MIT.
tiny-mcp-server — это однофайловый Python-фреймворк для создания серверов Model Context Protocol. Без внешних зависимостей и шаблонного кода — просто декорируйте функцию с помощью @tool, и вы получите работающий MCP-сервер.
Возможности
🪶 Один файл, ноль зависимостей — чистая стандартная библиотека Python, можно добавить в любой проект
🪄 Декоратор
@tool— превратите любую функцию в MCP-инструмент одной строкой🚀 Несколько транспортов —
stdio(для десктопных MCP-клиентов) иsse(для веб/удалённого доступа)� Автоматическая генерация JSON Schema — подсказки типов и docstrings превращаются в схемы инструментов
�️ Встроенные логирование и обработка ошибок — никогда не падает при некорректном payload
�️ Лицензия MIT — используйте где угодно
Related MCP server: Berry MCP Server
Установка
Выберите то, что проще:
# 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/Быстрый старт
Вот полный MCP-сервер с двумя инструментами — меньше 20 строк:
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Автоматически сгенерированная JSON Schema для инструмента add:
{
"name": "add",
"description": "Add two numbers together.",
"inputSchema": {
"type": "object",
"properties": {
"a": {"type": "integer"},
"b": {"type": "integer"}
},
"required": ["a", "b"]
}
}Транспорты
stdio (по умолчанию — для Claude Desktop, Cursor и т.д.)
app.run("stdio")Сервер читает JSON-RPC сообщения из stdin и записывает ответы в stdout. Это транспорт, используемый каждым десктопным MCP-клиентом.
SSE (HTTP — для веб-клиентов)
app.run("sse", host="127.0.0.1", port=8000)Предоставляет конечную точку Server-Sent Events по адресу /sse и конечную точку POST по адресу /messages. Отлично подходит для запуска MCP-сервера в качестве локального микросервиса.
Справочник по 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— по умолчанию соответствует имени функцииdescription— по умолчанию берётся из docstring функцииАргументы определяются из сигнатуры; типы — из аннотаций
Значения по умолчанию становятся необязательными в схеме
app.run(transport: str, **kwargs)
"stdio"— без дополнительных аргументов"sse"—host(по умолчанию127.0.0.1),port(по умолчанию8000)
Примеры
См. examples/hello_world.py для рабочего демо-примера.
Лицензия
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