Todo MCP Server
A robust Model Context Protocol server for managing todos with capabilities for task creation, filtering, and statistical analysis. It enables AI assistants to interact with todo datasets through specialized tools, structured resources, and intelligent productivity prompts.
README
Todo MCP Server
A robust Model Context Protocol (MCP) server for managing todos, built with TypeScript and the official MCP SDK. This implementation demonstrates modern MCP best practices including proper error handling, server capabilities configuration, and comprehensive tool/resource/prompt integration.
🚀 Features
🛠️ Tools (AI can execute)
create_todo- Create new todos with title, description, priority levels, and tagslist_todos- List and filter todos by status (completed/pending), priority, and tagsupdate_todo- Update any todo field including completion status and metadatadelete_todo- Remove todos by ID with confirmationtodo_stats- Generate comprehensive statistics and analytics
📄 Resources (AI can read)
todos://json- Complete todo dataset as structured JSONtodos://summary- Quick summary with counts, completion rates, and metrics
💬 Prompts (AI templates)
daily_report- Generate professional daily todo reports with filteringprioritize_tasks- Get AI assistance with intelligent task prioritization
📋 Quick Start
Prerequisites
- Node.js 18+
- npm or yarn
- TypeScript knowledge (optional for usage)
Installation & Setup
# 1. Clone and install dependencies
git clone <repository-url>
cd todo-mcp-server
npm install
# 2. Build the TypeScript project
npm run build
# 3. Test with MCP Inspector (optional)
npm test
# 4. Configure with your MCP client
Configuration
For Cursor IDE:
Add to your Cursor settings (~/.cursor/settings.json):
{
"mcp-servers": {
"todo-manager": {
"command": "node",
"args": ["/path/to/your/todo-mcp-server/dist/index.js"],
"env": {},
"cwd": "/path/to/your/todo-mcp-server"
}
}
}
For Claude Desktop:
Add to ~/.claude_desktop_config.json:
{
"mcpServers": {
"todo-manager": {
"command": "node",
"args": ["/path/to/your/todo-mcp-server/dist/index.js"]
}
}
}
🎯 Usage Examples
Once connected to your MCP client, you can interact naturally:
Creating & Managing Todos
"Create a high-priority todo to review the quarterly report with tags 'work' and 'urgent'"
"Add a shopping task for groceries with medium priority"
"Mark the quarterly report todo as completed"
"Update my shopping task to high priority and add description 'organic produce'"
Viewing & Filtering
"Show me all high priority pending todos"
"List all completed todos from this week"
"Display todos tagged with 'work'"
"Show my todo statistics and completion rate"
AI-Powered Insights
"Generate a daily report for today excluding completed tasks"
"Help me prioritize my current pending tasks"
"Create a professional summary of my productivity"
🏗️ Architecture & Implementation
Modern MCP SDK Patterns
This implementation follows current MCP SDK best practices:
// High-level API - capabilities are automatically discovered
const server = new McpServer({
name: "todo-manager",
version: "1.0.0"
});
// The SDK automatically discovers capabilities based on what you register:
server.tool("create_todo", schema, handler); // Adds 'tools' capability
server.resource("todos://json", handler); // Adds 'resources' capability
server.prompt("daily_report", schema, handler); // Adds 'prompts' capability
// Comprehensive error handling
server.tool("create_todo", schema, async (params) => {
try {
// Implementation
return { content: [...] };
} catch (error) {
return {
content: [{ type: "text", text: `Error: ${error.message}` }],
isError: true
};
}
});
How Capability Discovery Works
- Server Initialization: Server declares or auto-discovers its capabilities
- Client Connection: Client connects and receives server capability information during handshake
- Dynamic Discovery: Client calls these methods to discover available features:
client.listTools()- Discover available toolsclient.listResources()- Discover available resourcesclient.listPrompts()- Discover available prompts
- Usage: Client can then call specific tools, read resources, or use prompts
The high-level McpServer API automatically handles capability advertisement based on what you actually register, making it much simpler to use.
Project Structure
todo-mcp-server/
├── src/
│ └── index.ts # Main server implementation with modern patterns
├── dist/ # Compiled JavaScript output
├── package.json # Dependencies and build scripts
├── tsconfig.json # TypeScript configuration
└── README.md # Documentation (this file)
Data Model
interface Todo {
id: string; // Unique identifier
title: string; // Todo title (required)
description?: string; // Optional detailed description
completed: boolean; // Completion status
priority: 'low' | 'medium' | 'high'; // Priority level
createdAt: Date; // Creation timestamp
updatedAt: Date; // Last modification timestamp
tags: string[]; // Organizational tags
}
🔧 Development
Available Scripts
# Development mode with hot reload
npm run dev
# Production build
npm run build
# Run the server
npm start
# Test with MCP Inspector
npm test
# Lint and format code
npm run lint
npm run format
Testing with MCP Inspector
The MCP Inspector is the official testing tool:
# Install MCP Inspector globally
npm install -g @modelcontextprotocol/inspector
# Test your server
npx @modelcontextprotocol/inspector node dist/index.js
Error Handling & Logging
The server implements comprehensive error handling:
- Tool errors: Graceful failure with user-friendly messages
- Resource errors: Proper exception handling with context
- Process errors: Graceful shutdown and cleanup
- Validation errors: Zod schema validation with detailed feedback
Performance Considerations
- In-memory storage: Fast for development; replace with database for production
- Async operations: All operations are properly async/await
- Resource management: Proper cleanup on server shutdown
- Error isolation: Errors in one operation don't crash the server
🚀 Production Deployment
Database Integration
Replace the in-memory Map with a proper database:
// Example with PostgreSQL
import { Pool } from 'pg';
const pool = new Pool({
connectionString: process.env.DATABASE_URL
});
// Implement CRUD operations with proper transactions
Environment Configuration
# .env file
NODE_ENV=production
DATABASE_URL=postgresql://user:pass@localhost/todos
LOG_LEVEL=info
PORT=3000
Monitoring & Observability
Consider adding:
- Structured logging (Winston, Pino)
- Metrics collection (Prometheus)
- Health check endpoints
- Request tracing
🔮 Extending the Server
Adding New Tools
server.tool(
"archive_todo",
{ id: z.string() },
async ({ id }) => {
// Implementation
}
);
Adding New Resources
server.resource(
"todos-by-date",
"todos://by-date/{date}",
async (uri, { date }) => {
// Implementation
}
);
Adding New Prompts
server.prompt(
"weekly_review",
"Generate a weekly productivity review",
{ week: z.string() },
async ({ week }) => {
// Implementation
}
);
📚 Learn More
MCP Resources
Advanced Topics
- Authentication: Implement OAuth or API key authentication
- Rate Limiting: Add request throttling for production use
- Caching: Implement Redis or in-memory caching
- Webhooks: Add real-time notifications
- Collaboration: Multi-user todo management
- Sync: Cross-device synchronization
🤝 Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Follow the existing code style and patterns
- Add tests for new functionality
- Update documentation as needed
- Submit a pull request
Code Standards
- Use TypeScript with strict mode
- Follow the existing error handling patterns
- Add JSDoc comments for public APIs
- Ensure all tests pass
- Follow semantic versioning
📄 License
MIT License - see LICENSE file for details.
Built with ❤️ using the official Model Context Protocol TypeScript SDK
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。