Skip to main content
Glama
moazhassan751

todo-mcp-server

📝 シンプルなMCP Todoサーバー

PythonのFastMCP SDKを使用して構築された、Model Context Protocol (MCP) サーバーとして動作する永続的なTodoリスト管理ツールです。MCP互換のAIクライアント(Claude Desktop、Cursor、Antigravity IDE)ならどれでも検出して呼び出せる3つのツールを公開します。

機能概要

このサーバーは、AIアシスタントがあなたの代わりにシンプルなTodoリストを管理できるようにします。優先度付きでタスクを追加し、フィルターで一覧表示し、完了としてマークします。すべてのタスクはローカルのJSONファイル(tasks.json)に永続化されるため、セッションをまたいで状態が保持されます。


Related MCP server: mcpappwrite

ツール

add_task

オプションの優先度レベル付きで新しいタスクを作成します。

パラメータ

型

必須

デフォルト

説明

title

string

✅

—

タスクの説明(1〜200文字)

priority

string

❌

"medium"

"low"、"medium"、"high"のいずれか

入力例:

{ "title": "Write MCP report", "priority": "high" }

出力例:

✅ Task added!
  ID:       1
  Title:    Write MCP report
  Priority: high
  Status:   pending

list_tasks

タスクを表示します。ステータスでフィルタリングすることもできます。

パラメータ

型

必須

デフォルト

説明

status

string

❌

"all"

"all"、"pending"、"done"のいずれか

入力例:

{ "status": "pending" }

出力例:

📋 Tasks (pending) — 2 found:

  ID  Status    Priority Title
————  ————————— ———————— ————————————————————————————————————————
   2  ⏳ pending medium   Review lecture notes
   3  ⏳ pending low      Buy coffee

complete_task

数値IDでタスクを完了としてマークします。

パラメータ

型

必須

説明

task_id

integer

✅

list_tasksに表示されるID

入力例:

{ "task_id": 1 }

出力例:

✅ Task 1 completed!
  Title:        Write MCP report
  Completed at: 2026-08-19T08:42:42.518574+00:00

エラーハンドリングの例:

# Empty title
Error: Task title cannot be empty.

# Non-existent task
Error: No task with ID 999. Valid IDs: [1, 2, 3]

# Already completed
Task 1 ('Write MCP report') is already marked as done.

セットアップ手順

前提条件

  • Python 3.10以上

  • pip

インストール

# Clone the repo
git clone https://github.com/YOUR_USERNAME/simple-mcp-server.git
cd simple-mcp-server

# Install dependencies
pip install -r requirements.txt

サーバーの実行

Stdioモード(デフォルト — MCPクライアントで使用):

python server.py

MCP Inspector(対話型テストUI):

mcp dev server.py
# Opens at http://localhost:6274

自動テスト(同梱のテストスクリプト経由):

python test_server.py

MCPクライアントへの接続

Claude Desktop

claude_desktop_config.jsonに追加(macOS: ~/Library/Application Support/Claude/、Windows: %APPDATA%/Claude/):

{
  "mcpServers": {
    "todo-server": {
      "command": "python",
      "args": ["/absolute/path/to/simple-mcp-server/server.py"]
    }
  }
}

Cursor

プロジェクトルートの.cursor/mcp.jsonに追加:

{
  "mcpServers": {
    "todo-server": {
      "command": "python",
      "args": ["/absolute/path/to/simple-mcp-server/server.py"]
    }
  }
}

Google Antigravity IDE

ワークスペースルートの.agents/mcp_config.jsonに追加:

{
  "mcpServers": {
    "todo-server": {
      "command": "python",
      "args": ["/absolute/path/to/simple-mcp-server/server.py"]
    }
  }
}

Smithery(リモートデプロイ)

Smitheryにデプロイした後、次のように設定します:

{
  "mcpServers": {
    "todo-server": {
      "serverUrl": "https://server.smithery.ai/@YOUR_USERNAME/simple-mcp-server/mcp"
    }
  }
}

プロジェクト構成

simple-mcp-server/
├── server.py           # Main MCP server with 3 tools
├── test_server.py      # Automated test script
├── requirements.txt    # Python dependencies
├── .gitignore          # Git ignore rules
├── Dockerfile          # Docker image for Smithery deployment
├── smithery.yaml       # Smithery deployment configuration
└── README.md           # This file

学んだこと

  1. FastMCPの型からスキーマへの変換機能は強力ですが、不透明です。 @mcp.tool()デコレータは、Pythonの型ヒントとdocstringからJSON Schemaを自動生成します。これはボイラープレートを削減するのに非常に優れています。しかし、何か問題が発生した場合(コンストラクタでversionキーワードが受け入れられないなど)、エラーはPythonレベルではなくMCPプロトコル層の深部で発生します。デバッグにはSDKのソースコードを読む必要がありました。

  2. Windowsのエンコーディングは深刻な問題です。 Windowsのデフォルトコンソールはcp1252を使用しており、絵文字文字(✅、📋)をレンダリングできません。これにより、MCPツール自体は正常に動作しているにもかかわらず、テストスクリプトがUnicodeEncodeErrorでクラッシュしました。修正(sys.stdout.reconfigure(encoding="utf-8"))は1行ですが、それを見つけるには、MCPトランスポート層(UTF-8を問題なく処理)とターミナル層(処理しない)の違いを理解する必要がありました。

  3. MCPのstdioトランスポートは驚くほどエレガントです。 プロトコル全体がstdin/stdoutのJSON-RPCメッセージで動作します。設定するHTTPサーバーも、開くポートも、対処すべきCORSヘッダーもありません。クライアントはサーバーをサブプロセスとして起動し、両者はただ通信するだけです。これにより、REST APIを構築する場合と比較してローカル開発が非常にシンプルになり、MCPサーバーがさまざまなクライアントに簡単に接続できる理由でもあります。


ライセンス

MIT

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers