
A MCP Task Server
概览
A Model Context Protocol (MCP) implementation for Task Management API written in TypeScript. This project serves as both a reference implementation and a functional task management server. This MCP server connects to an external Task API service and provides a standardized interface for task management. It supports two runtime modes: 1. : Standard input/output communication for CLI-based applications and AI agents 2. : Web-accessible server with Server-Sent Events for browser and HTTP-based clients The server offers a complete set of task management operations, extensive validation, and robust error handling.
README
以下为原文 README 节选,完整内容请查看原文。
Task API Server - MCP TypeScript Implementation
A Model Context Protocol (MCP) implementation for Task Management API written in TypeScript. This project serves as both a reference implementation and a functional task management server.
Overview
This MCP server connects to an external Task API service and provides a standardized interface for task management. It supports two runtime modes:
- STDIO Mode: Standard input/output communication for CLI-based applications and AI agents
- HTTP+SSE Mode: Web-accessible server with Server-Sent Events for browser and HTTP-based clients
The server offers a complete set of task management operations, extensive validation, and robust error handling.
Features
-
Task Management Operations:
- List existing tasks with filtering capabilities
- Create new tasks with customizable properties
- Update task details (description, status, category, priority)
- Delete tasks when completed or no longer needed
-
Dual Interface Modes:
- STDIO protocol support for command-line and AI agent integration
- HTTP+SSE protocol with web interface for browser-based access
-
MCP Protocol Implementation:
- Complete implementation of the Model Context Protocol
- Resources for task data structures
- Tools for task operations
- Error handling and informative messages
-
Quality Assurance:
- Comprehensive test client for validation
- Automatic server shutdown after tests complete
- Detailed validation of API responses
Getting Started
Prerequisites
- Node.js 16.x or higher
- npm or pnpm package manager
Installation
-
Clone the repository:
git clone https://github.com/yourusername/mcp-template-ts.git cd mcp-template-ts -
Install dependencies:
npm installor using pnpm:
pnpm install -
Create an
.envfile with your Task API credentials: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 -
Build the project:
npm run build
Running the Server
STDIO Mode (for CLI/AI integration)
npm start
or
node dist/index.js
HTTP Mode (for web access)
npm run start:http
or
node dist/http-server.js
By default, the HTTP server runs on port 3000. You can change this by setting the TASK_MANAGER_HTTP_PORT environment variable.
Testing
Run the comprehensive test suite to verify functionality:
npm test
This will:
- Build the project
- Start a server instance
- Connect a test client to the server
- Run through all task operations
- Verify correct responses
- Automatically shut down the server
Using the MCP Client
STDIO Client
To connect to the STDIO server from your application:
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →