tiny-mcp-server
tiny-mcp-server
Python で Model Context Protocol (MCP) サーバーを構築するための、最速かつ最小の方法。依存関係ゼロ。MIT ライセンス。
tiny-mcp-server は、Model Context Protocol サーバーを構築するための単一ファイルの Python フレームワークです。外部依存関係なし、ボイラープレート不要 — 関数に @tool を付けるだけで、MCP サーバーをデプロイできます。
特徴
🪶 単一ファイル・依存関係ゼロ — 純粋な Python 標準ライブラリのみで、どのプロジェクトにもそのまま組み込めます
🪄
@toolデコレータ — 1 行で任意の関数を MCP ツールに変換します🚀 複数のトランスポート —
stdio(デスクトップ MCP クライアント用)とsse(Web/リモート用)� JSON Schema の自動生成 — 型ヒント + docstring がツールスキーマになります
�️ 組み込みのロギングとエラーハンドリング — 不正なペイロードでもクラッシュしません
�️ 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/クイックスタート
以下は、2 つのツールを備えた完全な 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 transportadd ツールの自動生成された JSON Schema:
{
"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")サーバーは stdin から JSON-RPC メッセージを読み取り、stdout に応答を書き込みます。これは、すべてのデスクトップ MCP クライアントで使用されるトランスポートです。
SSE(HTTP — Web クライアント向け)
app.run("sse", host="127.0.0.1", port=8000)/sse に Server-Sent Events エンドポイント、/messages に POST エンドポイントを公開します。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