ticktick-mcp-server 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +23 -0
- data/CHANGELOG.md +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +102 -0
- data/Rakefile +12 -0
- data/exe/ticktick-mcp-server +8 -0
- data/lib/ticktick/client.rb +42 -0
- data/lib/ticktick/errors.rb +21 -0
- data/lib/ticktick/http_connection.rb +64 -0
- data/lib/ticktick/mcp/server/error_handler.rb +28 -0
- data/lib/ticktick/mcp/server/tools/project/create_project.rb +59 -0
- data/lib/ticktick/mcp/server/tools/project/delete_project.rb +34 -0
- data/lib/ticktick/mcp/server/tools/project/get_project.rb +37 -0
- data/lib/ticktick/mcp/server/tools/project/get_project_data.rb +37 -0
- data/lib/ticktick/mcp/server/tools/project/list_projects.rb +29 -0
- data/lib/ticktick/mcp/server/tools/project/update_project.rb +63 -0
- data/lib/ticktick/mcp/server/tools/task/complete_task.rb +35 -0
- data/lib/ticktick/mcp/server/tools/task/create_task.rb +85 -0
- data/lib/ticktick/mcp/server/tools/task/delete_task.rb +35 -0
- data/lib/ticktick/mcp/server/tools/task/list_all_tasks.rb +29 -0
- data/lib/ticktick/mcp/server/tools/task/update_task.rb +88 -0
- data/lib/ticktick/mcp/server/version.rb +9 -0
- data/lib/ticktick/mcp/server.rb +33 -0
- data/lib/ticktick/resources/project_resource.rb +41 -0
- data/lib/ticktick/resources/task_attributes.rb +39 -0
- data/lib/ticktick/resources/task_resource.rb +48 -0
- data/mise.toml +2 -0
- data/sig/ticktick/mcp/server.rbs +8 -0
- metadata +102 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: cf9d114f051a0ddae817d5e1cc84a622bfbb057ee97cd8a1c68008bba0929833
|
|
4
|
+
data.tar.gz: 2678932d002e8c15e769fecb194c436fb69f0e7033dedd66fe8e10ccd39ed6b7
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 4610d280cf0ff4c90fe73542abdb1b2960c3ab8ca0c79c87c7e3ad5cdb6cd03518b51a96934a0c4c0f24143757a1a85fea2667eb8032fd41dae587fb701e44be
|
|
7
|
+
data.tar.gz: 8d972718c6c3f0d12fc028f0a61bccb5c3083e509e35863e9a9cc46877dd9e77832b64bb108c28d73dff8c9ffff7e6be6c2634b169aaee7dee622380a290ff99
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
TargetRubyVersion: 3.1
|
|
3
|
+
|
|
4
|
+
Style/StringLiterals:
|
|
5
|
+
EnforcedStyle: double_quotes
|
|
6
|
+
|
|
7
|
+
Style/StringLiteralsInInterpolation:
|
|
8
|
+
EnforcedStyle: double_quotes
|
|
9
|
+
|
|
10
|
+
Style/Documentation:
|
|
11
|
+
Enabled: false
|
|
12
|
+
|
|
13
|
+
Metrics/BlockLength:
|
|
14
|
+
Exclude:
|
|
15
|
+
- "spec/**/*_spec.rb"
|
|
16
|
+
|
|
17
|
+
Metrics/ParameterLists:
|
|
18
|
+
Exclude:
|
|
19
|
+
- "lib/ticktick/resources/task_attributes.rb"
|
|
20
|
+
- "lib/ticktick/resources/project_resource.rb"
|
|
21
|
+
- "lib/ticktick/mcp/server/tools/project/create_project.rb"
|
|
22
|
+
- "lib/ticktick/mcp/server/tools/project/update_project.rb"
|
|
23
|
+
- "lib/ticktick/mcp/server/tools/task/create_task.rb"
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.1.0] - 2026-02-21
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- MCP server providing tools to interact with the TickTick Open API
|
|
7
|
+
- Project management tools: list_projects, get_project, get_project_data, create_project, update_project, delete_project
|
|
8
|
+
- Task management tools: list_all_tasks, create_task, update_task, complete_task, delete_task
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 j-o-lantern0422
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# ticktick-mcp-server
|
|
2
|
+
|
|
3
|
+
A Ruby gem that exposes the [TickTick Open API](https://developer.ticktick.com/) as an [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) server. This allows LLMs like Claude to manage your TickTick projects and tasks directly.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Ruby >= 3.1.0
|
|
8
|
+
- A TickTick account with an Open API access token
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
Clone the repository and install the gem locally:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
git clone https://github.com/j-o-lantern0422/ticktick-mcp-server
|
|
16
|
+
cd ticktick-mcp-server
|
|
17
|
+
bundle install
|
|
18
|
+
bundle exec rake install
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Configuration
|
|
22
|
+
|
|
23
|
+
Set the following environment variable with your TickTick Open API access token:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
TICKTICK_ACCESS_TOKEN=your_access_token_here
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
You can obtain an access token from the TickTick Open API developer settings.
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
### Claude Desktop Integration
|
|
34
|
+
|
|
35
|
+
Add the following to your `claude_desktop_config.json`:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"mcpServers": {
|
|
40
|
+
"ticktick": {
|
|
41
|
+
"command": "ticktick-mcp-server",
|
|
42
|
+
"env": {
|
|
43
|
+
"TICKTICK_ACCESS_TOKEN": "your_access_token_here"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Running Locally Without Installing the Gem
|
|
51
|
+
|
|
52
|
+
If you prefer to run the server directly from the cloned repository:
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"mcpServers": {
|
|
57
|
+
"ticktick": {
|
|
58
|
+
"command": "bundle",
|
|
59
|
+
"args": ["exec", "exe/ticktick-mcp-server"],
|
|
60
|
+
"cwd": "/path/to/ticktick-mcp-server",
|
|
61
|
+
"env": {
|
|
62
|
+
"TICKTICK_ACCESS_TOKEN": "your_access_token_here"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Available Tools
|
|
70
|
+
|
|
71
|
+
### Project Management
|
|
72
|
+
|
|
73
|
+
| Tool | Description | Required Arguments |
|
|
74
|
+
|---|---|---|
|
|
75
|
+
| `list_projects` | List all projects | — |
|
|
76
|
+
| `get_project` | Get a project by ID | `project_id` |
|
|
77
|
+
| `get_project_data` | Get project details including tasks and columns | `project_id` |
|
|
78
|
+
| `create_project` | Create a new project | `name` |
|
|
79
|
+
| `update_project` | Update an existing project | `project_id` |
|
|
80
|
+
| `delete_project` | Delete a project | `project_id` |
|
|
81
|
+
|
|
82
|
+
### Task Management
|
|
83
|
+
|
|
84
|
+
| Tool | Description | Required Arguments |
|
|
85
|
+
|---|---|---|
|
|
86
|
+
| `list_all_tasks` | List all tasks across all projects | — |
|
|
87
|
+
| `create_task` | Create a new task | `title`, `project_id` |
|
|
88
|
+
| `update_task` | Update an existing task | `task_id`, `project_id` |
|
|
89
|
+
| `complete_task` | Mark a task as complete | `project_id`, `task_id` |
|
|
90
|
+
| `delete_task` | Delete a task | `project_id`, `task_id` |
|
|
91
|
+
|
|
92
|
+
## Development
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
bundle exec rake # Run tests + RuboCop
|
|
96
|
+
bundle exec rspec # Run tests only
|
|
97
|
+
bundle exec rubocop # Run linter only
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "errors"
|
|
4
|
+
require_relative "http_connection"
|
|
5
|
+
require_relative "resources/project_resource"
|
|
6
|
+
require_relative "resources/task_resource"
|
|
7
|
+
require_relative "resources/task_attributes"
|
|
8
|
+
|
|
9
|
+
module Ticktick
|
|
10
|
+
class Client
|
|
11
|
+
def initialize(token: ENV["TICKTICK_ACCESS_TOKEN"])
|
|
12
|
+
@connection = HttpConnection.new(token: token)
|
|
13
|
+
@projects = Resources::ProjectResource.new(@connection)
|
|
14
|
+
@tasks = Resources::TaskResource.new(@connection, @projects)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def list_projects = @projects.list
|
|
18
|
+
def get_project(id) = @projects.get(id)
|
|
19
|
+
def get_project_data(id) = @projects.get_data(id)
|
|
20
|
+
def create_project(...) = @projects.create(...)
|
|
21
|
+
def update_project(id, ...) = @projects.update(id, ...)
|
|
22
|
+
def list_all_tasks = @tasks.list_all
|
|
23
|
+
|
|
24
|
+
def create_task(title:, project_id:, **opts)
|
|
25
|
+
@tasks.create(Resources::TaskAttributes.new(title: title, project_id: project_id, **opts))
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def update_task(task_id:, project_id:, **opts)
|
|
29
|
+
@tasks.update(task_id, Resources::TaskAttributes.new(id: task_id, project_id: project_id, **opts))
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def complete_task(project_id:, task_id:)
|
|
33
|
+
@tasks.complete(project_id, task_id)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def delete_project(project_id:) = @projects.delete(project_id)
|
|
37
|
+
|
|
38
|
+
def delete_task(project_id:, task_id:)
|
|
39
|
+
@tasks.delete(project_id, task_id)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ticktick
|
|
4
|
+
module Errors
|
|
5
|
+
class Error < StandardError; end
|
|
6
|
+
|
|
7
|
+
class AuthenticationError < Error; end
|
|
8
|
+
|
|
9
|
+
class ApiError < Error
|
|
10
|
+
attr_reader :status, :body
|
|
11
|
+
|
|
12
|
+
def initialize(status:, body:)
|
|
13
|
+
@status = status
|
|
14
|
+
@body = body
|
|
15
|
+
super("HTTP #{status}: #{body}")
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class RateLimitError < ApiError; end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "faraday"
|
|
4
|
+
require "json"
|
|
5
|
+
require_relative "errors"
|
|
6
|
+
|
|
7
|
+
module Ticktick
|
|
8
|
+
class HttpConnection
|
|
9
|
+
API_BASE = "https://api.ticktick.com/open/v1"
|
|
10
|
+
RATE_LIMIT_ERROR_CODE = "exceed_query_limit"
|
|
11
|
+
|
|
12
|
+
def initialize(token:)
|
|
13
|
+
raise Errors::AuthenticationError, "Environment variable TICKTICK_ACCESS_TOKEN is not set" unless token
|
|
14
|
+
|
|
15
|
+
@conn = Faraday.new(url: API_BASE) do |f|
|
|
16
|
+
f.request :authorization, "Bearer", token
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def get(path)
|
|
21
|
+
handle_response(@conn.get(path))
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def post(path)
|
|
25
|
+
handle_response(@conn.post(path))
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def delete(path)
|
|
29
|
+
handle_response(@conn.delete(path))
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def post_json(path, body)
|
|
33
|
+
response = @conn.post(path) do |req|
|
|
34
|
+
req.headers["Content-Type"] = "application/json"
|
|
35
|
+
req.body = body.to_json
|
|
36
|
+
end
|
|
37
|
+
handle_response(response)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
private
|
|
41
|
+
|
|
42
|
+
def handle_response(response)
|
|
43
|
+
unless response.success?
|
|
44
|
+
raise_rate_limit_error!(response) if rate_limit_error?(response)
|
|
45
|
+
raise Errors::ApiError.new(status: response.status, body: response.body)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
return nil if response.body.nil? || response.body.empty?
|
|
49
|
+
|
|
50
|
+
JSON.parse(response.body)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def rate_limit_error?(response)
|
|
54
|
+
parsed = JSON.parse(response.body)
|
|
55
|
+
parsed["errorCode"] == RATE_LIMIT_ERROR_CODE
|
|
56
|
+
rescue JSON::ParserError
|
|
57
|
+
false
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def raise_rate_limit_error!(response)
|
|
61
|
+
raise Errors::RateLimitError.new(status: response.status, body: response.body)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ticktick
|
|
4
|
+
module Mcp
|
|
5
|
+
module Server
|
|
6
|
+
module ErrorHandler
|
|
7
|
+
RATE_LIMIT_MESSAGE = "TickTick API rate limit reached (max 100 requests/min). Please retry after 1 minute."
|
|
8
|
+
|
|
9
|
+
def error_response(text)
|
|
10
|
+
MCP::Tool::Response.new([{ type: "text", text: text }], error: true)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def handle_client_error(error)
|
|
14
|
+
case error
|
|
15
|
+
when Ticktick::Errors::AuthenticationError
|
|
16
|
+
error_response(error.message)
|
|
17
|
+
when Ticktick::Errors::RateLimitError
|
|
18
|
+
error_response(RATE_LIMIT_MESSAGE)
|
|
19
|
+
when Ticktick::Errors::ApiError
|
|
20
|
+
error_response("API error (HTTP #{error.status}): #{error.body}")
|
|
21
|
+
else
|
|
22
|
+
error_response("API request error: #{error.message}")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "mcp"
|
|
4
|
+
require_relative "../../error_handler"
|
|
5
|
+
|
|
6
|
+
module Ticktick
|
|
7
|
+
module Mcp
|
|
8
|
+
module Server
|
|
9
|
+
class CreateProject < MCP::Tool
|
|
10
|
+
tool_name "create_project"
|
|
11
|
+
|
|
12
|
+
description "Create a new TickTick project"
|
|
13
|
+
|
|
14
|
+
input_schema(
|
|
15
|
+
properties: {
|
|
16
|
+
name: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "Name of the project (required)"
|
|
19
|
+
},
|
|
20
|
+
color: {
|
|
21
|
+
type: "string",
|
|
22
|
+
description: 'Color of the project, e.g. "#F18181"'
|
|
23
|
+
},
|
|
24
|
+
sort_order: {
|
|
25
|
+
type: "integer",
|
|
26
|
+
description: "Sort order value of the project"
|
|
27
|
+
},
|
|
28
|
+
view_mode: {
|
|
29
|
+
type: "string",
|
|
30
|
+
description: 'View mode: "list", "kanban", or "timeline"'
|
|
31
|
+
},
|
|
32
|
+
kind: {
|
|
33
|
+
type: "string",
|
|
34
|
+
description: 'Project kind: "TASK" or "NOTE"'
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
required: ["name"]
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
class << self
|
|
41
|
+
include ErrorHandler
|
|
42
|
+
|
|
43
|
+
def call(name:, color: nil, sort_order: nil, view_mode: nil, kind: nil, _server_context: nil, **)
|
|
44
|
+
project = Ticktick::Client.new.create_project(
|
|
45
|
+
name: name,
|
|
46
|
+
color: color,
|
|
47
|
+
sort_order: sort_order,
|
|
48
|
+
view_mode: view_mode,
|
|
49
|
+
kind: kind
|
|
50
|
+
)
|
|
51
|
+
MCP::Tool::Response.new([{ type: "text", text: JSON.pretty_generate(project) }])
|
|
52
|
+
rescue Ticktick::Errors::Error, StandardError => e
|
|
53
|
+
handle_client_error(e)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "mcp"
|
|
4
|
+
require_relative "../../error_handler"
|
|
5
|
+
|
|
6
|
+
module Ticktick
|
|
7
|
+
module Mcp
|
|
8
|
+
module Server
|
|
9
|
+
class DeleteProject < MCP::Tool
|
|
10
|
+
tool_name "delete_project"
|
|
11
|
+
|
|
12
|
+
description "Delete a project in TickTick"
|
|
13
|
+
|
|
14
|
+
input_schema(
|
|
15
|
+
properties: {
|
|
16
|
+
project_id: { type: "string", description: "The ID of the project to delete (required)" }
|
|
17
|
+
},
|
|
18
|
+
required: %w[project_id]
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
class << self
|
|
22
|
+
include ErrorHandler
|
|
23
|
+
|
|
24
|
+
def call(project_id:, _server_context: nil, **)
|
|
25
|
+
Ticktick::Client.new.delete_project(project_id: project_id)
|
|
26
|
+
MCP::Tool::Response.new([{ type: "text", text: "Project #{project_id} deleted." }])
|
|
27
|
+
rescue Ticktick::Errors::Error, StandardError => e
|
|
28
|
+
handle_client_error(e)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "mcp"
|
|
4
|
+
require_relative "../../error_handler"
|
|
5
|
+
|
|
6
|
+
module Ticktick
|
|
7
|
+
module Mcp
|
|
8
|
+
module Server
|
|
9
|
+
class GetProject < MCP::Tool
|
|
10
|
+
tool_name "get_project"
|
|
11
|
+
|
|
12
|
+
description "Get a project by ID from TickTick"
|
|
13
|
+
|
|
14
|
+
input_schema(
|
|
15
|
+
properties: {
|
|
16
|
+
project_id: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "The ID of the project to retrieve"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
required: ["project_id"]
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
class << self
|
|
25
|
+
include ErrorHandler
|
|
26
|
+
|
|
27
|
+
def call(project_id:, _server_context: nil)
|
|
28
|
+
data = Ticktick::Client.new.get_project(project_id)
|
|
29
|
+
MCP::Tool::Response.new([{ type: "text", text: JSON.pretty_generate(data) }])
|
|
30
|
+
rescue Ticktick::Errors::Error, StandardError => e
|
|
31
|
+
handle_client_error(e)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "mcp"
|
|
4
|
+
require_relative "../../error_handler"
|
|
5
|
+
|
|
6
|
+
module Ticktick
|
|
7
|
+
module Mcp
|
|
8
|
+
module Server
|
|
9
|
+
class GetProjectData < MCP::Tool
|
|
10
|
+
tool_name "get_project_data"
|
|
11
|
+
|
|
12
|
+
description "Get project data including tasks and columns from TickTick"
|
|
13
|
+
|
|
14
|
+
input_schema(
|
|
15
|
+
properties: {
|
|
16
|
+
project_id: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "The ID of the project to retrieve data for"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
required: ["project_id"]
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
class << self
|
|
25
|
+
include ErrorHandler
|
|
26
|
+
|
|
27
|
+
def call(project_id:, _server_context: nil)
|
|
28
|
+
data = Ticktick::Client.new.get_project_data(project_id)
|
|
29
|
+
MCP::Tool::Response.new([{ type: "text", text: JSON.pretty_generate(data) }])
|
|
30
|
+
rescue Ticktick::Errors::Error, StandardError => e
|
|
31
|
+
handle_client_error(e)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "mcp"
|
|
4
|
+
require_relative "../../error_handler"
|
|
5
|
+
|
|
6
|
+
module Ticktick
|
|
7
|
+
module Mcp
|
|
8
|
+
module Server
|
|
9
|
+
class ListProjects < MCP::Tool
|
|
10
|
+
tool_name "list_projects"
|
|
11
|
+
|
|
12
|
+
description "List all projects from TickTick"
|
|
13
|
+
|
|
14
|
+
input_schema(properties: {})
|
|
15
|
+
|
|
16
|
+
class << self
|
|
17
|
+
include ErrorHandler
|
|
18
|
+
|
|
19
|
+
def call(_server_context: nil)
|
|
20
|
+
data = Ticktick::Client.new.list_projects
|
|
21
|
+
MCP::Tool::Response.new([{ type: "text", text: JSON.pretty_generate(data) }])
|
|
22
|
+
rescue Ticktick::Errors::Error, StandardError => e
|
|
23
|
+
handle_client_error(e)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "mcp"
|
|
4
|
+
require_relative "../../error_handler"
|
|
5
|
+
|
|
6
|
+
module Ticktick
|
|
7
|
+
module Mcp
|
|
8
|
+
module Server
|
|
9
|
+
class UpdateProject < MCP::Tool
|
|
10
|
+
tool_name "update_project"
|
|
11
|
+
|
|
12
|
+
description "Update an existing TickTick project's metadata"
|
|
13
|
+
|
|
14
|
+
input_schema(
|
|
15
|
+
properties: {
|
|
16
|
+
project_id: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "The ID of the project to update"
|
|
19
|
+
},
|
|
20
|
+
name: {
|
|
21
|
+
type: "string",
|
|
22
|
+
description: "New name of the project"
|
|
23
|
+
},
|
|
24
|
+
color: {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: 'New color of the project, e.g. "#F18181"'
|
|
27
|
+
},
|
|
28
|
+
sort_order: {
|
|
29
|
+
type: "integer",
|
|
30
|
+
description: "Sort order value of the project"
|
|
31
|
+
},
|
|
32
|
+
view_mode: {
|
|
33
|
+
type: "string",
|
|
34
|
+
description: 'View mode: "list", "kanban", or "timeline"'
|
|
35
|
+
},
|
|
36
|
+
kind: {
|
|
37
|
+
type: "string",
|
|
38
|
+
description: 'Project kind: "TASK" or "NOTE"'
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
required: ["project_id"]
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
class << self
|
|
45
|
+
include ErrorHandler
|
|
46
|
+
|
|
47
|
+
def call(project_id:, name: nil, color: nil, sort_order: nil,
|
|
48
|
+
view_mode: nil, kind: nil, _server_context: nil, **)
|
|
49
|
+
client = Ticktick::Client.new
|
|
50
|
+
project = client.update_project(
|
|
51
|
+
project_id,
|
|
52
|
+
name: name, color: color,
|
|
53
|
+
sort_order: sort_order, view_mode: view_mode, kind: kind
|
|
54
|
+
)
|
|
55
|
+
MCP::Tool::Response.new([{ type: "text", text: JSON.pretty_generate(project) }])
|
|
56
|
+
rescue Ticktick::Errors::Error, StandardError => e
|
|
57
|
+
handle_client_error(e)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "mcp"
|
|
4
|
+
require_relative "../../error_handler"
|
|
5
|
+
|
|
6
|
+
module Ticktick
|
|
7
|
+
module Mcp
|
|
8
|
+
module Server
|
|
9
|
+
class CompleteTask < MCP::Tool
|
|
10
|
+
tool_name "complete_task"
|
|
11
|
+
|
|
12
|
+
description "Mark a task as complete in TickTick"
|
|
13
|
+
|
|
14
|
+
input_schema(
|
|
15
|
+
properties: {
|
|
16
|
+
project_id: { type: "string", description: "Project ID the task belongs to (required)" },
|
|
17
|
+
task_id: { type: "string", description: "Task ID to complete (required)" }
|
|
18
|
+
},
|
|
19
|
+
required: %w[project_id task_id]
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
class << self
|
|
23
|
+
include ErrorHandler
|
|
24
|
+
|
|
25
|
+
def call(project_id:, task_id:, _server_context: nil, **)
|
|
26
|
+
Ticktick::Client.new.complete_task(project_id: project_id, task_id: task_id)
|
|
27
|
+
MCP::Tool::Response.new([{ type: "text", text: "Task #{task_id} marked as complete." }])
|
|
28
|
+
rescue Ticktick::Errors::Error, StandardError => e
|
|
29
|
+
handle_client_error(e)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "mcp"
|
|
4
|
+
require_relative "../../error_handler"
|
|
5
|
+
|
|
6
|
+
module Ticktick
|
|
7
|
+
module Mcp
|
|
8
|
+
module Server
|
|
9
|
+
class CreateTask < MCP::Tool
|
|
10
|
+
tool_name "create_task"
|
|
11
|
+
|
|
12
|
+
description "Create a new task in TickTick"
|
|
13
|
+
|
|
14
|
+
input_schema(
|
|
15
|
+
properties: {
|
|
16
|
+
title: { type: "string", description: "Task title (required)" },
|
|
17
|
+
project_id: { type: "string", description: "Project ID to add the task to (required)" },
|
|
18
|
+
content: { type: "string", description: "Task content" },
|
|
19
|
+
desc: { type: "string", description: "Description of checklist" },
|
|
20
|
+
is_all_day: { type: "boolean", description: "All day task" },
|
|
21
|
+
start_date: {
|
|
22
|
+
type: "string",
|
|
23
|
+
description: 'Start date in "yyyy-MM-dd\'T\'HH:mm:ssZ" format, e.g. "2019-11-13T03:00:00+0000"'
|
|
24
|
+
},
|
|
25
|
+
due_date: {
|
|
26
|
+
type: "string",
|
|
27
|
+
description: 'Due date in "yyyy-MM-dd\'T\'HH:mm:ssZ" format, e.g. "2019-11-13T03:00:00+0000"'
|
|
28
|
+
},
|
|
29
|
+
time_zone: { type: "string", description: 'Time zone, e.g. "America/Los_Angeles"' },
|
|
30
|
+
reminders: {
|
|
31
|
+
type: "array",
|
|
32
|
+
items: { type: "string" },
|
|
33
|
+
description: 'List of reminders, e.g. ["TRIGGER:P0DT9H0M0S"]'
|
|
34
|
+
},
|
|
35
|
+
repeat_flag: {
|
|
36
|
+
type: "string",
|
|
37
|
+
description: 'Recurring rule, e.g. "RRULE:FREQ=DAILY;INTERVAL=1"'
|
|
38
|
+
},
|
|
39
|
+
priority: {
|
|
40
|
+
type: "integer",
|
|
41
|
+
description: "Priority (0: none, 1: low, 3: medium, 5: high)"
|
|
42
|
+
},
|
|
43
|
+
sort_order: { type: "integer", description: "Sort order of the task" },
|
|
44
|
+
items: {
|
|
45
|
+
type: "array",
|
|
46
|
+
description: "List of subtasks",
|
|
47
|
+
items: {
|
|
48
|
+
type: "object",
|
|
49
|
+
properties: {
|
|
50
|
+
title: { type: "string" },
|
|
51
|
+
start_date: { type: "string" },
|
|
52
|
+
is_all_day: { type: "boolean" },
|
|
53
|
+
sort_order: { type: "integer" },
|
|
54
|
+
time_zone: { type: "string" },
|
|
55
|
+
status: { type: "integer" }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
required: %w[title project_id]
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
class << self
|
|
64
|
+
include ErrorHandler
|
|
65
|
+
|
|
66
|
+
def call(title:, project_id:, content: nil, desc: nil,
|
|
67
|
+
is_all_day: nil, start_date: nil, due_date: nil,
|
|
68
|
+
time_zone: nil, reminders: nil, repeat_flag: nil,
|
|
69
|
+
priority: nil, sort_order: nil, items: nil,
|
|
70
|
+
_server_context: nil, **)
|
|
71
|
+
task = Ticktick::Client.new.create_task(
|
|
72
|
+
title: title, project_id: project_id, content: content, desc: desc,
|
|
73
|
+
is_all_day: is_all_day, start_date: start_date, due_date: due_date,
|
|
74
|
+
time_zone: time_zone, reminders: reminders, repeat_flag: repeat_flag,
|
|
75
|
+
priority: priority, sort_order: sort_order, items: items
|
|
76
|
+
)
|
|
77
|
+
MCP::Tool::Response.new([{ type: "text", text: JSON.pretty_generate(task) }])
|
|
78
|
+
rescue Ticktick::Errors::Error, StandardError => e
|
|
79
|
+
handle_client_error(e)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "mcp"
|
|
4
|
+
require_relative "../../error_handler"
|
|
5
|
+
|
|
6
|
+
module Ticktick
|
|
7
|
+
module Mcp
|
|
8
|
+
module Server
|
|
9
|
+
class DeleteTask < MCP::Tool
|
|
10
|
+
tool_name "delete_task"
|
|
11
|
+
|
|
12
|
+
description "Delete a task in TickTick"
|
|
13
|
+
|
|
14
|
+
input_schema(
|
|
15
|
+
properties: {
|
|
16
|
+
project_id: { type: "string", description: "Project ID the task belongs to (required)" },
|
|
17
|
+
task_id: { type: "string", description: "Task ID to delete (required)" }
|
|
18
|
+
},
|
|
19
|
+
required: %w[project_id task_id]
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
class << self
|
|
23
|
+
include ErrorHandler
|
|
24
|
+
|
|
25
|
+
def call(project_id:, task_id:, _server_context: nil, **)
|
|
26
|
+
Ticktick::Client.new.delete_task(project_id: project_id, task_id: task_id)
|
|
27
|
+
MCP::Tool::Response.new([{ type: "text", text: "Task #{task_id} deleted." }])
|
|
28
|
+
rescue Ticktick::Errors::Error, StandardError => e
|
|
29
|
+
handle_client_error(e)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "mcp"
|
|
4
|
+
require_relative "../../error_handler"
|
|
5
|
+
|
|
6
|
+
module Ticktick
|
|
7
|
+
module Mcp
|
|
8
|
+
module Server
|
|
9
|
+
class ListAllTasks < MCP::Tool
|
|
10
|
+
tool_name "list_all_tasks"
|
|
11
|
+
|
|
12
|
+
description "List all tasks across all projects from TickTick"
|
|
13
|
+
|
|
14
|
+
input_schema(properties: {})
|
|
15
|
+
|
|
16
|
+
class << self
|
|
17
|
+
include ErrorHandler
|
|
18
|
+
|
|
19
|
+
def call(_server_context: nil)
|
|
20
|
+
tasks = Ticktick::Client.new.list_all_tasks
|
|
21
|
+
MCP::Tool::Response.new([{ type: "text", text: JSON.pretty_generate(tasks) }])
|
|
22
|
+
rescue Ticktick::Errors::Error, StandardError => e
|
|
23
|
+
handle_client_error(e)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "mcp"
|
|
4
|
+
require_relative "../../error_handler"
|
|
5
|
+
|
|
6
|
+
module Ticktick
|
|
7
|
+
module Mcp
|
|
8
|
+
module Server
|
|
9
|
+
class UpdateTask < MCP::Tool
|
|
10
|
+
tool_name "update_task"
|
|
11
|
+
|
|
12
|
+
description "Update an existing task in TickTick"
|
|
13
|
+
|
|
14
|
+
input_schema(
|
|
15
|
+
properties: {
|
|
16
|
+
task_id: { type: "string", description: "Task ID to update (required)" },
|
|
17
|
+
project_id: { type: "string", description: "Project ID the task belongs to (required)" },
|
|
18
|
+
title: { type: "string", description: "Task title" },
|
|
19
|
+
content: { type: "string", description: "Task content" },
|
|
20
|
+
desc: { type: "string", description: "Description of checklist" },
|
|
21
|
+
is_all_day: { type: "boolean", description: "All day task" },
|
|
22
|
+
start_date: {
|
|
23
|
+
type: "string",
|
|
24
|
+
description: 'Start date in "yyyy-MM-dd\'T\'HH:mm:ssZ" format, e.g. "2019-11-13T03:00:00+0000"'
|
|
25
|
+
},
|
|
26
|
+
due_date: {
|
|
27
|
+
type: "string",
|
|
28
|
+
description: 'Due date in "yyyy-MM-dd\'T\'HH:mm:ssZ" format, e.g. "2019-11-13T03:00:00+0000"'
|
|
29
|
+
},
|
|
30
|
+
time_zone: { type: "string", description: 'Time zone, e.g. "America/Los_Angeles"' },
|
|
31
|
+
reminders: {
|
|
32
|
+
type: "array",
|
|
33
|
+
items: { type: "string" },
|
|
34
|
+
description: 'List of reminders, e.g. ["TRIGGER:P0DT9H0M0S"]'
|
|
35
|
+
},
|
|
36
|
+
repeat_flag: {
|
|
37
|
+
type: "string",
|
|
38
|
+
description: 'Recurring rule, e.g. "RRULE:FREQ=DAILY;INTERVAL=1"'
|
|
39
|
+
},
|
|
40
|
+
priority: {
|
|
41
|
+
type: "integer",
|
|
42
|
+
description: "Priority (0: none, 1: low, 3: medium, 5: high)"
|
|
43
|
+
},
|
|
44
|
+
sort_order: { type: "integer", description: "Sort order of the task" },
|
|
45
|
+
items: {
|
|
46
|
+
type: "array",
|
|
47
|
+
description: "List of subtasks",
|
|
48
|
+
items: {
|
|
49
|
+
type: "object",
|
|
50
|
+
properties: {
|
|
51
|
+
title: { type: "string" },
|
|
52
|
+
start_date: { type: "string" },
|
|
53
|
+
is_all_day: { type: "boolean" },
|
|
54
|
+
sort_order: { type: "integer" },
|
|
55
|
+
time_zone: { type: "string" },
|
|
56
|
+
status: { type: "integer" }
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
required: %w[task_id project_id]
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
class << self
|
|
65
|
+
include ErrorHandler
|
|
66
|
+
|
|
67
|
+
# rubocop:disable Metrics/ParameterLists
|
|
68
|
+
def call(task_id:, project_id:, title: nil, content: nil, desc: nil,
|
|
69
|
+
is_all_day: nil, start_date: nil, due_date: nil,
|
|
70
|
+
time_zone: nil, reminders: nil, repeat_flag: nil,
|
|
71
|
+
priority: nil, sort_order: nil, items: nil,
|
|
72
|
+
_server_context: nil, **)
|
|
73
|
+
# rubocop:enable Metrics/ParameterLists
|
|
74
|
+
task = Ticktick::Client.new.update_task(
|
|
75
|
+
task_id: task_id, project_id: project_id, title: title, content: content, desc: desc,
|
|
76
|
+
is_all_day: is_all_day, start_date: start_date, due_date: due_date,
|
|
77
|
+
time_zone: time_zone, reminders: reminders, repeat_flag: repeat_flag,
|
|
78
|
+
priority: priority, sort_order: sort_order, items: items
|
|
79
|
+
)
|
|
80
|
+
MCP::Tool::Response.new([{ type: "text", text: JSON.pretty_generate(task) }])
|
|
81
|
+
rescue Ticktick::Errors::Error, StandardError => e
|
|
82
|
+
handle_client_error(e)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "mcp"
|
|
4
|
+
require_relative "../../ticktick/client"
|
|
5
|
+
require_relative "server/version"
|
|
6
|
+
require_relative "server/tools/project/list_projects"
|
|
7
|
+
require_relative "server/tools/project/get_project"
|
|
8
|
+
require_relative "server/tools/project/get_project_data"
|
|
9
|
+
require_relative "server/tools/task/list_all_tasks"
|
|
10
|
+
require_relative "server/tools/task/create_task"
|
|
11
|
+
require_relative "server/tools/task/update_task"
|
|
12
|
+
require_relative "server/tools/task/complete_task"
|
|
13
|
+
require_relative "server/tools/task/delete_task"
|
|
14
|
+
require_relative "server/tools/project/create_project"
|
|
15
|
+
require_relative "server/tools/project/update_project"
|
|
16
|
+
require_relative "server/tools/project/delete_project"
|
|
17
|
+
|
|
18
|
+
module Ticktick
|
|
19
|
+
module Mcp
|
|
20
|
+
module Server
|
|
21
|
+
class Error < StandardError; end
|
|
22
|
+
|
|
23
|
+
def self.build
|
|
24
|
+
MCP::Server.new(
|
|
25
|
+
name: "ticktick-mcp-server",
|
|
26
|
+
version: VERSION,
|
|
27
|
+
tools: [ListProjects, GetProject, GetProjectData, ListAllTasks,
|
|
28
|
+
CreateTask, UpdateTask, CompleteTask, DeleteTask, CreateProject, UpdateProject, DeleteProject]
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ticktick
|
|
4
|
+
module Resources
|
|
5
|
+
class ProjectResource
|
|
6
|
+
def initialize(connection)
|
|
7
|
+
@connection = connection
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def list
|
|
11
|
+
@connection.get("project")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def get(project_id)
|
|
15
|
+
@connection.get("project/#{project_id}")
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get_data(project_id)
|
|
19
|
+
@connection.get("project/#{project_id}/data")
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def create(name:, color: nil, sort_order: nil, view_mode: nil, kind: nil)
|
|
23
|
+
body = { name: name }
|
|
24
|
+
body[:color] = color if color
|
|
25
|
+
body[:sortOrder] = sort_order if sort_order
|
|
26
|
+
body[:viewMode] = view_mode if view_mode
|
|
27
|
+
body[:kind] = kind if kind
|
|
28
|
+
@connection.post_json("project", body)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def update(project_id, name: nil, color: nil, sort_order: nil, view_mode: nil, kind: nil)
|
|
32
|
+
body = { name: name, color: color, sortOrder: sort_order, viewMode: view_mode, kind: kind }.compact
|
|
33
|
+
@connection.post_json("project/#{project_id}", body)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def delete(project_id)
|
|
37
|
+
@connection.delete("project/#{project_id}")
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ticktick
|
|
4
|
+
module Resources
|
|
5
|
+
class TaskAttributes
|
|
6
|
+
# rubocop:disable Metrics/MethodLength
|
|
7
|
+
def initialize(title:, project_id:, id: nil, content: nil, desc: nil,
|
|
8
|
+
is_all_day: nil, start_date: nil, due_date: nil,
|
|
9
|
+
time_zone: nil, reminders: nil, repeat_flag: nil,
|
|
10
|
+
priority: nil, sort_order: nil, items: nil)
|
|
11
|
+
@id = id
|
|
12
|
+
@title = title
|
|
13
|
+
@project_id = project_id
|
|
14
|
+
@content = content
|
|
15
|
+
@desc = desc
|
|
16
|
+
@is_all_day = is_all_day
|
|
17
|
+
@start_date = start_date
|
|
18
|
+
@due_date = due_date
|
|
19
|
+
@time_zone = time_zone
|
|
20
|
+
@reminders = reminders
|
|
21
|
+
@repeat_flag = repeat_flag
|
|
22
|
+
@priority = priority
|
|
23
|
+
@sort_order = sort_order
|
|
24
|
+
@items = items
|
|
25
|
+
end
|
|
26
|
+
# rubocop:enable Metrics/MethodLength
|
|
27
|
+
|
|
28
|
+
def to_request_body
|
|
29
|
+
{
|
|
30
|
+
id: @id, title: @title, projectId: @project_id, content: @content,
|
|
31
|
+
desc: @desc, isAllDay: @is_all_day, startDate: @start_date,
|
|
32
|
+
dueDate: @due_date, timeZone: @time_zone, reminders: @reminders,
|
|
33
|
+
repeatFlag: @repeat_flag, priority: @priority,
|
|
34
|
+
sortOrder: @sort_order, items: @items
|
|
35
|
+
}.compact
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../errors"
|
|
4
|
+
|
|
5
|
+
module Ticktick
|
|
6
|
+
module Resources
|
|
7
|
+
class TaskResource
|
|
8
|
+
def initialize(connection, project_resource)
|
|
9
|
+
@connection = connection
|
|
10
|
+
@projects = project_resource
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def create(task_attrs)
|
|
14
|
+
@connection.post_json("task", task_attrs.to_request_body)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def update(task_id, task_attrs)
|
|
18
|
+
@connection.post_json("task/#{task_id}", task_attrs.to_request_body)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def complete(project_id, task_id)
|
|
22
|
+
@connection.post("project/#{project_id}/task/#{task_id}/complete")
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def delete(project_id, task_id)
|
|
26
|
+
@connection.delete("project/#{project_id}/task/#{task_id}")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def list_all
|
|
30
|
+
@projects.list.each_with_object([]) do |project, all_tasks|
|
|
31
|
+
collect_project_tasks(project, all_tasks)
|
|
32
|
+
rescue Errors::ApiError
|
|
33
|
+
next
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def collect_project_tasks(project, all_tasks)
|
|
40
|
+
data = @projects.get_data(project["id"])
|
|
41
|
+
(data["tasks"] || []).each do |task|
|
|
42
|
+
task["project_name"] = project["name"]
|
|
43
|
+
all_tasks << task
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
data/mise.toml
ADDED
metadata
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ticktick-mcp-server
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- j-o-lantern0422
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: faraday
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: mcp
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
40
|
+
description: A Model Context Protocol (MCP) server that provides tools to interact
|
|
41
|
+
with the TickTick API
|
|
42
|
+
email:
|
|
43
|
+
- j.o.lantern0422@gmail.com
|
|
44
|
+
executables:
|
|
45
|
+
- ticktick-mcp-server
|
|
46
|
+
extensions: []
|
|
47
|
+
extra_rdoc_files: []
|
|
48
|
+
files:
|
|
49
|
+
- ".rspec"
|
|
50
|
+
- ".rubocop.yml"
|
|
51
|
+
- CHANGELOG.md
|
|
52
|
+
- LICENSE.txt
|
|
53
|
+
- README.md
|
|
54
|
+
- Rakefile
|
|
55
|
+
- exe/ticktick-mcp-server
|
|
56
|
+
- lib/ticktick/client.rb
|
|
57
|
+
- lib/ticktick/errors.rb
|
|
58
|
+
- lib/ticktick/http_connection.rb
|
|
59
|
+
- lib/ticktick/mcp/server.rb
|
|
60
|
+
- lib/ticktick/mcp/server/error_handler.rb
|
|
61
|
+
- lib/ticktick/mcp/server/tools/project/create_project.rb
|
|
62
|
+
- lib/ticktick/mcp/server/tools/project/delete_project.rb
|
|
63
|
+
- lib/ticktick/mcp/server/tools/project/get_project.rb
|
|
64
|
+
- lib/ticktick/mcp/server/tools/project/get_project_data.rb
|
|
65
|
+
- lib/ticktick/mcp/server/tools/project/list_projects.rb
|
|
66
|
+
- lib/ticktick/mcp/server/tools/project/update_project.rb
|
|
67
|
+
- lib/ticktick/mcp/server/tools/task/complete_task.rb
|
|
68
|
+
- lib/ticktick/mcp/server/tools/task/create_task.rb
|
|
69
|
+
- lib/ticktick/mcp/server/tools/task/delete_task.rb
|
|
70
|
+
- lib/ticktick/mcp/server/tools/task/list_all_tasks.rb
|
|
71
|
+
- lib/ticktick/mcp/server/tools/task/update_task.rb
|
|
72
|
+
- lib/ticktick/mcp/server/version.rb
|
|
73
|
+
- lib/ticktick/resources/project_resource.rb
|
|
74
|
+
- lib/ticktick/resources/task_attributes.rb
|
|
75
|
+
- lib/ticktick/resources/task_resource.rb
|
|
76
|
+
- mise.toml
|
|
77
|
+
- sig/ticktick/mcp/server.rbs
|
|
78
|
+
homepage: https://github.com/j-o-lantern0422/ticktick-mcp-server
|
|
79
|
+
licenses:
|
|
80
|
+
- MIT
|
|
81
|
+
metadata:
|
|
82
|
+
homepage_uri: https://github.com/j-o-lantern0422/ticktick-mcp-server
|
|
83
|
+
source_code_uri: https://github.com/j-o-lantern0422/ticktick-mcp-server
|
|
84
|
+
changelog_uri: https://github.com/j-o-lantern0422/ticktick-mcp-server/blob/main/CHANGELOG.md
|
|
85
|
+
rdoc_options: []
|
|
86
|
+
require_paths:
|
|
87
|
+
- lib
|
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
|
+
requirements:
|
|
90
|
+
- - ">="
|
|
91
|
+
- !ruby/object:Gem::Version
|
|
92
|
+
version: 3.1.0
|
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
|
+
requirements:
|
|
95
|
+
- - ">="
|
|
96
|
+
- !ruby/object:Gem::Version
|
|
97
|
+
version: '0'
|
|
98
|
+
requirements: []
|
|
99
|
+
rubygems_version: 4.0.3
|
|
100
|
+
specification_version: 4
|
|
101
|
+
summary: MCP server for TickTick task management
|
|
102
|
+
test_files: []
|