1.0.3 • Published 1 year ago

@leonvanzyl/mcp-todo-server v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

MCP Todo Server

A Model Context Protocol (MCP) server for managing a todo list application.

Features

  • List all todos
  • Add new todos
  • Mark todos as completed
  • Update todo details
  • Delete individual todos
  • Delete all todos

Technologies Used

  • TypeScript
  • SQLite (for local database)
  • Model Context Protocol (MCP)
  • Zod (for validation)

Prerequisites

  • Node.js (v16 or higher)
  • npm

Installation

Global Installation

npm install -g @leonvanzyl/mcp-todo-server

Local Installation

npm install @leonvanzyl/mcp-todo-server

Usage

Command Line Interface

After installing globally, you can run the server using:

mcp-todo-server

Options

  • --db <path>: Path to the SQLite database file (default: ./todo.db)
  • --port <number>: Port for HTTP server (default: 3000, only used with --http)
  • --http: Use HTTP transport instead of stdio (Note: HTTP transport may not be available in all MCP SDK versions)
  • --help: Show help message

Note: The HTTP transport option requires a compatible version of the MCP SDK. If the HTTP transport is not available, the server will automatically fall back to stdio transport.

Using in MCP Client Configuration

You can use this server in your MCP client configuration:

{
  "mcpServers": {
    "todo": {
      "command": "npx",
      "args": ["-y", "@leonvanzyl/mcp-todo-server"]
    }
  }
}

Or with custom options:

{
  "mcpServers": {
    "todo": {
      "command": "npx",
      "args": [
        "-y",
        "@leonvanzyl/mcp-todo-server",
        "--db",
        "/path/to/custom.db"
      ]
    }
  }
}

Programmatic Usage

You can also use the server programmatically in your Node.js applications:

import todoServer from "@leonvanzyl/mcp-todo-server";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";

// Connect to stdio transport
const transport = new StdioServerTransport();
await todoServer.connect(transport);

Available Tools

The server provides the following MCP tools:

  • listTodos: Get all todos
  • addTodo: Add a new todo
  • completeTodo: Mark a todo as completed
  • updateTodo: Update a todo's title or completion status
  • deleteTodo: Delete a todo
  • deleteAllTodos: Delete all todos

Development

Setup

git clone https://github.com/yourusername/mcp-todo-server.git
cd mcp-todo-server
npm install

Build

npm run build

Run in Development Mode

npm run dev

Troubleshooting

HTTP Transport Not Available

If you encounter an error related to the HTTP transport not being available, it means your version of the MCP SDK does not include the HTTP transport module. In this case, the server will automatically fall back to using stdio transport.

To use HTTP transport, you may need to update your MCP SDK version or use a different transport method.

Publishing

To publish the package to npm:

npm login
npm publish --access public

License

ISC