@remem/mcp-server 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.
package/README.ja.md ADDED
@@ -0,0 +1,225 @@
1
+ <div align="center">
2
+
3
+ <img src="./assets/logo.svg" alt="Remem ロゴ" width="120" />
4
+
5
+ # Remem
6
+
7
+ **記録する。日報を作る。いつでも振り返る。**
8
+
9
+ [![npm version](https://img.shields.io/npm/v/@remem/mcp-server.svg)](https://www.npmjs.com/package/@remem/mcp-server)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
11
+ [![Node.js](https://img.shields.io/badge/Node.js-24%2B-green.svg)](https://nodejs.org/)
12
+
13
+ [English](./README.md)
14
+
15
+ </div>
16
+
17
+ ---
18
+
19
+ ## 概要
20
+
21
+ **Remem** は、日々の活動を記録し、日報を自動生成し、長期間の振り返りを可能にするローカルファーストのMCP(Model Context Protocol)サーバーです。
22
+
23
+ - 📝 **記録** — 一日を通して作業、決定、メモを残す
24
+ - 📊 **日報生成** — 活動ログから自動で日報を作成
25
+ - 💾 **振り返り** — 数週間後、数ヶ月後でも過去を参照
26
+ - 🔒 **ローカル保存** — すべてSQLiteに保存
27
+
28
+ ---
29
+
30
+ ## クイックスタート
31
+
32
+ Claude Desktopの設定にRememを追加します:
33
+
34
+ ```json
35
+ {
36
+ "mcpServers": {
37
+ "remem": {
38
+ "command": "npx",
39
+ "args": ["-y", "@remem/mcp-server"]
40
+ }
41
+ }
42
+ }
43
+ ```
44
+
45
+ <details>
46
+ <summary>📁 設定ファイルの場所</summary>
47
+
48
+ | OS | パス |
49
+ |----|------|
50
+ | macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` |
51
+ | Windows | `%APPDATA%\Claude\claude_desktop_config.json` |
52
+
53
+ </details>
54
+
55
+ ---
56
+
57
+ ## 機能
58
+
59
+ | 機能 | 説明 |
60
+ |------|------|
61
+ | **アクティビティ記録** | 作業、決定、メモ、承認をリアルタイムで記録 |
62
+ | **スマート日報** | カスタマイズ可能なテンプレートで日報を生成 |
63
+ | **長期記憶** | 要約は永続保存され、将来の振り返りが可能 |
64
+ | **自動クリーンアップ** | 詳細ログは設定日数後に自動削除(デフォルト: 30日) |
65
+ | **多言語対応** | システム言語に自動適応(日本語/英語) |
66
+ | **プライバシー優先** | すべてのデータは `~/.remem/remem.db` にローカル保存 |
67
+
68
+ ---
69
+
70
+ ## ツール
71
+
72
+ Rememは以下のMCPツールを提供します:
73
+
74
+ ### `log`
75
+ アクティビティをデータベースに記録します。
76
+
77
+ ```
78
+ Type: work | decision | memo | approval
79
+ Content: アクティビティの説明
80
+ ```
81
+
82
+ ### `prepare_report`
83
+ ログを収集し、AIが日報を生成するためのデータを準備します。
84
+
85
+ ### `save_summary`
86
+ 生成された日報を長期ストレージに保存します。
87
+
88
+ ### `get_history`
89
+ 振り返りのために過去の要約を取得します(デフォルト: 過去6ヶ月)。
90
+
91
+ ### `configure`
92
+ `retention_days` や `default_template` などのサーバー設定を更新します。
93
+
94
+ ### `get_config`
95
+ 現在のサーバー設定を表示します。
96
+
97
+ ---
98
+
99
+ ## 仕組み
100
+
101
+ ```
102
+ ┌─────────────────────────────────────────────────────────────┐
103
+ │ あなたの一日 │
104
+ ├─────────────────────────────────────────────────────────────┤
105
+ │ 9:00 「PR #123をレビュー」 → log(work, ...) │
106
+ │ 11:00 「Kyselyの採用を決定」 → log(decision, ...) │
107
+ │ 15:00 「デプロイを承認」 → log(approval, ...) │
108
+ │ 18:00 「今日の日報を作成」 → prepare_report() │
109
+ │ AIが日報を作成 → save_summary() │
110
+ └─────────────────────────────────────────────────────────────┘
111
+
112
+
113
+ ┌─────────────────────────────────────────────────────────────┐
114
+ │ ~/.remem/remem.db │
115
+ ├─────────────────────────────────────────────────────────────┤
116
+ │ activities(30日後に期限切れ) │
117
+ │ daily_summaries(永続保存) │
118
+ └─────────────────────────────────────────────────────────────┘
119
+
120
+
121
+ ┌─────────────────────────────────────────────────────────────┐
122
+ │ 6ヶ月後 │
123
+ ├─────────────────────────────────────────────────────────────┤
124
+ │ 「前四半期に何をやったっけ?」 │
125
+ │ → get_history(months: 6) │
126
+ │ → AIがあなたの成長と成果をまとめる │
127
+ └─────────────────────────────────────────────────────────────┘
128
+ ```
129
+
130
+ ---
131
+
132
+ ## 設定
133
+
134
+ | キー | デフォルト | 説明 |
135
+ |------|-----------|------|
136
+ | `retention_days` | `30` | 詳細なアクティビティログの保持日数 |
137
+ | `default_template` | (組み込み) | 日報のMarkdownテンプレート |
138
+
139
+ `configure` ツールまたは `~/.remem/remem.db` を直接編集して設定できます。
140
+
141
+ ---
142
+
143
+ ## 開発
144
+
145
+ ```bash
146
+ # リポジトリをクローン
147
+ git clone https://github.com/remem-mcp/remem.git
148
+ cd remem
149
+
150
+ # 依存関係をインストール
151
+ npm install
152
+
153
+ # ビルド
154
+ npm run build
155
+
156
+ # テスト実行
157
+ npm test
158
+
159
+ # ローカルで実行
160
+ node build/index.js
161
+ ```
162
+
163
+ ### 技術スタック
164
+
165
+ - **ランタイム**: Node.js 24+
166
+ - **言語**: TypeScript
167
+ - **データベース**: SQLite(Kysely + better-sqlite3)
168
+ - **プロトコル**: MCP SDK
169
+ - **国際化**: i18next
170
+ - **テスト**: Vitest
171
+
172
+ ---
173
+
174
+ ## ロードマップ
175
+
176
+ - [ ] 履歴閲覧用のWeb UI
177
+ - [ ] Markdown/PDFエクスポート
178
+ - [ ] クラウドストレージ経由のチーム同期
179
+ - [ ] 多言語対応の拡充(中国語、韓国語、スペイン語など)
180
+ - [ ] VS Code拡張機能との統合
181
+
182
+ ---
183
+
184
+ ## コントリビュート
185
+
186
+ コントリビュートは大歓迎です!お気軽にPull Requestを送ってください。
187
+
188
+ 1. リポジトリをフォーク
189
+ 2. フィーチャーブランチを作成(`git checkout -b feature/amazing-feature`)
190
+ 3. [Conventional Commits](https://www.conventionalcommits.org/ja/) 形式でコミット
191
+ 4. ブランチにプッシュ(`git push origin feature/amazing-feature`)
192
+ 5. Pull Requestを作成
193
+
194
+ ### コミットメッセージの形式
195
+
196
+ このプロジェクトでは [Conventional Commits](https://www.conventionalcommits.org/ja/) を採用しています。
197
+
198
+ ```
199
+ <type>: <description>
200
+
201
+ [任意の本文]
202
+ ```
203
+
204
+ **Type:** `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`
205
+
206
+ **例:**
207
+ ```
208
+ feat: add weekly summary generation
209
+ fix: correct date parsing in prepare_report
210
+ docs: update installation instructions
211
+ ```
212
+
213
+ ---
214
+
215
+ ## ライセンス
216
+
217
+ MIT © [Remem Contributors](https://github.com/remem-mcp)
218
+
219
+ ---
220
+
221
+ <div align="center">
222
+
223
+ **[⬆ トップに戻る](#remem)**
224
+
225
+ </div>
package/README.md ADDED
@@ -0,0 +1,225 @@
1
+ <div align="center">
2
+
3
+ <img src="./assets/logo.svg" alt="Remem Logo" width="120" />
4
+
5
+ # Remem
6
+
7
+ **Log your day. Generate reports. Reflect anytime.**
8
+
9
+ [![npm version](https://img.shields.io/npm/v/@remem/mcp-server.svg)](https://www.npmjs.com/package/@remem/mcp-server)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
11
+ [![Node.js](https://img.shields.io/badge/Node.js-24%2B-green.svg)](https://nodejs.org/)
12
+
13
+ [日本語](./README.ja.md)
14
+
15
+ </div>
16
+
17
+ ---
18
+
19
+ ## Overview
20
+
21
+ **Remem** is a local-first MCP (Model Context Protocol) server that captures your daily activities, generates structured reports, and preserves summaries for long-term reflection.
22
+
23
+ - 📝 **Log** — Record your work, decisions, and memos throughout the day
24
+ - 📊 **Generate** — Create daily reports from your activity logs
25
+ - 💾 **Reflect** — Review past entries weeks or months later
26
+ - 🔒 **Local storage** — Everything stored in SQLite
27
+
28
+ ---
29
+
30
+ ## Quick Start
31
+
32
+ Add Remem to your Claude Desktop configuration:
33
+
34
+ ```json
35
+ {
36
+ "mcpServers": {
37
+ "remem": {
38
+ "command": "npx",
39
+ "args": ["-y", "@remem/mcp-server"]
40
+ }
41
+ }
42
+ }
43
+ ```
44
+
45
+ <details>
46
+ <summary>📁 Configuration file location</summary>
47
+
48
+ | OS | Path |
49
+ |----|------|
50
+ | macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` |
51
+ | Windows | `%APPDATA%\Claude\claude_desktop_config.json` |
52
+
53
+ </details>
54
+
55
+ ---
56
+
57
+ ## Features
58
+
59
+ | Feature | Description |
60
+ |---------|-------------|
61
+ | **Activity Logging** | Record work, decisions, memos, and approvals as you go |
62
+ | **Smart Reports** | Generate daily reports with customizable templates |
63
+ | **Long-term Memory** | Summaries are preserved indefinitely for future reflection |
64
+ | **Auto Cleanup** | Detailed logs expire after configurable days (default: 30) |
65
+ | **Multi-language** | Automatically adapts to your system language (EN/JA) |
66
+ | **Privacy First** | All data stored locally in `~/.remem/remem.db` |
67
+
68
+ ---
69
+
70
+ ## Tools
71
+
72
+ Remem provides the following MCP tools:
73
+
74
+ ### `log`
75
+ Record an activity to the database.
76
+
77
+ ```
78
+ Type: work | decision | memo | approval
79
+ Content: Description of the activity
80
+ ```
81
+
82
+ ### `prepare_report`
83
+ Gather logs and prepare data for AI to generate a daily report.
84
+
85
+ ### `save_summary`
86
+ Save the generated report summary to long-term storage.
87
+
88
+ ### `get_history`
89
+ Retrieve past summaries for reflection (default: last 6 months).
90
+
91
+ ### `configure`
92
+ Update server settings like `retention_days` or `default_template`.
93
+
94
+ ### `get_config`
95
+ View current server configuration.
96
+
97
+ ---
98
+
99
+ ## How It Works
100
+
101
+ ```
102
+ ┌─────────────────────────────────────────────────────────────┐
103
+ │ Your Day │
104
+ ├─────────────────────────────────────────────────────────────┤
105
+ │ 9:00 "Reviewed PR #123" → log(work, ...) │
106
+ │ 11:00 "Decided to use Kysely" → log(decision, ...) │
107
+ │ 15:00 "Approved deployment" → log(approval, ...) │
108
+ │ 18:00 "Generate today's report" → prepare_report() │
109
+ │ AI writes report → save_summary() │
110
+ └─────────────────────────────────────────────────────────────┘
111
+
112
+
113
+ ┌─────────────────────────────────────────────────────────────┐
114
+ │ ~/.remem/remem.db │
115
+ ├─────────────────────────────────────────────────────────────┤
116
+ │ activities (expires after 30 days) │
117
+ │ daily_summaries (permanent) │
118
+ └─────────────────────────────────────────────────────────────┘
119
+
120
+
121
+ ┌─────────────────────────────────────────────────────────────┐
122
+ │ 6 Months Later │
123
+ ├─────────────────────────────────────────────────────────────┤
124
+ │ "What did I work on last quarter?" │
125
+ │ → get_history(months: 6) │
126
+ │ → AI summarizes your growth and achievements │
127
+ └─────────────────────────────────────────────────────────────┘
128
+ ```
129
+
130
+ ---
131
+
132
+ ## Configuration
133
+
134
+ | Key | Default | Description |
135
+ |-----|---------|-------------|
136
+ | `retention_days` | `30` | Days to keep detailed activity logs |
137
+ | `default_template` | (built-in) | Markdown template for daily reports |
138
+
139
+ Configure via the `configure` tool or edit `~/.remem/remem.db` directly.
140
+
141
+ ---
142
+
143
+ ## Development
144
+
145
+ ```bash
146
+ # Clone the repository
147
+ git clone https://github.com/remem-mcp/remem.git
148
+ cd remem
149
+
150
+ # Install dependencies
151
+ npm install
152
+
153
+ # Build
154
+ npm run build
155
+
156
+ # Run tests
157
+ npm test
158
+
159
+ # Run locally
160
+ node build/index.js
161
+ ```
162
+
163
+ ### Tech Stack
164
+
165
+ - **Runtime**: Node.js 24+
166
+ - **Language**: TypeScript
167
+ - **Database**: SQLite (via Kysely + better-sqlite3)
168
+ - **Protocol**: MCP SDK
169
+ - **i18n**: i18next
170
+ - **Testing**: Vitest
171
+
172
+ ---
173
+
174
+ ## Roadmap
175
+
176
+ - [ ] Web UI for browsing history
177
+ - [ ] Export to Markdown/PDF
178
+ - [ ] Team sync via cloud storage
179
+ - [ ] More languages (zh, ko, es, ...)
180
+ - [ ] VS Code extension integration
181
+
182
+ ---
183
+
184
+ ## Contributing
185
+
186
+ Contributions are welcome! Please feel free to submit a Pull Request.
187
+
188
+ 1. Fork the repository
189
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
190
+ 3. Commit your changes using [Conventional Commits](https://www.conventionalcommits.org/)
191
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
192
+ 5. Open a Pull Request
193
+
194
+ ### Commit Message Format
195
+
196
+ This project follows [Conventional Commits](https://www.conventionalcommits.org/). Please use the following format:
197
+
198
+ ```
199
+ <type>: <description>
200
+
201
+ [optional body]
202
+ ```
203
+
204
+ **Types:** `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`
205
+
206
+ **Examples:**
207
+ ```
208
+ feat: add weekly summary generation
209
+ fix: correct date parsing in prepare_report
210
+ docs: update installation instructions
211
+ ```
212
+
213
+ ---
214
+
215
+ ## License
216
+
217
+ MIT © [Remem Contributors](https://github.com/remem-mcp)
218
+
219
+ ---
220
+
221
+ <div align="center">
222
+
223
+ **[⬆ Back to Top](#remem)**
224
+
225
+ </div>
package/build/index.js ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { z } from "zod";
5
+ import Database from "better-sqlite3";
6
+ import { join } from "node:path";
7
+ import { mkdirSync } from "node:fs";
8
+ import os from "node:os";
9
+ // --- 1. 環境設定 ---
10
+ const isJapanese = process.env.LANG?.startsWith("ja") || false;
11
+ const USER_DATA_PATH = join(os.homedir(), ".remem");
12
+ mkdirSync(USER_DATA_PATH, { recursive: true });
13
+ const db = new Database(join(USER_DATA_PATH, "remem.db"));
14
+ db.pragma('journal_mode = WAL');
15
+ // --- 2. DB初期化 ---
16
+ db.exec(`
17
+ CREATE TABLE IF NOT EXISTS activities (id INTEGER PRIMARY KEY, ts DATETIME DEFAULT CURRENT_TIMESTAMP, type TEXT, content TEXT);
18
+ CREATE TABLE IF NOT EXISTS daily_summaries (date TEXT PRIMARY KEY, summary TEXT);
19
+ CREATE TABLE IF NOT EXISTS config (key TEXT PRIMARY KEY, value TEXT);
20
+
21
+ INSERT OR IGNORE INTO config (key, value) VALUES ('retention_days', '30');
22
+ INSERT OR IGNORE INTO config (key, value) VALUES ('default_template', '## 📅 Daily Report\\n\\n### 🎯 Achievements\\n{{activities}}');
23
+ `);
24
+ const server = new McpServer({ name: "remem", version: "1.0.0" });
25
+ // --- 3. ツール実装 ---
26
+ server.tool("log", { type: z.enum(["work", "decision", "memo", "approval"]), content: z.string() }, async ({ type, content }) => {
27
+ db.prepare("INSERT INTO activities (type, content) VALUES (?, ?)").run(type, content);
28
+ return { content: [{ type: "text", text: isJapanese ? `✅ 記録完了 (${type})` : `✅ Logged (${type})` }] };
29
+ });
30
+ server.tool("prepare_report", { date: z.string().optional(), custom_instruction: z.string().optional() }, async ({ date, custom_instruction }) => {
31
+ const targetDate = date || new Date().toISOString().split('T')[0];
32
+ const logs = db.prepare("SELECT ts, type, content FROM activities WHERE date(ts, 'localtime') = ?").all(targetDate);
33
+ const template = db.prepare("SELECT value FROM config WHERE key = 'default_template'").get();
34
+ const retention = db.prepare("SELECT value FROM config WHERE key = 'retention_days'").get();
35
+ db.prepare("DELETE FROM activities WHERE ts < datetime('now', '-' || ? || ' days')").run(retention.value);
36
+ return {
37
+ content: [
38
+ { type: "text", text: `Logs: ${JSON.stringify(logs)}` },
39
+ { type: "text", text: `Template: ${template.value}` },
40
+ { type: "text", text: `Language: ${isJapanese ? 'Japanese' : 'English'}` },
41
+ { type: "text", text: custom_instruction || "" }
42
+ ]
43
+ };
44
+ });
45
+ // 保存・履歴取得ツールは前回同様
46
+ server.tool("save_summary", { date: z.string(), summary: z.string() }, async ({ date, summary }) => {
47
+ db.prepare("INSERT OR REPLACE INTO daily_summaries (date, summary) VALUES (?, ?)").run(date, summary);
48
+ return { content: [{ type: "text", text: "Saved." }] };
49
+ });
50
+ const transport = new StdioServerTransport();
51
+ await server.connect(transport);
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@remem/mcp-server",
3
+ "version": "0.0.1",
4
+ "description": "An MCP server for logging daily activities, generating reports, and long-term reflection.",
5
+ "type": "module",
6
+ "main": "./build/index.js",
7
+ "bin": {
8
+ "remem": "./build/index.js"
9
+ },
10
+ "files": [
11
+ "build",
12
+ "README.md"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsc",
16
+ "watch": "tsc -w",
17
+ "start": "node build/index.js",
18
+ "lint": "eslint src tests",
19
+ "lint:fix": "eslint src tests --fix",
20
+ "typecheck": "tsc --noEmit",
21
+ "test": "vitest",
22
+ "test:run": "vitest run"
23
+ },
24
+ "keywords": [
25
+ "mcp",
26
+ "mcp-server",
27
+ "sqlite",
28
+ "productivity",
29
+ "log",
30
+ "daily-report"
31
+ ],
32
+ "author": "",
33
+ "license": "MIT",
34
+ "dependencies": {
35
+ "@modelcontextprotocol/sdk": "^1.25.2",
36
+ "better-sqlite3": "^12.6.0",
37
+ "i18next": "^25.7.4",
38
+ "kysely": "^0.28.9",
39
+ "zod": "^4.3.5"
40
+ },
41
+ "devDependencies": {
42
+ "@eslint/js": "^9.39.2",
43
+ "@types/better-sqlite3": "^7.6.13",
44
+ "@types/node": "^25.0.5",
45
+ "eslint": "^9.39.2",
46
+ "typescript": "^5.9.3",
47
+ "typescript-eslint": "^8.52.0",
48
+ "vitest": "^3.1.1"
49
+ },
50
+ "engines": {
51
+ "node": ">=24.0.0"
52
+ }
53
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Database management for Remem using Kysely
3
+ */
4
+ import type { Activity, ConfigKey, DailySummary } from "./schema.js";
5
+ /**
6
+ * Database wrapper using Kysely for type-safe queries
7
+ */
8
+ export declare class RememDatabase {
9
+ private db;
10
+ private sqlite;
11
+ constructor(dbPath?: string);
12
+ /** Initialize database schema */
13
+ initialize(): Promise<void>;
14
+ /** Insert a new activity */
15
+ insertActivity(type: string, content: string): Promise<void>;
16
+ /** Get activities for a specific date */
17
+ getActivitiesByDate(date: string): Promise<Activity[]>;
18
+ /** Delete activities older than specified days */
19
+ cleanupOldActivities(retentionDays: number): Promise<number>;
20
+ /** Save or update a daily summary */
21
+ upsertSummary(date: string, summary: string): Promise<void>;
22
+ /** Get summaries for the past N months */
23
+ getSummariesByMonths(months: number): Promise<DailySummary[]>;
24
+ /** Get summary for a specific date */
25
+ getSummaryByDate(date: string): Promise<DailySummary | undefined>;
26
+ /** Get a config value */
27
+ getConfig(key: ConfigKey): Promise<string | undefined>;
28
+ /** Set a config value */
29
+ setConfig(key: ConfigKey, value: string): Promise<void>;
30
+ /** Get retention days as number */
31
+ getRetentionDays(): Promise<number>;
32
+ /** Get default template */
33
+ getDefaultTemplate(): Promise<string>;
34
+ /** Close the database connection */
35
+ close(): Promise<void>;
36
+ }
37
+ //# sourceMappingURL=database.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/database.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,YAAY,EAGb,MAAM,aAAa,CAAC;AAcrB;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,EAAE,CAAmB;IAC7B,OAAO,CAAC,MAAM,CAAyB;gBAE3B,MAAM,CAAC,EAAE,MAAM;IAc3B,iCAAiC;IAC3B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IA+CjC,4BAA4B;IACtB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlE,yCAAyC;IACnC,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAS5D,kDAAkD;IAC5C,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAYlE,qCAAqC;IAC/B,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQjE,0CAA0C;IACpC,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAWnE,sCAAsC;IAChC,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAUvE,yBAAyB;IACnB,SAAS,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAS5D,yBAAyB;IACnB,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ7D,mCAAmC;IAC7B,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;IAKzC,2BAA2B;IACrB,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAM3C,oCAAoC;IAC9B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
@@ -0,0 +1,158 @@
1
+ /**
2
+ * Database management for Remem using Kysely
3
+ */
4
+ import BetterSqlite3 from "better-sqlite3";
5
+ import { Kysely, SqliteDialect, sql } from "kysely";
6
+ import { mkdirSync } from "node:fs";
7
+ import os from "node:os";
8
+ import { join } from "node:path";
9
+ /** Default data directory */
10
+ const USER_DATA_PATH = join(os.homedir(), ".remem");
11
+ /** Default template for daily reports */
12
+ const DEFAULT_TEMPLATE = `## 📅 Daily Report
13
+
14
+ ### 🎯 Achievements
15
+ {{activities}}
16
+
17
+ ### 📝 Notes
18
+ {{notes}}`;
19
+ /**
20
+ * Database wrapper using Kysely for type-safe queries
21
+ */
22
+ export class RememDatabase {
23
+ db;
24
+ sqlite;
25
+ constructor(dbPath) {
26
+ const dataPath = dbPath ?? USER_DATA_PATH;
27
+ mkdirSync(dataPath, { recursive: true });
28
+ this.sqlite = new BetterSqlite3(join(dataPath, "remem.db"));
29
+ this.sqlite.pragma("journal_mode = WAL");
30
+ this.db = new Kysely({
31
+ dialect: new SqliteDialect({
32
+ database: this.sqlite,
33
+ }),
34
+ });
35
+ }
36
+ /** Initialize database schema */
37
+ async initialize() {
38
+ // Create activities table
39
+ await sql `
40
+ CREATE TABLE IF NOT EXISTS activities (
41
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
42
+ ts DATETIME DEFAULT CURRENT_TIMESTAMP,
43
+ type TEXT NOT NULL,
44
+ content TEXT NOT NULL
45
+ )
46
+ `.execute(this.db);
47
+ // Create daily_summaries table
48
+ await sql `
49
+ CREATE TABLE IF NOT EXISTS daily_summaries (
50
+ date TEXT PRIMARY KEY,
51
+ summary TEXT NOT NULL
52
+ )
53
+ `.execute(this.db);
54
+ // Create config table
55
+ await sql `
56
+ CREATE TABLE IF NOT EXISTS config (
57
+ key TEXT PRIMARY KEY,
58
+ value TEXT NOT NULL
59
+ )
60
+ `.execute(this.db);
61
+ // Create indexes
62
+ await sql `CREATE INDEX IF NOT EXISTS idx_activities_ts ON activities(ts)`.execute(this.db);
63
+ await sql `CREATE INDEX IF NOT EXISTS idx_activities_type ON activities(type)`.execute(this.db);
64
+ // Insert default config values
65
+ await this.db
66
+ .insertInto("config")
67
+ .values({ key: "retention_days", value: "30" })
68
+ .onConflict((oc) => oc.column("key").doNothing())
69
+ .execute();
70
+ await this.db
71
+ .insertInto("config")
72
+ .values({ key: "default_template", value: DEFAULT_TEMPLATE })
73
+ .onConflict((oc) => oc.column("key").doNothing())
74
+ .execute();
75
+ }
76
+ // --- Activities ---
77
+ /** Insert a new activity */
78
+ async insertActivity(type, content) {
79
+ const newActivity = { type, content };
80
+ await this.db.insertInto("activities").values(newActivity).execute();
81
+ }
82
+ /** Get activities for a specific date */
83
+ async getActivitiesByDate(date) {
84
+ return await this.db
85
+ .selectFrom("activities")
86
+ .selectAll()
87
+ .where(sql `date(ts)`, "=", date)
88
+ .orderBy("ts", "asc")
89
+ .execute();
90
+ }
91
+ /** Delete activities older than specified days */
92
+ async cleanupOldActivities(retentionDays) {
93
+ const result = await this.db
94
+ .deleteFrom("activities")
95
+ .where(sql `ts < datetime('now', '-' || ${retentionDays} || ' days')`)
96
+ .executeTakeFirst();
97
+ return Number(result.numDeletedRows);
98
+ }
99
+ // --- Summaries ---
100
+ /** Save or update a daily summary */
101
+ async upsertSummary(date, summary) {
102
+ await this.db
103
+ .insertInto("daily_summaries")
104
+ .values({ date, summary })
105
+ .onConflict((oc) => oc.column("date").doUpdateSet({ summary }))
106
+ .execute();
107
+ }
108
+ /** Get summaries for the past N months */
109
+ async getSummariesByMonths(months) {
110
+ return await this.db
111
+ .selectFrom("daily_summaries")
112
+ .selectAll()
113
+ .where(sql `date >= date('now', '-' || ${months} || ' months')`)
114
+ .orderBy("date", "asc")
115
+ .execute();
116
+ }
117
+ /** Get summary for a specific date */
118
+ async getSummaryByDate(date) {
119
+ return await this.db
120
+ .selectFrom("daily_summaries")
121
+ .selectAll()
122
+ .where("date", "=", date)
123
+ .executeTakeFirst();
124
+ }
125
+ // --- Config ---
126
+ /** Get a config value */
127
+ async getConfig(key) {
128
+ const row = await this.db
129
+ .selectFrom("config")
130
+ .select("value")
131
+ .where("key", "=", key)
132
+ .executeTakeFirst();
133
+ return row?.value;
134
+ }
135
+ /** Set a config value */
136
+ async setConfig(key, value) {
137
+ await this.db
138
+ .insertInto("config")
139
+ .values({ key, value })
140
+ .onConflict((oc) => oc.column("key").doUpdateSet({ value }))
141
+ .execute();
142
+ }
143
+ /** Get retention days as number */
144
+ async getRetentionDays() {
145
+ const value = await this.getConfig("retention_days");
146
+ return Number.parseInt(value ?? "30", 10);
147
+ }
148
+ /** Get default template */
149
+ async getDefaultTemplate() {
150
+ return (await this.getConfig("default_template")) ?? "";
151
+ }
152
+ // --- Lifecycle ---
153
+ /** Close the database connection */
154
+ async close() {
155
+ await this.db.destroy();
156
+ }
157
+ }
158
+ //# sourceMappingURL=database.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/database.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,aAAa,MAAM,gBAAgB,CAAC;AAC3C,OAA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AAiB;IAEjB,yBAAyB;IACzB,KAAK,CAAC,SAAS,CAAC,GAAc;QAC5B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,EAAE;aACtB,UAAU,CAAC,QAAQ,CAAC;aACpB,MAAM,CAAC,OAAO,CAAC;aACf,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC;aACtB,gBAAgB,EAAE,CAAC;QACtB,OAAO,GAAG,EAAE,KAAK,CAAC;IACpB,CAAC;IAED,yBAAyB;IACzB,KAAK,CAAC,SAAS,CAAC,GAAc,EAAE,KAAa;QAC3C,MAAM,IAAI,CAAC,EAAE;aACV,UAAU,CAAC,QAAQ,CAAC;aACpB,MAAM,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;aACtB,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;aAC3D,OAAO,EAAE,CAAC;IACf,CAAC;IAED,mCAAmC;IACnC,KAAK,CAAC,gBAAgB;QACpB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QACrD,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,2BAA2B;IAC3B,KAAK,CAAC,kBAAkB;QACtB,OAAO,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1D,CAAC;IAED,oBAAoB;IAEpB,oCAAoC;IACpC,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Internationalization setup using i18next
3
+ */
4
+ import { type TFunction } from "i18next";
5
+ /** Supported languages */
6
+ export type SupportedLanguage = "en" | "ja";
7
+ /** Detect language from environment */
8
+ export declare function detectLanguage(): SupportedLanguage;
9
+ /** Initialize i18next and return the t function */
10
+ export declare function initI18n(lng?: SupportedLanguage): Promise<TFunction>;
11
+ /** Get the current language */
12
+ export declare function getCurrentLanguage(): SupportedLanguage;
13
+ /** Get the t function (after initialization) */
14
+ export declare function getT(): TFunction;
15
+ //# sourceMappingURL=i18n.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/i18n.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAgB,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAKlD,0BAA0B;AAC1B,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,uCAAuC;AACvC,wBAAgB,cAAc,IAAI,iBAAiB,CAGlD;AAED,mDAAmD;AACnD,wBAAsB,QAAQ,CAAC,GAAG,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC,CAc1E;AAED,+BAA+B;AAC/B,wBAAgB,kBAAkB,IAAI,iBAAiB,CAEtD;AAED,gDAAgD;AAChD,wBAAgB,IAAI,IAAI,SAAS,CAEhC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Internationalization setup using i18next
3
+ */
4
+ import i18next from "i18next";
5
+ import en from "./locales/en.json" with { type: "json" };
6
+ import ja from "./locales/ja.json" with { type: "json" };
7
+ /** Detect language from environment */
8
+ export function detectLanguage() {
9
+ const lang = process.env.LANG ?? process.env.LANGUAGE ?? "";
10
+ return lang.startsWith("ja") ? "ja" : "en";
11
+ }
12
+ /** Initialize i18next and return the t function */
13
+ export async function initI18n(lng) {
14
+ await i18next.init({
15
+ lng: lng ?? detectLanguage(),
16
+ fallbackLng: "en",
17
+ interpolation: {
18
+ escapeValue: false, // Not needed for non-HTML output
19
+ },
20
+ resources: {
21
+ en: { translation: en },
22
+ ja: { translation: ja },
23
+ },
24
+ });
25
+ return i18next.t.bind(i18next);
26
+ }
27
+ /** Get the current language */
28
+ export function getCurrentLanguage() {
29
+ return i18next.language ?? "en";
30
+ }
31
+ /** Get the t function (after initialization) */
32
+ export function getT() {
33
+ return i18next.t.bind(i18next);
34
+ }
35
+ //# sourceMappingURL=i18n.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/i18n.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,OAA2B,MAAM,SAAS,CAAC;AAElD,OAAO,EAAE,MAAM,mBAAmB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACzD,OAAO,EAAE,MAAM,mBAAmB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAKzD,uCAAuC;AACvC,MAAM,UAAU,cAAc;IAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;IAC5D,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7C,CAAC;AAED,mDAAmD;AACnD,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,GAAuB;IACpD,MAAM,OAAO,CAAC,IAAI,CAAC;QACjB,GAAG,EAAE,GAAG,IAAI,cAAc,EAAE;QAC5B,WAAW,EAAE,IAAI;QACjB,aAAa,EAAE;YACb,WAAW,EAAE,KAAK,EAAE,iCAAiC;SACtD;QACD,SAAS,EAAE;YACT,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;YACvB,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;SACxB;KACF,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED,+BAA+B;AAC/B,MAAM,UAAU,kBAAkB;IAChC,OAAQ,OAAO,CAAC,QAA8B,IAAI,IAAI,CAAC;AACzD,CAAC;AAED,gDAAgD;AAChD,MAAM,UAAU,IAAI;IAClB,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Remem - MCP Server for Daily Activity Logging & Reporting
4
+ *
5
+ * A local MCP server that captures daily activities, generates reports,
6
+ * and preserves summaries for long-term reflection.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AACA;;;;;GAKG"}
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Remem - MCP Server for Daily Activity Logging & Reporting
4
+ *
5
+ * A local MCP server that captures daily activities, generates reports,
6
+ * and preserves summaries for long-term reflection.
7
+ */
8
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
9
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
10
+ import pkg from "../package.json" with { type: "json" };
11
+ import { RememDatabase } from "./database.js";
12
+ import { initI18n } from "./i18n.js";
13
+ import { registerTools } from "./tools.js";
14
+ /** Server metadata */
15
+ const SERVER_NAME = pkg.name;
16
+ const SERVER_VERSION = pkg.version;
17
+ /**
18
+ * Initialize and start the MCP server
19
+ */
20
+ async function main() {
21
+ // Initialize i18n
22
+ const t = await initI18n();
23
+ // Initialize database
24
+ const db = new RememDatabase();
25
+ await db.initialize();
26
+ // Create MCP server
27
+ const server = new McpServer({
28
+ name: SERVER_NAME,
29
+ version: SERVER_VERSION,
30
+ });
31
+ // Register all tools
32
+ registerTools(server, db, t);
33
+ // Setup graceful shutdown
34
+ const cleanup = async () => {
35
+ await db.close();
36
+ process.exit(0);
37
+ };
38
+ process.on("SIGINT", () => void cleanup());
39
+ process.on("SIGTERM", () => void cleanup());
40
+ // Connect via stdio transport
41
+ const transport = new StdioServerTransport();
42
+ await server.connect(transport);
43
+ }
44
+ // Start the server
45
+ main().catch((error) => {
46
+ console.error("Failed to start Remem server:", error);
47
+ process.exit(1);
48
+ });
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,GAAG,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,sBAAsB;AACtB,MAAM,WAAW,GAAG,GAAG,CAAC,IAAI,CAAC;AAC7B,MAAM,cAAc,GAAG,GAAG,CAAC,OAAO,CAAC;AAEnC;;GAEG;AACH,KAAK,UAAU,IAAI;IACjB,kBAAkB;IAClB,MAAM,CAAC,GAAG,MAAM,QAAQ,EAAE,CAAC;IAE3B,sBAAsB;IACtB,MAAM,EAAE,GAAG,IAAI,aAAa,EAAE,CAAC;IAC/B,MAAM,EAAE,CAAC,UAAU,EAAE,CAAC;IAEtB,oBAAoB;IACpB,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,cAAc;KACxB,CAAC,CAAC;IAEH,qBAAqB;IACrB,aAAa,CAAC,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAE7B,0BAA0B;IAC1B,MAAM,OAAO,GAAG,KAAK,IAAmB,EAAE;QACxC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;IAE5C,8BAA8B;IAC9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,mBAAmB;AACnB,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;IACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,33 @@
1
+ {
2
+ "log": {
3
+ "success": "✅ Logged ({{type}})"
4
+ },
5
+ "summary": {
6
+ "saved": "💾 Summary saved."
7
+ },
8
+ "config": {
9
+ "updated": "⚙️ Config updated: {{key}} = {{value}}",
10
+ "invalidRetention": "❌ retention_days must be a number between 1 and 365",
11
+ "current": "## Current Configuration",
12
+ "retentionDays": "retention_days",
13
+ "defaultTemplate": "default_template"
14
+ },
15
+ "report": {
16
+ "noLogs": "📭 No logs found for the specified date.",
17
+ "cleanedUp": "(🧹 Cleaned up {{count}} old log entries)",
18
+ "date": "Date: {{date}}",
19
+ "title": "## Report Data for {{date}}",
20
+ "logsHeader": "### Logs ({{count}} entries)",
21
+ "templateHeader": "### Template",
22
+ "languageHeader": "### Target Language: {{language}}",
23
+ "existingSummaryHeader": "### Existing Summary",
24
+ "instructionsHeader": "### Additional Instructions"
25
+ },
26
+ "history": {
27
+ "noSummaries": "No summaries found for the past {{months}} month(s). Use save_summary to persist daily reports.",
28
+ "title": "## Summary History ({{count}} days over {{months}} months)"
29
+ },
30
+ "language": {
31
+ "name": "English"
32
+ }
33
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "log": {
3
+ "success": "✅ 記録完了 ({{type}})"
4
+ },
5
+ "summary": {
6
+ "saved": "💾 保存しました。"
7
+ },
8
+ "config": {
9
+ "updated": "⚙️ 設定を更新しました: {{key}} = {{value}}",
10
+ "invalidRetention": "❌ retention_days は 1〜365 の数値で指定してください",
11
+ "current": "## 現在の設定",
12
+ "retentionDays": "保存日数",
13
+ "defaultTemplate": "デフォルトテンプレート"
14
+ },
15
+ "report": {
16
+ "noLogs": "📭 該当するログが見つかりませんでした。",
17
+ "cleanedUp": "(🧹 {{count}} 件の古いログを削除しました)",
18
+ "date": "日付: {{date}}",
19
+ "title": "## {{date}} のレポートデータ",
20
+ "logsHeader": "### ログ ({{count}} 件)",
21
+ "templateHeader": "### テンプレート",
22
+ "languageHeader": "### 出力言語: {{language}}",
23
+ "existingSummaryHeader": "### 既存の要約",
24
+ "instructionsHeader": "### 追加の指示"
25
+ },
26
+ "history": {
27
+ "noSummaries": "過去 {{months}} ヶ月分の要約が見つかりません。save_summary で日報を保存してください。",
28
+ "title": "## 要約履歴 ({{months}} ヶ月間で {{count}} 日分)"
29
+ },
30
+ "language": {
31
+ "name": "日本語"
32
+ }
33
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Kysely database schema types
3
+ */
4
+ import type { Generated, Insertable, Selectable, Updateable } from "kysely";
5
+ /** Activities table schema */
6
+ export interface ActivitiesTable {
7
+ id: Generated<number>;
8
+ ts: Generated<string>;
9
+ type: string;
10
+ content: string;
11
+ }
12
+ /** Daily summaries table schema */
13
+ export interface DailySummariesTable {
14
+ date: string;
15
+ summary: string;
16
+ }
17
+ /** Config table schema */
18
+ export interface ConfigTable {
19
+ key: string;
20
+ value: string;
21
+ }
22
+ /** Complete database schema */
23
+ export interface Database {
24
+ activities: ActivitiesTable;
25
+ daily_summaries: DailySummariesTable;
26
+ config: ConfigTable;
27
+ }
28
+ export type Activity = Selectable<ActivitiesTable>;
29
+ export type NewActivity = Insertable<ActivitiesTable>;
30
+ export type ActivityUpdate = Updateable<ActivitiesTable>;
31
+ export type DailySummary = Selectable<DailySummariesTable>;
32
+ export type NewDailySummary = Insertable<DailySummariesTable>;
33
+ export type Config = Selectable<ConfigTable>;
34
+ export type NewConfig = Insertable<ConfigTable>;
35
+ /** Activity types that can be logged */
36
+ export type ActivityType = "work" | "decision" | "memo" | "approval";
37
+ /** Configuration keys stored in the database */
38
+ export type ConfigKey = "retention_days" | "default_template";
39
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE5E,8BAA8B;AAC9B,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACtB,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,mCAAmC;AACnC,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,0BAA0B;AAC1B,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,+BAA+B;AAC/B,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,eAAe,CAAC;IAC5B,eAAe,EAAE,mBAAmB,CAAC;IACrC,MAAM,EAAE,WAAW,CAAC;CACrB;AAGD,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;AACnD,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;AACtD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;AAEzD,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;AAC3D,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;AAE9D,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;AAC7C,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;AAEhD,wCAAwC;AACxC,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,CAAC;AAErE,gDAAgD;AAChD,MAAM,MAAM,SAAS,GAAG,gBAAgB,GAAG,kBAAkB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Kysely database schema types
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/schema.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * MCP Tool definitions for Remem
3
+ */
4
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
5
+ import type { TFunction } from "i18next";
6
+ import type { RememDatabase } from "./database.js";
7
+ /**
8
+ * Register all MCP tools
9
+ */
10
+ export declare function registerTools(server: McpServer, db: RememDatabase, t: TFunction): void;
11
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAiBnD;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE,SAAS,GAAG,IAAI,CAmKtF"}
@@ -0,0 +1,147 @@
1
+ /**
2
+ * MCP Tool definitions for Remem
3
+ */
4
+ import { z } from "zod";
5
+ /** Activity type enum for validation */
6
+ const ActivityTypeSchema = z.enum(["work", "decision", "memo", "approval"]);
7
+ /** Date string in YYYY-MM-DD format */
8
+ const DateSchema = z
9
+ .string()
10
+ .regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format")
11
+ .describe("Date in YYYY-MM-DD format");
12
+ /** Get today's date in YYYY-MM-DD */
13
+ function getToday() {
14
+ return new Date().toISOString().split("T")[0];
15
+ }
16
+ /**
17
+ * Register all MCP tools
18
+ */
19
+ export function registerTools(server, db, t) {
20
+ // --- log: Record an activity ---
21
+ server.registerTool("log", {
22
+ description: "Record an activity (work, decision, memo, or approval) to the database",
23
+ inputSchema: {
24
+ type: ActivityTypeSchema.describe("Type of activity"),
25
+ content: z.string().min(1).describe("Content to remember"),
26
+ },
27
+ }, async ({ type, content }) => {
28
+ await db.insertActivity(type, content);
29
+ return {
30
+ content: [{ type: "text", text: t("log.success", { type }) }],
31
+ };
32
+ });
33
+ // --- prepare_report: Gather data for report generation ---
34
+ server.registerTool("prepare_report", {
35
+ description: "Gather logs and template for AI to generate a daily report",
36
+ inputSchema: {
37
+ date: DateSchema.optional().describe("Target date (defaults to today)"),
38
+ custom_instruction: z.string().optional().describe("Additional instructions for the AI"),
39
+ },
40
+ }, async ({ date, custom_instruction }) => {
41
+ const targetDate = date ?? getToday();
42
+ const logs = await db.getActivitiesByDate(targetDate);
43
+ const template = await db.getDefaultTemplate();
44
+ const existingSummary = await db.getSummaryByDate(targetDate);
45
+ // Cleanup old activities
46
+ const retentionDays = await db.getRetentionDays();
47
+ const deletedCount = await db.cleanupOldActivities(retentionDays);
48
+ if (logs.length === 0) {
49
+ return {
50
+ content: [
51
+ { type: "text", text: t("report.noLogs") },
52
+ { type: "text", text: t("report.date", { date: targetDate }) },
53
+ ],
54
+ };
55
+ }
56
+ return {
57
+ content: [
58
+ { type: "text", text: t("report.title", { date: targetDate }) },
59
+ { type: "text", text: `${t("report.logsHeader", { count: logs.length })}\n${JSON.stringify(logs, null, 2)}` },
60
+ { type: "text", text: `${t("report.templateHeader")}\n${template}` },
61
+ { type: "text", text: t("report.languageHeader", { language: t("language.name") }) },
62
+ ...(existingSummary
63
+ ? [{ type: "text", text: `${t("report.existingSummaryHeader")}\n${existingSummary.summary}` }]
64
+ : []),
65
+ ...(custom_instruction
66
+ ? [{ type: "text", text: `${t("report.instructionsHeader")}\n${custom_instruction}` }]
67
+ : []),
68
+ ...(deletedCount > 0
69
+ ? [{ type: "text", text: t("report.cleanedUp", { count: deletedCount }) }]
70
+ : []),
71
+ ],
72
+ };
73
+ });
74
+ // --- save_summary: Persist the generated summary ---
75
+ server.registerTool("save_summary", {
76
+ description: "Save the generated report summary to long-term storage",
77
+ inputSchema: {
78
+ date: DateSchema.describe("Date of the summary"),
79
+ summary: z.string().min(1).describe("Summarized report content"),
80
+ },
81
+ }, async ({ date, summary }) => {
82
+ await db.upsertSummary(date, summary);
83
+ return {
84
+ content: [{ type: "text", text: t("summary.saved") }],
85
+ };
86
+ });
87
+ // --- get_history: Retrieve past summaries ---
88
+ server.registerTool("get_history", {
89
+ description: "Retrieve past summaries for long-term reflection",
90
+ inputSchema: {
91
+ months: z.number().int().min(1).max(24).default(6).describe("Number of months to look back"),
92
+ },
93
+ }, async ({ months }) => {
94
+ const history = await db.getSummariesByMonths(months);
95
+ if (history.length === 0) {
96
+ return {
97
+ content: [{ type: "text", text: t("history.noSummaries", { months }) }],
98
+ };
99
+ }
100
+ return {
101
+ content: [
102
+ {
103
+ type: "text",
104
+ text: `${t("history.title", { count: history.length, months })}\n${JSON.stringify(history, null, 2)}`,
105
+ },
106
+ ],
107
+ };
108
+ });
109
+ // --- configure: Update server settings ---
110
+ server.registerTool("configure", {
111
+ description: "Update server configuration (retention_days, default_template)",
112
+ inputSchema: {
113
+ key: z.enum(["retention_days", "default_template"]).describe("Configuration key to update"),
114
+ value: z.string().min(1).describe("New value for the configuration"),
115
+ },
116
+ }, async ({ key, value }) => {
117
+ // Validate retention_days is a positive integer
118
+ if (key === "retention_days") {
119
+ const days = Number.parseInt(value, 10);
120
+ if (Number.isNaN(days) || days < 1 || days > 365) {
121
+ return {
122
+ content: [{ type: "text", text: t("config.invalidRetention") }],
123
+ };
124
+ }
125
+ }
126
+ await db.setConfig(key, value);
127
+ return {
128
+ content: [{ type: "text", text: t("config.updated", { key, value }) }],
129
+ };
130
+ });
131
+ // --- get_config: Read current configuration ---
132
+ server.registerTool("get_config", {
133
+ description: "Get current server configuration",
134
+ }, async () => {
135
+ const retentionDays = await db.getRetentionDays();
136
+ const template = await db.getDefaultTemplate();
137
+ return {
138
+ content: [
139
+ {
140
+ type: "text",
141
+ text: `${t("config.current")}\n- ${t("config.retentionDays")}: ${retentionDays}\n- ${t("config.defaultTemplate")}:\n\`\`\`\n${template}\n\`\`\``,
142
+ },
143
+ ],
144
+ };
145
+ });
146
+ }
147
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,wCAAwC;AACxC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AAE5E,uCAAuC;AACvC,MAAM,UAAU,GAAG,CAAC;KACjB,MAAM,EAAE;KACR,KAAK,CAAC,qBAAqB,EAAE,mCAAmC,CAAC;KACjE,QAAQ,CAAC,2BAA2B,CAAC,CAAC;AAEzC,qCAAqC;AACrC,SAAS,QAAQ;IACf,OAAO,IAAI,IAAI,EAAE,CAAC,WAA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" | "decision" | "memo" | "approval";
6
+ /** Configuration keys stored in the database */
7
+ export type ConfigKey = "retention_days" | "default_template";
8
+ /** Activity record from the database */
9
+ export interface Activity {
10
+ id: number;
11
+ ts: string;
12
+ type: ActivityType;
13
+ content: string;
14
+ }
15
+ /** Daily summary record */
16
+ export interface DailySummary {
17
+ date: string;
18
+ summary: string;
19
+ }
20
+ /** Configuration value wrapper */
21
+ export interface ConfigValue {
22
+ value: string;
23
+ }
24
+ /** Supported languages */
25
+ export type SupportedLanguage = "ja" | "en";
26
+ /** Localized message keys */
27
+ export interface Messages {
28
+ logSuccess: (type: ActivityType) => string;
29
+ summarySaved: string;
30
+ configUpdated: (key: ConfigKey, value: string) => string;
31
+ noLogsFound: string;
32
+ }
33
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wCAAwC;AACxC,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,CAAC;AAErE,gDAAgD;AAChD,MAAM,MAAM,SAAS,GAAG,gBAAgB,GAAG,kBAAkB,CAAC;AAE9D,wCAAwC;AACxC,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,2BAA2B;AAC3B,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,kCAAkC;AAClC,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,0BAA0B;AAC1B,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,6BAA6B;AAC7B,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,MAAM,CAAC;IAC3C,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACzD,WAAW,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Type definitions for Remem MCP Server
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@remem/mcp-server",
3
+ "version": "0.0.1",
4
+ "description": "An MCP server for logging daily activities, generating reports, and long-term reflection.",
5
+ "type": "module",
6
+ "main": "./build/index.js",
7
+ "bin": {
8
+ "remem": "./build/index.js"
9
+ },
10
+ "files": [
11
+ "build",
12
+ "README.md"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsc",
16
+ "watch": "tsc -w",
17
+ "start": "node build/index.js",
18
+ "lint": "eslint src tests",
19
+ "lint:fix": "eslint src tests --fix",
20
+ "typecheck": "tsc --noEmit",
21
+ "test": "vitest",
22
+ "test:run": "vitest run"
23
+ },
24
+ "keywords": [
25
+ "mcp",
26
+ "mcp-server",
27
+ "sqlite",
28
+ "productivity",
29
+ "log",
30
+ "daily-report"
31
+ ],
32
+ "author": "",
33
+ "license": "MIT",
34
+ "dependencies": {
35
+ "@modelcontextprotocol/sdk": "^1.25.2",
36
+ "better-sqlite3": "^12.6.0",
37
+ "i18next": "^25.7.4",
38
+ "kysely": "^0.28.9",
39
+ "zod": "^4.3.5"
40
+ },
41
+ "devDependencies": {
42
+ "@eslint/js": "^9.39.2",
43
+ "@types/better-sqlite3": "^7.6.13",
44
+ "@types/node": "^25.0.5",
45
+ "eslint": "^9.39.2",
46
+ "typescript": "^5.9.3",
47
+ "typescript-eslint": "^8.52.0",
48
+ "vitest": "^3.1.1"
49
+ },
50
+ "engines": {
51
+ "node": ">=24.0.0"
52
+ }
53
+ }