Skip to main content
Glama
MxrxnxX

Servidor MCP de tareas

by MxrxnxX

MCPタスクサーバー

プログラミングIVの課外課題1のプロジェクトです。ローカルのJSONファイルでタスクを管理し、リソース1つ、ツール2つ、プロンプト1つを公開するModel Context Protocol (MCP)サーバーを実装します。

機能

  • Resource tasks://pending: 未完了のタスクのみを返します。

  • Tool add_task: 名前、説明、優先度(alta、media、baja)でタスクを追加します。

  • Tool complete_task: IDで既存のタスクを完了済みにします。

  • Prompt daily_summary: 現在の状態から日次サマリーを生成するためのテンプレートを構築します。

サーバーはstdioトランスポートを使用します。ホストまたはクライアントがサブプロセスとして起動し、MCPメッセージはstdinとstdoutを介して送受信されます。

Related MCP server: TaskTrek MCP Server

要件

  • Python 3.11以上。

  • ターミナルへのアクセス。

  • 統合用のClaude Desktop、MCP Inspector、またはその他のMCP互換クライアント。

インストール

Windows (PowerShell)

cd C:\RUTA\mcp-todo-server
py -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txt

macOS または Linux

cd /RUTA/mcp-todo-server
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt

実行

stdioサーバーはクライアントが最初のメッセージを送信するのを待ちます。そのため、直接実行してもメニューは表示されず、ポートも開きません:

python server.py

停止するにはCtrl+Cを使用します。

デモクライアント

client_demo.pyは公式SDKで構築されたMCP互換クライアントです。stdioで接続し、機能を検出して、演習で要求されたすべての操作を実行します:

python client_demo.py --reset

UTF-8のトランスクリプトを保存するには:

python client_demo.py --reset --output evidence/client_demo_output.txt

--resetオプションは、テスト前に最初の2つのレコードを復元します。デモはResourceを照会し、2つのタスクを追加し、1つを完了し、Promptを取得して、再度Resourceを照会します。

自動テスト

python -m pytest -q

スイートは以下を確認します:

  1. Resource、Tools、Promptの検出。

  2. 保留中のタスクのみの読み取り。

  3. タスクの作成と完了。

  4. daily_summaryの動的コンテンツ。

  5. 存在しないIDを完了しようとしたときのエラー処理。

MCP Inspector

Node.jsがインストールされていれば、公式インターフェースを開くことができます:

npx @modelcontextprotocol/inspector .venv/Scripts/python.exe server.py

macOSまたはLinuxでは、実行可能ファイルを.venv/bin/pythonに変更してください。

Claude Desktopの設定

  1. claude_desktop_config.example.jsonを開きます。

  2. C:\\RUTA\\mcp-todo-serverをプロジェクトの絶対パスに置き換えます。

  3. mcpServersエントリをClaude Desktopの設定ファイルにコピーします。Windowsでは通常、%APPDATA%\Claude\claude_desktop_config.jsonにあります。

  4. Claude Desktopを完全に閉じて、再度開きます。

例:

{
  "mcpServers": {
    "todo-server": {
      "command": "C:\\RUTA\\mcp-todo-server\\.venv\\Scripts\\python.exe",
      "args": ["C:\\RUTA\\mcp-todo-server\\server.py"]
    }
  }
}

相対パスは使用しないでください。ホストが別のディレクトリからサーバーを起動する可能性があります。

構造

mcp-todo-server/
  server.py
  client_demo.py
  tasks.json
  requirements.txt
  claude_desktop_config.example.json
  tests/
    test_server.py
  diagramas/
    arquitectura_mcp_ecommerce.mmd
    flujo_consulta_inventario.mmd
  evidence/
    client_demo_output.txt
    01_inspector_connected.png
    02_add_task_result.png
    03_complete_task_result.png
    04_resource_pending.png
    05_daily_summary_prompt.png

Gitへの公開

git init
git add .
git commit -m "Implementar servidor MCP de tareas"
git branch -M main
git remote add origin URL_DEL_REPOSITORIO
git push -u origin main

最終的なリポジトリのURLは、提出前にレポートに追加する必要があります。

技術リファレンス

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    A minimal Model Context Protocol server implementation that provides tools for managing a to-do list, allowing users to create tasks, list them, and mark them as completed via JSON-RPC calls.
    -
  • F
    license
    Not graded
    quality
    B
    maintenance
    A lightweight task management MCP server that enables CRUD operations on tasks stored in a single JSON file, including listing, creating, updating progress, and setting priorities.
    200 npm
    -