A simple RESTful API for managing item lists (TodoLists
) and their items (Todoitems
), built with NestJS and Typescript.
This API allows users to:
- Create, view, update, and delete ToDo Lists.
- Add, view, update, and delete ToDo items within lists.
- Interact with the API via natural language using Model Context Protocol (MCP)
Clone the repository and install dependencies:
$ npm install
# Development mode
$ npm run start
# Watch mode
$ npm run start:dev
GET /api/todolists
– Get all listsGET /api/todolists/:todoListId
– Get list by IDPOST /api/todolists
– Create new listPUT /api/todolists/:todoListId
– Update listDELETE /api/todolists/:todoListId
– Delete list
GET /api/todoitems/list/:todoListId
– Get all items from a list (By list ID)GET /api/todoitems/:todoitemId
– Get item by IDPOST /api/todoitems
– Create new itemPUT /api/todoitems/:todoitemId
– Update itemPATCH /api/todoitems/:todoitemId/complete
– Complete an itemDELETE /api/todoitems/:todoitemId
– Delete item
{
"name": "Groceries"
}
PUT /api/todolists/1
{
"name": "Weekend Groceries"
}
{
"description": "Buy eggs",
"todoListId": 1
}
PUT /api/todoitems/2
{
"description": "Buy organic eggs"
}
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
This project integrates with Model Context Protocol (MCP), allowing interaction with the ToDo API via natural language.
Open a different terminal session and run:
$ npm run start:mcp
This command exposes the available tools (listed below) to MCP Clients.
Tool Name | Description | Parameters |
---|---|---|
create_list | Creates a new todo list | name: string |
get_all_lists | Returns all todo lists | (none) |
get_list_by_id | Returns a list by its ID | listId: string |
update_list | Updates a list by ID | listId: string, name: string |
delete_list | Deletes a list by ID | listId: string |
create_item | Creates a new item in a list | todoListId: string, description: string |
get_items_by_list | Gets all items for a list | listId: string |
get_item_by_id | Gets an item by ID | itemId: string |
update_item | Updates an item | itemId: string, description: string, completed: boolean |
complete_item | Marks an item as completed | itemId: string |
delete_item | Deletes an item | itemId: string |
If you are using Claude Desktop as a client, you need to configure it to connect to the MCP API server:
- Open Claude Desktop
- Go to Menu -> File -> Settings
- In the Developer section, click Add Config
- Open the claude_desktop_config file and paste the following:
{
"mcpServers": {
"todo-api": {
"command": "npm",
"args": [
"--silent",
"--prefix",
"/Users/yourUsername/yourPathToTheProject/toDoListAPI-MCP",
"run",
"start:mcp"
],
"cwd": "/Users/yourUsername/yourPathToTheProject/toDoListAPI-MCP"
}
}
}
Replace /Users/yourUsername/yourPathToTheProject/toDoListAPI-MCP with the absolute path to the root directory of your project.
Once configured, reopen Claude Desktop and it will connect to your local MCP server, allowing you to interact with the API using natural language.
→ "Create a new todo list called 'Work Tasks'"
MCP Client will call the create_list tool with:
{
"name": "Work Tasks"
}
→ "Add a new item 'Prepare presentation' to list 'Work Tasks'"
MCP Client will call create_item with:
{
"todoListId": "2",
"description": "Prepare presentation"
}