wakatime-mcp 0.0.1
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/CHANGELOG.md +22 -0
- data/LICENSE +21 -0
- data/README.md +139 -0
- data/bin/json_schemer +16 -0
- data/bin/wakatime_mcp +4 -0
- data/lib/wakatime_mcp/server.rb +44 -0
- data/lib/wakatime_mcp.rb +46 -0
- metadata +84 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 74f08cc25ca0fa9d0c8ceb77c2bd5580ca86259ddc5c308c7187baac9c679510
|
|
4
|
+
data.tar.gz: 49d4a4d19a04a9312fd5994ff1785ce1d555fd90f1d5e5f8c027f53d7e3f82c8
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: c3e1d3b19412e6267719b1c7007aab20ca3b04bf50963b5984100ab3785e698607e0ddb6a893a0c3e53428c8f9c584d2aa1932ebc62455ef803d73a485598f49
|
|
7
|
+
data.tar.gz: afc28672e872325ddd1442b4b8e82325e223608c19ac8be1b1e386a78153b1bcc6461ed1569d7937901f3b2785e7bdacf99ab5d8bab3469ab68f8d50fa6a7191
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.0.1] - 2026-01-21
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Initial release
|
|
14
|
+
- WakaTime MCP server implementation in Ruby
|
|
15
|
+
- `wakatime_summaries` tool - 指定期間の日次サマリを取得
|
|
16
|
+
- `wakatime_today` tool - 今日のサマリを取得
|
|
17
|
+
- Unit tests and integration tests
|
|
18
|
+
- Support for timezone parameter
|
|
19
|
+
- Support for project filtering
|
|
20
|
+
|
|
21
|
+
[Unreleased]: https://github.com/geeknees/wakatime-mcp-rb/compare/v0.0.1...HEAD
|
|
22
|
+
[0.0.1]: https://github.com/geeknees/wakatime-mcp-rb/releases/tag/v0.0.1
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025
|
|
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 all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# 🚀 wakatime-mcp-rb
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
|
|
5
|
+
WakaTime MCP server の Ruby 実装です。WakaTime Summaries API をラップし、stdio 経由で MCP ツールを公開します。
|
|
6
|
+
|
|
7
|
+
## 📋 概要
|
|
8
|
+
|
|
9
|
+
主な機能:
|
|
10
|
+
|
|
11
|
+
- 🔐 `WAKATIME_API_KEY` で認証
|
|
12
|
+
- 📊 日次サマリと今日のサマリを公開
|
|
13
|
+
- 💎 Ruby と mcp-rb を使用
|
|
14
|
+
|
|
15
|
+
## 🚀 クイックスタート
|
|
16
|
+
|
|
17
|
+
### インストール
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
gem install wakatime-mcp
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 実行
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
export WAKATIME_API_KEY="YOUR_API_KEY"
|
|
27
|
+
wakatime_mcp
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
WakaTime API キーは [WakaTime Settings](https://wakatime.com/settings/account) から取得できます。
|
|
31
|
+
|
|
32
|
+
## 🤖 MCP 設定
|
|
33
|
+
|
|
34
|
+
Claude Desktop などの MCP クライアント設定例:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"mcpServers": {
|
|
39
|
+
"wakatime": {
|
|
40
|
+
"command": "wakatime_mcp",
|
|
41
|
+
"env": {
|
|
42
|
+
"WAKATIME_API_KEY": "YOUR_API_KEY"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## 🧰 利用可能なツール
|
|
50
|
+
|
|
51
|
+
### `wakatime_summaries`
|
|
52
|
+
|
|
53
|
+
指定期間の日次サマリを取得します。
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"tool": "wakatime_summaries",
|
|
58
|
+
"arguments": {
|
|
59
|
+
"start": "2025-01-01",
|
|
60
|
+
"end": "2025-01-07",
|
|
61
|
+
"project": "my-project",
|
|
62
|
+
"timezone": "Asia/Tokyo"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
パラメータ:
|
|
68
|
+
- `start` (必須): 開始日 (YYYY-MM-DD)
|
|
69
|
+
- `end` (必須): 終了日 (YYYY-MM-DD)
|
|
70
|
+
- `project` (オプション): プロジェクト名でフィルタ
|
|
71
|
+
- `timezone` (オプション): タイムゾーン (例: Asia/Tokyo)
|
|
72
|
+
|
|
73
|
+
### `wakatime_today`
|
|
74
|
+
|
|
75
|
+
今日のサマリを取得します(デフォルトは Asia/Tokyo)。
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"tool": "wakatime_today",
|
|
80
|
+
"arguments": {
|
|
81
|
+
"project": "my-project",
|
|
82
|
+
"timezone": "Asia/Tokyo"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
パラメータ:
|
|
88
|
+
- `project` (オプション): プロジェクト名でフィルタ
|
|
89
|
+
- `timezone` (オプション): タイムゾーン (デフォルト: Asia/Tokyo)
|
|
90
|
+
|
|
91
|
+
## ⚙️ 設定
|
|
92
|
+
|
|
93
|
+
| 環境変数 | 説明 | 必須 |
|
|
94
|
+
| --- | --- | --- |
|
|
95
|
+
| `WAKATIME_API_KEY` | WakaTime API キー | ✅ |
|
|
96
|
+
|
|
97
|
+
WakaTime API キーは [WakaTime Settings](https://wakatime.com/settings/account) から取得できます。
|
|
98
|
+
|
|
99
|
+
## 🛠️ 開発
|
|
100
|
+
|
|
101
|
+
### セットアップ
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
git clone https://github.com/yourusername/wakatime-mcp-rb.git
|
|
105
|
+
cd wakatime-mcp-rb
|
|
106
|
+
bundle install
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### ローカルで実行
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
export WAKATIME_API_KEY="YOUR_API_KEY"
|
|
113
|
+
./bin/wakatime_mcp
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## 🧪 テスト
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# 全てのテストを実行
|
|
120
|
+
bundle exec rake test
|
|
121
|
+
|
|
122
|
+
# または
|
|
123
|
+
bundle exec rake
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
テストには以下のgemが使用されています:
|
|
127
|
+
- minitest - テストフレームワーク
|
|
128
|
+
- minitest-reporters - カラフルなテスト出力
|
|
129
|
+
- webmock - HTTPリクエストのモック
|
|
130
|
+
|
|
131
|
+
## 📚 参考
|
|
132
|
+
|
|
133
|
+
- [WakaTime MCP (TypeScript版)](https://github.com/geeknees/wakatime-mcp)
|
|
134
|
+
- [mcp-rb](https://github.com/funwarioisii/mcp-rb)
|
|
135
|
+
- [WakaTime API Documentation](https://wakatime.com/developers)
|
|
136
|
+
|
|
137
|
+
## 📝 ライセンス
|
|
138
|
+
|
|
139
|
+
MIT
|
data/bin/json_schemer
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'json_schemer' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
require "rubygems"
|
|
14
|
+
require "bundler/setup"
|
|
15
|
+
|
|
16
|
+
load Gem.bin_path("json_schemer", "json_schemer")
|
data/bin/wakatime_mcp
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "mcp"
|
|
4
|
+
require_relative "../wakatime_mcp"
|
|
5
|
+
|
|
6
|
+
name "wakatime-mcp"
|
|
7
|
+
version WakatimeMcp::VERSION
|
|
8
|
+
|
|
9
|
+
tool "wakatime_summaries" do
|
|
10
|
+
description "WakaTime Summaries API を叩き、指定期間の日次サマリ(JSON)を返します。"
|
|
11
|
+
|
|
12
|
+
argument :start, String, required: true, description: "YYYY-MM-DD"
|
|
13
|
+
argument :end, String, required: true, description: "YYYY-MM-DD"
|
|
14
|
+
argument :project, String, required: false, description: "プロジェクト名でフィルタ"
|
|
15
|
+
argument :timezone, String, required: false, description: "例: Asia/Tokyo"
|
|
16
|
+
|
|
17
|
+
call do |args|
|
|
18
|
+
WakatimeMcp.wakatime_get("users/current/summaries", {
|
|
19
|
+
start: args[:start],
|
|
20
|
+
end: args[:end],
|
|
21
|
+
project: args[:project],
|
|
22
|
+
tz: args[:timezone]
|
|
23
|
+
})
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
tool "wakatime_today" do
|
|
28
|
+
description "今日のサマリ(JSON)を返します(Asia/Tokyo をデフォルトにします)。"
|
|
29
|
+
|
|
30
|
+
argument :project, String, required: false, description: "プロジェクト名でフィルタ"
|
|
31
|
+
argument :timezone, String, required: false, description: "例: Asia/Tokyo"
|
|
32
|
+
|
|
33
|
+
call do |args|
|
|
34
|
+
tz = args[:timezone] || "Asia/Tokyo"
|
|
35
|
+
ymd = WakatimeMcp.today_ymd(tz)
|
|
36
|
+
|
|
37
|
+
WakatimeMcp.wakatime_get("users/current/summaries", {
|
|
38
|
+
start: ymd,
|
|
39
|
+
end: ymd,
|
|
40
|
+
project: args[:project],
|
|
41
|
+
tz: tz
|
|
42
|
+
})
|
|
43
|
+
end
|
|
44
|
+
end
|
data/lib/wakatime_mcp.rb
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "net/http"
|
|
4
|
+
require "json"
|
|
5
|
+
require "base64"
|
|
6
|
+
require "date"
|
|
7
|
+
|
|
8
|
+
module WakatimeMcp
|
|
9
|
+
VERSION = "0.0.1"
|
|
10
|
+
|
|
11
|
+
# WakaTime API helper
|
|
12
|
+
def self.wakatime_get(path, params = {})
|
|
13
|
+
api_key = ENV["WAKATIME_API_KEY"]
|
|
14
|
+
raise "環境変数 WAKATIME_API_KEY が未設定です(WakaTimeのAPI Key)。" unless api_key
|
|
15
|
+
|
|
16
|
+
uri = URI("https://api.wakatime.com/api/v1/#{path}")
|
|
17
|
+
uri.query = URI.encode_www_form(params.compact)
|
|
18
|
+
|
|
19
|
+
# WakaTime uses Basic auth with API key as username
|
|
20
|
+
auth = Base64.strict_encode64(api_key)
|
|
21
|
+
|
|
22
|
+
req = Net::HTTP::Get.new(uri)
|
|
23
|
+
req["Authorization"] = "Basic #{auth}"
|
|
24
|
+
req["Accept"] = "application/json"
|
|
25
|
+
|
|
26
|
+
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
|
|
27
|
+
http.request(req)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
unless res.is_a?(Net::HTTPSuccess)
|
|
31
|
+
raise "WakaTime API error: #{res.code}\n#{res.body}"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
res.body
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Get today's date in YYYY-MM-DD format for a given timezone
|
|
38
|
+
def self.today_ymd(timezone = "Asia/Tokyo")
|
|
39
|
+
# Ruby's Time with timezone support
|
|
40
|
+
time = Time.now.getlocal(timezone)
|
|
41
|
+
time.strftime("%Y-%m-%d")
|
|
42
|
+
rescue ArgumentError
|
|
43
|
+
# Fallback to UTC if timezone is invalid
|
|
44
|
+
Time.now.utc.strftime("%Y-%m-%d")
|
|
45
|
+
end
|
|
46
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: wakatime-mcp
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Masumi Kawasaki
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: base64
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0.2'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0.2'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: mcp-rb
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0.3'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0.3'
|
|
40
|
+
description: A Model Context Protocol server that exposes WakaTime summary tools via
|
|
41
|
+
stdio. Provides wakatime_summaries and wakatime_today tools for querying your coding
|
|
42
|
+
activity.
|
|
43
|
+
email:
|
|
44
|
+
- geeknees@gmail.com
|
|
45
|
+
executables:
|
|
46
|
+
- wakatime_mcp
|
|
47
|
+
extensions: []
|
|
48
|
+
extra_rdoc_files: []
|
|
49
|
+
files:
|
|
50
|
+
- CHANGELOG.md
|
|
51
|
+
- LICENSE
|
|
52
|
+
- README.md
|
|
53
|
+
- bin/json_schemer
|
|
54
|
+
- bin/wakatime_mcp
|
|
55
|
+
- lib/wakatime_mcp.rb
|
|
56
|
+
- lib/wakatime_mcp/server.rb
|
|
57
|
+
homepage: https://github.com/geeknees/wakatime-mcp-rb
|
|
58
|
+
licenses:
|
|
59
|
+
- MIT
|
|
60
|
+
metadata:
|
|
61
|
+
homepage_uri: https://github.com/geeknees/wakatime-mcp-rb
|
|
62
|
+
source_code_uri: https://github.com/geeknees/wakatime-mcp-rb
|
|
63
|
+
changelog_uri: https://github.com/geeknees/wakatime-mcp-rb/blob/main/CHANGELOG.md
|
|
64
|
+
bug_tracker_uri: https://github.com/geeknees/wakatime-mcp-rb/issues
|
|
65
|
+
documentation_uri: https://github.com/geeknees/wakatime-mcp-rb/blob/main/README.md
|
|
66
|
+
rubygems_mfa_required: 'true'
|
|
67
|
+
rdoc_options: []
|
|
68
|
+
require_paths:
|
|
69
|
+
- lib
|
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: 3.3.0
|
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
|
+
requirements:
|
|
77
|
+
- - ">="
|
|
78
|
+
- !ruby/object:Gem::Version
|
|
79
|
+
version: '0'
|
|
80
|
+
requirements: []
|
|
81
|
+
rubygems_version: 4.0.3
|
|
82
|
+
specification_version: 4
|
|
83
|
+
summary: WakaTime MCP server implementation in Ruby
|
|
84
|
+
test_files: []
|