Skip to main content
Glama
milkosten

Task API Server

by milkosten

タスク API サーバー - MCP TypeScript 実装

TypeScriptで記述されたタスク管理APIのモデルコンテキストプロトコル(MCP)実装。このプロジェクトは、リファレンス実装と機能的なタスク管理サーバーの両方として機能します。

概要

このMCPサーバーは外部のTask APIサービスに接続し、タスク管理のための標準化されたインターフェースを提供します。2つのランタイムモードをサポートしています。

  1. STDIO モード: CLI ベースのアプリケーションと AI エージェントの標準入出力通信

  2. HTTP+SSE モード: ブラウザおよび HTTP ベースのクライアント向けの Server-Sent Events を備えた Web アクセス可能なサーバー

サーバーは、タスク管理操作、広範な検証、および堅牢なエラー処理の完全なセットを提供します。

Related MCP server: Tiny TODO MCP

特徴

  • タスク管理操作:

    • フィルタリング機能を使用して既存のタスクを一覧表示する

    • カスタマイズ可能なプロパティを持つ新しいタスクを作成する

    • タスクの詳細(説明、ステータス、カテゴリ、優先度)を更新します

    • 完了または不要になったらタスクを削除する

  • デュアルインターフェースモード:

    • コマンドラインと AI エージェントの統合のための STDIO プロトコルのサポート

    • ブラウザベースのアクセスのためのWebインターフェースを備えたHTTP + SSEプロトコル

  • MCPプロトコル実装:

    • モデルコンテキストプロトコルの完全な実装

    • タスクデータ構造のリソース

    • タスク操作のためのツール

    • エラー処理と情報メッセージ

  • 品質保証:

    • 検証のための包括的なテストクライアント

    • テスト完了後の自動サーバーシャットダウン

    • APIレスポンスの詳細な検証

はじめる

前提条件

  • Node.js 16.x 以上

  • npm または pnpm パッケージマネージャー

インストール

  1. リポジトリをクローンします。

    git clone https://github.com/yourusername/mcp-template-ts.git
    cd mcp-template-ts
  2. 依存関係をインストールします:

    npm install

    またはpnpmを使用します:

    pnpm install
  3. Task API 資格情報を使用して.envファイルを作成します。

    TASK_MANAGER_API_BASE_URL=https://your-task-api-url.com/api
    TASK_MANAGER_API_KEY=your_api_key_here
    TASK_MANAGER_HTTP_PORT=3000
  4. プロジェクトをビルドします。

    npm run build

サーバーの実行

STDIO モード (CLI/AI 統合用)

npm start

または

node dist/index.js

HTTP モード (Web アクセス用)

npm run start:http

または

node dist/http-server.js

デフォルトでは、HTTP サーバーはポート 3000 で実行されます。TASK_MANAGER_HTTP_PORT 環境変数TASK_MANAGER_HTTP_PORT設定することでこれを変更できます。

テスト

包括的なテスト スイートを実行して機能を検証します。

npm test

これにより、次のようになります。

  1. プロジェクトを構築する

  2. サーバーインスタンスを起動する

  3. テストクライアントをサーバーに接続する

  4. すべてのタスク操作を実行する

  5. 正しい回答を確認する

  6. サーバーを自動的にシャットダウンする

MCPクライアントの使用

STDIOクライアント

アプリケーションから STDIO サーバーに接続するには:

import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
import * as path from 'path';

// Create transport
const transport = new StdioClientTransport({
  command: 'node',
  args: [path.resolve('path/to/dist/index.js')]
});

// Initialize client
const client = new Client(
  {
    name: "your-client-name",
    version: "1.0.0"
  },
  {
    capabilities: {
      prompts: {},
      resources: {},
      tools: {}
    }
  }
);

// Connect to server
await client.connect(transport);

// Example: List all tasks
const listTasksResult = await client.callTool({
  name: "listTasks",
  arguments: {}
});

// Example: Create a new task
const createTaskResult = await client.callTool({
  name: "createTask",
  arguments: {
    task: "Complete project documentation",
    category: "Documentation",
    priority: "high"
  }
});

// Clean up when done
await client.close();

HTTPクライアント

ブラウザから HTTP サーバーに接続するには:

<!DOCTYPE html>
<html>
<head>
  <title>Task Manager</title>
  <script type="module">
    import { Client } from 'https://cdn.jsdelivr.net/npm/@modelcontextprotocol/sdk/dist/esm/client/index.js';
    import { SSEClientTransport } from 'https://cdn.jsdelivr.net/npm/@modelcontextprotocol/sdk/dist/esm/client/sse.js';

    document.addEventListener('DOMContentLoaded', async () => {
      // Create transport
      const transport = new SSEClientTransport('http://localhost:3000/mcp');
      
      // Initialize client
      const client = new Client(
        {
          name: "browser-client",
          version: "1.0.0"
        },
        {
          capabilities: {
            prompts: {},
            resources: {},
            tools: {}
          }
        }
      );

      // Connect to server
      await client.connect(transport);
      
      // Now you can use client.callTool() for tasks
    });
  </script>
</head>
<body>
  <h1>Task Manager</h1>
  <!-- Your interface elements here -->
</body>
</html>

利用可能なツール

タスク一覧

利用可能なすべてのタスクを一覧表示します。

const result = await client.callTool({
  name: "listTasks",
  arguments: {
    // Optional filters
    status: "pending", // Filter by status
    category: "Work",  // Filter by category
    priority: "high"   // Filter by priority
  }
});

タスク作成

新しいタスクを作成します。

const result = await client.callTool({
  name: "createTask",
  arguments: {
    task: "Complete the project report",  // Required: task description
    category: "Work",                     // Optional: task category
    priority: "high"                      // Optional: low, medium, high
  }
});

タスクの更新

既存のタスクを更新します。

const result = await client.callTool({
  name: "updateTask",
  arguments: {
    taskId: 123,                       // Required: ID of task to update
    task: "Updated task description",  // Optional: new description
    status: "done",                    // Optional: pending, started, done
    category: "Personal",              // Optional: new category
    priority: "medium"                 // Optional: low, medium, high
  }
});

タスクの削除

タスクを削除します。

const result = await client.callTool({
  name: "deleteTask",
  arguments: {
    taskId: 123  // Required: ID of task to delete
  }
});

環境変数

変数

説明

デフォルト

タスクマネージャーAPIベースURL

外部タスク API の URL

なし(必須)

タスクマネージャーAPIキー

認証用のAPIキー

なし(必須)

タスクマネージャーHTTPポート

HTTPサーバーのポート

3000

ポート

代替ポート名(優先)

なし

プロジェクト構造

mcp-template-ts/
├── dist/               # Compiled JavaScript files
├── src/                # TypeScript source files
│   ├── index.ts        # STDIO server entry point
│   ├── http-server.ts  # HTTP+SSE server entry point
│   ├── test-client.ts  # Test client implementation
├── .env                # Environment variables
├── package.json        # Project dependencies
├── tsconfig.json       # TypeScript configuration
└── README.md           # Project documentation

発達

  1. TypeScript コンパイラをウォッチ モードで起動します。

    npm run watch
  2. 変更を確認するためにテストを実行します。

    npm test

ライセンス

このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細については LICENSE ファイルを参照してください。

謝辞

  • このプロジェクトはMCPプロトコル実装に@modelcontextprotocol/sdkを使用します

  • AIツールやWebアプリケーションとの統合用に構築

Available Tools

4 tools
createTaskD
ParametersJSON Schema
NameRequiredDescriptionDefault
taskYesThe task description or title
categoryYesTask category (e.g., 'Development', 'Documentation')
priorityNoTask priority level (defaults to 'medium' if not specified)
statusNoInitial task status (defaults to 'not_started' if not specified)

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

deleteTaskD
ParametersJSON Schema
NameRequiredDescriptionDefault
taskIdYesThe unique ID of the task to delete

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

listTasksD
ParametersJSON Schema
NameRequiredDescriptionDefault
statusNoFilter tasks by status (optional)
priorityNoFilter tasks by priority level (optional)

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

updateTaskD
ParametersJSON Schema
NameRequiredDescriptionDefault
taskIdYesThe unique ID of the task to update
taskNoNew task description/title (if you want to change it)
categoryNoNew task category (if you want to change it)
priorityNoNew task priority (if you want to change it)
statusNoNew task status (if you want to change it)

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updates
    • First observedcreateTask
    • First observeddeleteTask
    • First observedlistTasks
    • First observedupdateTask

TDQS

C2.2/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct purpose targeting a specific CRUD operation on tasks: create, delete, list, and update. There is no overlap or ambiguity between these actions.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern (createTask, deleteTask, listTasks, updateTask) with no deviations in style or convention.

Tool Count5/5

With 4 tools, this server is well-scoped for a basic task management API, covering essential CRUD operations without unnecessary bloat or missing core functionality.

Completeness5/5

The tool set provides complete CRUD coverage for the task domain (create, read via list, update, delete), with no obvious gaps or dead ends for managing tasks.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A FastAPI-based implementation of the Model Context Protocol that enables standardized interaction between AI models and development environments, making it easier for developers to integrate and manage AI tasks.
    10
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that provides persistent task management capabilities for AI assistants, allowing them to create, update, and track tasks beyond their usual context limitations.
    5
    -