@ebowwa/mcp-claude-code-history 1.2.6
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.md +360 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +805 -0
- package/dist/index.js.map +1 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
# @ebowwa/claude-code-history-mcp
|
|
2
|
+
|
|
3
|
+
MCP server for accessing Claude Code conversation history with useful context.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Recent Activity**: Quick overview of what was asked and done across all projects
|
|
8
|
+
- **Session Summaries**: Deep dive into sessions with topics, files, commands, and outcome
|
|
9
|
+
- **Enhanced Sessions**: List sessions with previews, durations, and message counts
|
|
10
|
+
- **Full History**: Retrieve complete conversation history with flexible filtering
|
|
11
|
+
- **Search**: Full-text search across all conversations
|
|
12
|
+
|
|
13
|
+
## Tools
|
|
14
|
+
|
|
15
|
+
### `get_recent_activity` (Recommended Starting Point)
|
|
16
|
+
Get recent activity across all projects - shows what was asked, what was done, and when.
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"name": "get_recent_activity",
|
|
21
|
+
"arguments": {
|
|
22
|
+
"limit": 10,
|
|
23
|
+
"includeSummaries": true
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
- Session ID and project name
|
|
30
|
+
- What was asked (first user message)
|
|
31
|
+
- What was done (summary)
|
|
32
|
+
- Time ago
|
|
33
|
+
- Message count
|
|
34
|
+
|
|
35
|
+
### `get_session_summary`
|
|
36
|
+
Get a detailed summary of a specific session.
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"name": "get_session_summary",
|
|
41
|
+
"arguments": {
|
|
42
|
+
"sessionId": "abc123",
|
|
43
|
+
"includeToolCalls": true
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
- Topics discussed
|
|
50
|
+
- Files involved
|
|
51
|
+
- Commands run
|
|
52
|
+
- Tools used
|
|
53
|
+
- Outcome (completed/with issues)
|
|
54
|
+
|
|
55
|
+
### `list_sessions`
|
|
56
|
+
List sessions with useful context - previews, durations, message counts.
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"name": "list_sessions",
|
|
61
|
+
"arguments": {
|
|
62
|
+
"projectPath": "/path/to/project",
|
|
63
|
+
"includePreviews": true
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### `get_current_session`
|
|
69
|
+
Get active session with project name, message count, latest prompt, time ago.
|
|
70
|
+
|
|
71
|
+
### `list_session_directories`
|
|
72
|
+
List session directories with previews and context instead of just UUIDs.
|
|
73
|
+
|
|
74
|
+
### `get_conversation_history`
|
|
75
|
+
Full conversation history (use when you need complete details).
|
|
76
|
+
|
|
77
|
+
### `search_conversations`
|
|
78
|
+
Full-text search across all conversations.
|
|
79
|
+
|
|
80
|
+
## Installation
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Install globally
|
|
84
|
+
npm install -g @ebowwa/claude-code-history-mcp
|
|
85
|
+
|
|
86
|
+
# Or run directly
|
|
87
|
+
bunx @ebowwa/claude-code-history-mcp
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## MCP Configuration
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"mcpServers": {
|
|
95
|
+
"claude-code-history": {
|
|
96
|
+
"command": "claude-code-history-mcp",
|
|
97
|
+
"description": "Claude Code conversation history with useful context"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Installation
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Install dependencies
|
|
107
|
+
bun install
|
|
108
|
+
|
|
109
|
+
# Build the package
|
|
110
|
+
bun run build
|
|
111
|
+
|
|
112
|
+
# Or install globally
|
|
113
|
+
bun link
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Configuration
|
|
117
|
+
|
|
118
|
+
The server can be configured via environment variables, ideally managed through Doppler:
|
|
119
|
+
|
|
120
|
+
### Environment Variables
|
|
121
|
+
|
|
122
|
+
| Variable | Description | Default |
|
|
123
|
+
|----------|-------------|---------|
|
|
124
|
+
| `CLAUDE_DIR` | Path to Claude Code directory | `~/.claude` |
|
|
125
|
+
| `DOPPLER_PROJECT` | Doppler project name (optional) | - |
|
|
126
|
+
| `DOPPLER_CONFIG` | Doppler config name | `dev` |
|
|
127
|
+
| `DOPPLER_TOKEN` | Doppler auth token | - |
|
|
128
|
+
|
|
129
|
+
### Using Doppler
|
|
130
|
+
|
|
131
|
+
1. **Install Doppler CLI**:
|
|
132
|
+
```bash
|
|
133
|
+
# macOS
|
|
134
|
+
brew install dopplerlabs/tap/doppler
|
|
135
|
+
|
|
136
|
+
# Linux
|
|
137
|
+
curl -sSL https://dl.doppler.com/install.sh | sh
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
2. **Configure your project**:
|
|
141
|
+
```bash
|
|
142
|
+
# Login to Doppler
|
|
143
|
+
doppler login
|
|
144
|
+
|
|
145
|
+
# Setup your project
|
|
146
|
+
doppler setup
|
|
147
|
+
|
|
148
|
+
# Set environment variables
|
|
149
|
+
doppler secrets set CLAUDE_DIR /path/to/.claude
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
3. **Run with Doppler**:
|
|
153
|
+
```bash
|
|
154
|
+
doppler run -- bun run start
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Example `.env` (for local development)
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
CLAUDE_DIR=/Users/yourname/.claude
|
|
161
|
+
DOPPLER_PROJECT=claude-code-history
|
|
162
|
+
DOPPLER_CONFIG=dev
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Usage
|
|
166
|
+
|
|
167
|
+
### As an MCP Server
|
|
168
|
+
|
|
169
|
+
Add to your Claude Code MCP configuration (`~/.claude/mcp.json` or similar):
|
|
170
|
+
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"mcpServers": {
|
|
174
|
+
"claude-code-history": {
|
|
175
|
+
"command": "doppler",
|
|
176
|
+
"args": [
|
|
177
|
+
"run",
|
|
178
|
+
"--",
|
|
179
|
+
"bun",
|
|
180
|
+
"/path/to/@mcp/claude-code-history/dist/index.js"
|
|
181
|
+
],
|
|
182
|
+
"env": {
|
|
183
|
+
"DOPPLER_PROJECT": "your-project-name",
|
|
184
|
+
"DOPPLER_CONFIG": "dev"
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Available Tools
|
|
192
|
+
|
|
193
|
+
#### 1. `list_projects`
|
|
194
|
+
List all Claude Code projects.
|
|
195
|
+
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"name": "list_projects",
|
|
199
|
+
"arguments": {}
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
#### 2. `list_sessions`
|
|
204
|
+
List sessions for a specific project or date range.
|
|
205
|
+
|
|
206
|
+
```json
|
|
207
|
+
{
|
|
208
|
+
"name": "list_sessions",
|
|
209
|
+
"arguments": {
|
|
210
|
+
"projectPath": "/path/to/project",
|
|
211
|
+
"startDate": "2024-01-01",
|
|
212
|
+
"endDate": "2024-12-31",
|
|
213
|
+
"timezone": "UTC"
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
#### 3. `get_conversation_history`
|
|
219
|
+
Get paginated conversation history with flexible filtering.
|
|
220
|
+
|
|
221
|
+
```json
|
|
222
|
+
{
|
|
223
|
+
"name": "get_conversation_history",
|
|
224
|
+
"arguments": {
|
|
225
|
+
"sessionId": "session-id",
|
|
226
|
+
"startDate": "2024-01-01",
|
|
227
|
+
"endDate": "2024-12-31",
|
|
228
|
+
"limit": 20,
|
|
229
|
+
"offset": 0,
|
|
230
|
+
"messageTypes": ["user", "assistant"],
|
|
231
|
+
"timezone": "UTC"
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
#### 4. `search_conversations`
|
|
237
|
+
Search across all conversations.
|
|
238
|
+
|
|
239
|
+
```json
|
|
240
|
+
{
|
|
241
|
+
"name": "search_conversations",
|
|
242
|
+
"arguments": {
|
|
243
|
+
"query": "database migration",
|
|
244
|
+
"limit": 30,
|
|
245
|
+
"projectPath": "/path/to/project",
|
|
246
|
+
"startDate": "2024-01-01",
|
|
247
|
+
"endDate": "2024-12-31",
|
|
248
|
+
"timezone": "UTC"
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
#### 5. `get_config`
|
|
254
|
+
Get current configuration (useful for debugging Doppler integration).
|
|
255
|
+
|
|
256
|
+
```json
|
|
257
|
+
{
|
|
258
|
+
"name": "get_config",
|
|
259
|
+
"arguments": {}
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Development
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# Development with hot reload
|
|
267
|
+
bun run dev
|
|
268
|
+
|
|
269
|
+
# Type checking
|
|
270
|
+
bun run typecheck
|
|
271
|
+
|
|
272
|
+
# Build
|
|
273
|
+
bun run build
|
|
274
|
+
|
|
275
|
+
# Start built server
|
|
276
|
+
bun run start
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## Examples
|
|
280
|
+
|
|
281
|
+
### Example 1: Find all conversations about "authentication"
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
# Search across all projects
|
|
285
|
+
search_conversations --query "authentication" --limit 10
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Example 2: Get conversation history for a specific date range
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
# Get conversations from January 2024
|
|
292
|
+
get_conversation_history --startDate "2024-01-01" --endDate "2024-01-31"
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Example 3: List sessions for a project
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
# List all sessions for a specific project
|
|
299
|
+
list_sessions --projectPath "/path/to/project"
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Example 4: Using Doppler for configuration
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
# Set custom Claude directory via Doppler
|
|
306
|
+
doppler secrets set CLAUDE_DIR /custom/path/.claude
|
|
307
|
+
|
|
308
|
+
# Run server with Doppler secrets
|
|
309
|
+
doppler run -- bun run start
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
## Workflow
|
|
313
|
+
|
|
314
|
+
The recommended workflow for using this MCP server:
|
|
315
|
+
|
|
316
|
+
1. **Start with `list_projects`** - Discover available projects
|
|
317
|
+
2. **Use `list_sessions`** - Browse sessions with optional date filtering
|
|
318
|
+
3. **Get detailed history with `get_conversation_history`** - Retrieve full conversations with pagination
|
|
319
|
+
4. **Search with `search_conversations`** - Find specific topics across all conversations
|
|
320
|
+
|
|
321
|
+
## Troubleshooting
|
|
322
|
+
|
|
323
|
+
### "No projects found"
|
|
324
|
+
|
|
325
|
+
- Ensure `CLAUDE_DIR` is set correctly
|
|
326
|
+
- Check that the directory exists and contains project subdirectories
|
|
327
|
+
- Try `get_config` to verify your configuration
|
|
328
|
+
|
|
329
|
+
### Doppler authentication issues
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
# Verify Doppler is authenticated
|
|
333
|
+
doppler me
|
|
334
|
+
|
|
335
|
+
# Check available projects
|
|
336
|
+
doppler projects
|
|
337
|
+
|
|
338
|
+
# Verify secrets are set
|
|
339
|
+
doppler secrets list
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### Large response sizes
|
|
343
|
+
|
|
344
|
+
- Use `messageTypes: ["user"]` to reduce data volume (default)
|
|
345
|
+
- Use `limit` parameter for pagination
|
|
346
|
+
- Use date range filters to narrow results
|
|
347
|
+
|
|
348
|
+
## Dependencies
|
|
349
|
+
|
|
350
|
+
This package requires the following workspace dependencies:
|
|
351
|
+
|
|
352
|
+
- `@ebowwa/claudecodehistory` - Core Claude Code history service library
|
|
353
|
+
|
|
354
|
+
## License
|
|
355
|
+
|
|
356
|
+
MIT
|
|
357
|
+
|
|
358
|
+
## Author
|
|
359
|
+
|
|
360
|
+
ebowwa
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* Claude Code History MCP Server
|
|
4
|
+
*
|
|
5
|
+
* MCP server for accessing Claude Code conversation history with useful context.
|
|
6
|
+
* Provides tools for listing projects, sessions, retrieving conversation history, and searching conversations.
|
|
7
|
+
* Enhanced to return useful data instead of just UUIDs.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;GAMG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,805 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* Claude Code History MCP Server
|
|
4
|
+
*
|
|
5
|
+
* MCP server for accessing Claude Code conversation history with useful context.
|
|
6
|
+
* Provides tools for listing projects, sessions, retrieving conversation history, and searching conversations.
|
|
7
|
+
* Enhanced to return useful data instead of just UUIDs.
|
|
8
|
+
*/
|
|
9
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
10
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
11
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
12
|
+
import { ClaudeCodeHistoryService } from "@ebowwa/claudecodehistory";
|
|
13
|
+
import { handleMCPOutput } from "@ebowwa/large-output";
|
|
14
|
+
import { homedir } from "os";
|
|
15
|
+
import { readFileSync, readdirSync, existsSync, statSync, createReadStream } from "fs";
|
|
16
|
+
import { join } from "path";
|
|
17
|
+
import { createInterface } from "readline";
|
|
18
|
+
function loadConfig() {
|
|
19
|
+
return {
|
|
20
|
+
claudeDir: process.env.CLAUDE_DIR || `${homedir()}/.claude`,
|
|
21
|
+
dopplerProject: process.env.DOPPLER_PROJECT,
|
|
22
|
+
dopplerConfig: process.env.DOPPLER_CONFIG || "dev",
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
// Initialize service lazily with Doppler-configured directory
|
|
26
|
+
let historyService = null;
|
|
27
|
+
function getHistoryService() {
|
|
28
|
+
if (!historyService) {
|
|
29
|
+
const config = loadConfig();
|
|
30
|
+
historyService = new ClaudeCodeHistoryService(config.claudeDir);
|
|
31
|
+
}
|
|
32
|
+
return historyService;
|
|
33
|
+
}
|
|
34
|
+
// Helper: Get the last line of history.jsonl
|
|
35
|
+
function getLastHistoryLine(config) {
|
|
36
|
+
const historyPath = join(config.claudeDir, "history.jsonl");
|
|
37
|
+
if (!existsSync(historyPath)) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const content = readFileSync(historyPath, "utf-8");
|
|
42
|
+
const lines = content.trim().split("\n");
|
|
43
|
+
if (lines.length === 0) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const lastLine = lines[lines.length - 1];
|
|
47
|
+
return JSON.parse(lastLine);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function listSessionDirectories(config, limit = 100, sort = "recent") {
|
|
54
|
+
const sessionEnvPath = join(config.claudeDir, "session-env");
|
|
55
|
+
if (!existsSync(sessionEnvPath)) {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
const entries = readdirSync(sessionEnvPath, { withFileTypes: true });
|
|
60
|
+
const sessions = [];
|
|
61
|
+
for (const entry of entries) {
|
|
62
|
+
if (!entry.isDirectory()) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const fullPath = join(sessionEnvPath, entry.name);
|
|
66
|
+
const stats = statSync(fullPath);
|
|
67
|
+
const sessionFiles = readdirSync(fullPath);
|
|
68
|
+
sessions.push({
|
|
69
|
+
uuid: entry.name,
|
|
70
|
+
lastModified: stats.mtime.toISOString(),
|
|
71
|
+
lastModifiedTimestamp: stats.mtimeMs,
|
|
72
|
+
isEmpty: sessionFiles.length === 0,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
// Sort
|
|
76
|
+
if (sort === "recent") {
|
|
77
|
+
sessions.sort((a, b) => b.lastModifiedTimestamp - a.lastModifiedTimestamp);
|
|
78
|
+
}
|
|
79
|
+
else if (sort === "oldest") {
|
|
80
|
+
sessions.sort((a, b) => a.lastModifiedTimestamp - b.lastModifiedTimestamp);
|
|
81
|
+
}
|
|
82
|
+
else if (sort === "name") {
|
|
83
|
+
sessions.sort((a, b) => a.uuid.localeCompare(b.uuid));
|
|
84
|
+
}
|
|
85
|
+
// Apply limit
|
|
86
|
+
if (limit > 0) {
|
|
87
|
+
return sessions.slice(0, limit);
|
|
88
|
+
}
|
|
89
|
+
return sessions;
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Helper: Format time ago
|
|
96
|
+
function getTimeAgo(date) {
|
|
97
|
+
const now = new Date();
|
|
98
|
+
const diffMs = now.getTime() - date.getTime();
|
|
99
|
+
const diffMins = Math.round(diffMs / 60000);
|
|
100
|
+
const diffHours = Math.round(diffMs / 3600000);
|
|
101
|
+
const diffDays = Math.round(diffMs / 86400000);
|
|
102
|
+
if (diffMins < 1)
|
|
103
|
+
return "just now";
|
|
104
|
+
if (diffMins < 60)
|
|
105
|
+
return `${diffMins}m ago`;
|
|
106
|
+
if (diffHours < 24)
|
|
107
|
+
return `${diffHours}h ago`;
|
|
108
|
+
return `${diffDays}d ago`;
|
|
109
|
+
}
|
|
110
|
+
// Helper: Parse "since" parameter to timestamp
|
|
111
|
+
function parseSince(since) {
|
|
112
|
+
if (!since)
|
|
113
|
+
return null;
|
|
114
|
+
const now = Date.now();
|
|
115
|
+
const dayMs = 86400000;
|
|
116
|
+
const hourMs = 3600000;
|
|
117
|
+
// Try ISO date first
|
|
118
|
+
if (since.includes("-") && since.length >= 10) {
|
|
119
|
+
const parsed = Date.parse(since);
|
|
120
|
+
if (!isNaN(parsed))
|
|
121
|
+
return parsed;
|
|
122
|
+
}
|
|
123
|
+
// Parse relative time strings
|
|
124
|
+
const lower = since.toLowerCase().trim();
|
|
125
|
+
// "yesterday" = start of yesterday
|
|
126
|
+
if (lower === "yesterday") {
|
|
127
|
+
const d = new Date();
|
|
128
|
+
d.setHours(0, 0, 0, 0);
|
|
129
|
+
return d.getTime() - dayMs;
|
|
130
|
+
}
|
|
131
|
+
// "today" = start of today
|
|
132
|
+
if (lower === "today") {
|
|
133
|
+
const d = new Date();
|
|
134
|
+
d.setHours(0, 0, 0, 0);
|
|
135
|
+
return d.getTime();
|
|
136
|
+
}
|
|
137
|
+
// "N days", "N days ago", "last N days"
|
|
138
|
+
const daysMatch = lower.match(/(?:last\s+)?(\d+)\s+days?(?:\s+ago)?/);
|
|
139
|
+
if (daysMatch) {
|
|
140
|
+
return now - (parseInt(daysMatch[1]) * dayMs);
|
|
141
|
+
}
|
|
142
|
+
// "N hours", "N hours ago", "last N hours"
|
|
143
|
+
const hoursMatch = lower.match(/(?:last\s+)?(\d+)\s+hours?(?:\s+ago)?/);
|
|
144
|
+
if (hoursMatch) {
|
|
145
|
+
return now - (parseInt(hoursMatch[1]) * hourMs);
|
|
146
|
+
}
|
|
147
|
+
// "N weeks", "last week"
|
|
148
|
+
const weeksMatch = lower.match(/(?:last\s+)?(\d+)\s+weeks?(?:\s+ago)?/);
|
|
149
|
+
if (weeksMatch) {
|
|
150
|
+
return now - (parseInt(weeksMatch[1]) * 7 * dayMs);
|
|
151
|
+
}
|
|
152
|
+
// "week", "this week" = start of current week (Sunday)
|
|
153
|
+
if (lower === "week" || lower === "this week") {
|
|
154
|
+
const d = new Date();
|
|
155
|
+
d.setHours(0, 0, 0, 0);
|
|
156
|
+
return d.getTime() - (d.getDay() * dayMs);
|
|
157
|
+
}
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
// Helper: Stream read first user message from session (fast - doesn't parse whole file)
|
|
161
|
+
async function getFirstUserMessageStream(claudeDir, sessionId) {
|
|
162
|
+
// Find the session's history file in projects directory
|
|
163
|
+
// Sessions are stored as: projects/{project}/{sessionId}.jsonl
|
|
164
|
+
const projectsDir = join(claudeDir, "projects");
|
|
165
|
+
if (!existsSync(projectsDir))
|
|
166
|
+
return null;
|
|
167
|
+
const projectDirs = readdirSync(projectsDir, { withFileTypes: true });
|
|
168
|
+
for (const projectDir of projectDirs) {
|
|
169
|
+
if (!projectDir.isDirectory())
|
|
170
|
+
continue;
|
|
171
|
+
// Session history files are stored directly in project directory
|
|
172
|
+
const historyPath = join(projectsDir, projectDir.name, `${sessionId}.jsonl`);
|
|
173
|
+
if (!existsSync(historyPath))
|
|
174
|
+
continue;
|
|
175
|
+
// Stream read until we find a user message
|
|
176
|
+
const fileStream = createReadStream(historyPath, { encoding: "utf-8" });
|
|
177
|
+
const rl = createInterface({
|
|
178
|
+
input: fileStream,
|
|
179
|
+
crlfDelay: Infinity,
|
|
180
|
+
});
|
|
181
|
+
try {
|
|
182
|
+
for await (const line of rl) {
|
|
183
|
+
if (!line.trim())
|
|
184
|
+
continue;
|
|
185
|
+
try {
|
|
186
|
+
const entry = JSON.parse(line);
|
|
187
|
+
if (entry.type === "user" && entry.message?.content) {
|
|
188
|
+
rl.close();
|
|
189
|
+
fileStream.destroy();
|
|
190
|
+
// User messages have content as string
|
|
191
|
+
const content = typeof entry.message.content === "string"
|
|
192
|
+
? entry.message.content
|
|
193
|
+
: Array.isArray(entry.message.content)
|
|
194
|
+
? entry.message.content.map((c) => c.text || "").join(" ")
|
|
195
|
+
: "";
|
|
196
|
+
return {
|
|
197
|
+
content,
|
|
198
|
+
projectPath: entry.cwd || projectDir.name,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
catch {
|
|
203
|
+
// Skip malformed lines
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
// File read error
|
|
209
|
+
}
|
|
210
|
+
finally {
|
|
211
|
+
rl.close();
|
|
212
|
+
fileStream.destroy();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
// Helper function to create response
|
|
218
|
+
const createResponse = (data) => ({
|
|
219
|
+
content: [
|
|
220
|
+
{
|
|
221
|
+
type: "text",
|
|
222
|
+
text: JSON.stringify(data, null, 2),
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
});
|
|
226
|
+
// Create MCP server
|
|
227
|
+
const server = new Server({
|
|
228
|
+
name: "@mcp/claude-code-history",
|
|
229
|
+
version: "1.2.0",
|
|
230
|
+
}, {
|
|
231
|
+
capabilities: {
|
|
232
|
+
tools: {},
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
// Define available tools (ordered by recommended workflow)
|
|
236
|
+
const tools = [
|
|
237
|
+
{
|
|
238
|
+
name: "list_projects",
|
|
239
|
+
description: "List all projects with Claude Code conversation history (start here to explore available data)",
|
|
240
|
+
inputSchema: {
|
|
241
|
+
type: "object",
|
|
242
|
+
properties: {},
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: "get_recent_activity",
|
|
247
|
+
description: "Get recent activity across all projects - shows what was asked, what was done, and when. Use this for a quick overview of recent work without dealing with UUIDs.",
|
|
248
|
+
inputSchema: {
|
|
249
|
+
type: "object",
|
|
250
|
+
properties: {
|
|
251
|
+
limit: {
|
|
252
|
+
type: "number",
|
|
253
|
+
description: "Number of recent sessions to show (default: 10)",
|
|
254
|
+
default: 10,
|
|
255
|
+
},
|
|
256
|
+
since: {
|
|
257
|
+
type: "string",
|
|
258
|
+
description: "Filter to sessions since a time. Examples: 'yesterday', '2 days', '1 week', 'today', 'last 5 hours', or ISO date '2026-02-01'",
|
|
259
|
+
},
|
|
260
|
+
includeSummaries: {
|
|
261
|
+
type: "boolean",
|
|
262
|
+
description: "Include brief summaries of what was done (default: true)",
|
|
263
|
+
default: true,
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
name: "list_sessions",
|
|
270
|
+
description: "List conversation sessions with useful context - includes message counts, duration, first message preview. Use after list_projects to find specific sessions.",
|
|
271
|
+
inputSchema: {
|
|
272
|
+
type: "object",
|
|
273
|
+
properties: {
|
|
274
|
+
projectPath: {
|
|
275
|
+
type: "string",
|
|
276
|
+
description: "Filter by specific project path (optional)",
|
|
277
|
+
},
|
|
278
|
+
startDate: {
|
|
279
|
+
type: "string",
|
|
280
|
+
description: "Start date in ISO format (optional)",
|
|
281
|
+
},
|
|
282
|
+
endDate: {
|
|
283
|
+
type: "string",
|
|
284
|
+
description: "End date in ISO format (optional)",
|
|
285
|
+
},
|
|
286
|
+
timezone: {
|
|
287
|
+
type: "string",
|
|
288
|
+
description: 'Timezone for date filtering (e.g., "Asia/Tokyo", "UTC"). Defaults to system timezone.',
|
|
289
|
+
},
|
|
290
|
+
includePreviews: {
|
|
291
|
+
type: "boolean",
|
|
292
|
+
description: "Include first message preview for each session (default: true)",
|
|
293
|
+
default: true,
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
name: "get_session_summary",
|
|
300
|
+
description: "Get a summary of a specific session - what was discussed, files modified, commands run, and outcome. More useful than raw conversation history.",
|
|
301
|
+
inputSchema: {
|
|
302
|
+
type: "object",
|
|
303
|
+
properties: {
|
|
304
|
+
sessionId: {
|
|
305
|
+
type: "string",
|
|
306
|
+
description: "Session ID to summarize",
|
|
307
|
+
},
|
|
308
|
+
includeToolCalls: {
|
|
309
|
+
type: "boolean",
|
|
310
|
+
description: "Include details of tool/API calls made (default: true)",
|
|
311
|
+
default: true,
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
required: ["sessionId"],
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
name: "get_conversation_history",
|
|
319
|
+
description: "Get ALL conversation history (use after exploring with list_projects/list_sessions for targeted data). Returns ALL matching conversations without pagination.",
|
|
320
|
+
inputSchema: {
|
|
321
|
+
type: "object",
|
|
322
|
+
properties: {
|
|
323
|
+
sessionId: {
|
|
324
|
+
type: "string",
|
|
325
|
+
description: "Specific session ID to get history for (optional)",
|
|
326
|
+
},
|
|
327
|
+
startDate: {
|
|
328
|
+
type: "string",
|
|
329
|
+
description: "Start date in ISO format (optional)",
|
|
330
|
+
},
|
|
331
|
+
endDate: {
|
|
332
|
+
type: "string",
|
|
333
|
+
description: "End date in ISO format (optional)",
|
|
334
|
+
},
|
|
335
|
+
messageTypes: {
|
|
336
|
+
type: "array",
|
|
337
|
+
items: {
|
|
338
|
+
type: "string",
|
|
339
|
+
enum: ["user", "assistant", "system", "result"],
|
|
340
|
+
},
|
|
341
|
+
description: 'Filter by specific message types. Defaults to ["user"] to reduce data volume. Use ["user", "assistant"] to include Claude responses.',
|
|
342
|
+
default: ["user"],
|
|
343
|
+
},
|
|
344
|
+
timezone: {
|
|
345
|
+
type: "string",
|
|
346
|
+
description: 'Timezone for date filtering (e.g., "Asia/Tokyo", "UTC"). Defaults to system timezone.',
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
name: "search_conversations",
|
|
353
|
+
description: "Search through conversation history by content (useful for finding specific topics across all conversations). Returns ALL matching conversations without pagination.",
|
|
354
|
+
inputSchema: {
|
|
355
|
+
type: "object",
|
|
356
|
+
properties: {
|
|
357
|
+
query: {
|
|
358
|
+
type: "string",
|
|
359
|
+
description: "Search query to find in conversation content",
|
|
360
|
+
},
|
|
361
|
+
projectPath: {
|
|
362
|
+
type: "string",
|
|
363
|
+
description: "Filter by specific project path (optional)",
|
|
364
|
+
},
|
|
365
|
+
startDate: {
|
|
366
|
+
type: "string",
|
|
367
|
+
description: "Start date in ISO format (optional)",
|
|
368
|
+
},
|
|
369
|
+
endDate: {
|
|
370
|
+
type: "string",
|
|
371
|
+
description: "End date in ISO format (optional)",
|
|
372
|
+
},
|
|
373
|
+
timezone: {
|
|
374
|
+
type: "string",
|
|
375
|
+
description: 'Timezone for date filtering (e.g., "Asia/Tokyo", "UTC"). Defaults to system timezone.',
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
required: ["query"],
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
name: "get_config",
|
|
383
|
+
description: "Get current configuration including Doppler integration status (useful for debugging)",
|
|
384
|
+
inputSchema: {
|
|
385
|
+
type: "object",
|
|
386
|
+
properties: {},
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
name: "get_current_session",
|
|
391
|
+
description: "Get the active Claude Code session with useful context - project name, message count, latest prompt, time ago.",
|
|
392
|
+
inputSchema: {
|
|
393
|
+
type: "object",
|
|
394
|
+
properties: {},
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
name: "list_session_directories",
|
|
399
|
+
description: "List session directories with useful context - project name, first message preview, and message count.",
|
|
400
|
+
inputSchema: {
|
|
401
|
+
type: "object",
|
|
402
|
+
properties: {
|
|
403
|
+
limit: {
|
|
404
|
+
type: "number",
|
|
405
|
+
description: "Maximum number of sessions to return (default: 20)",
|
|
406
|
+
default: 20,
|
|
407
|
+
},
|
|
408
|
+
sort: {
|
|
409
|
+
type: "string",
|
|
410
|
+
enum: ["name", "recent", "oldest"],
|
|
411
|
+
description: "Sort order: 'recent' for most recently modified (default)",
|
|
412
|
+
default: "recent",
|
|
413
|
+
},
|
|
414
|
+
},
|
|
415
|
+
},
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
name: "get_session_by_pid",
|
|
419
|
+
description: "Find Claude Code session UUID by process ID. Maps a PID to its Claude Code session by examining process hierarchy and matching against active sessions.",
|
|
420
|
+
inputSchema: {
|
|
421
|
+
type: "object",
|
|
422
|
+
properties: {
|
|
423
|
+
pid: {
|
|
424
|
+
type: "number",
|
|
425
|
+
description: "Process ID to find session for",
|
|
426
|
+
},
|
|
427
|
+
},
|
|
428
|
+
required: ["pid"],
|
|
429
|
+
},
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
name: "list_all_session_uuids",
|
|
433
|
+
description: "List all Claude Code session UUIDs from the session-env directory. Returns a complete list of session IDs without additional metadata. Use list_session_directories for more useful output.",
|
|
434
|
+
inputSchema: {
|
|
435
|
+
type: "object",
|
|
436
|
+
properties: {},
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
];
|
|
440
|
+
// Handle list tools request
|
|
441
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
442
|
+
return { tools };
|
|
443
|
+
});
|
|
444
|
+
// Handle tool calls
|
|
445
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
446
|
+
const { name, arguments: args } = request.params;
|
|
447
|
+
try {
|
|
448
|
+
switch (name) {
|
|
449
|
+
case "get_config": {
|
|
450
|
+
const config = loadConfig();
|
|
451
|
+
return createResponse({
|
|
452
|
+
config: {
|
|
453
|
+
claudeDir: config.claudeDir,
|
|
454
|
+
dopplerProject: config.dopplerProject || "not_set",
|
|
455
|
+
dopplerConfig: config.dopplerConfig,
|
|
456
|
+
},
|
|
457
|
+
environment: {
|
|
458
|
+
DOPPLER_TOKEN: process.env.DOPPLER_TOKEN ? "set" : "not_set",
|
|
459
|
+
CLAUDE_DIR: process.env.CLAUDE_DIR || "default",
|
|
460
|
+
},
|
|
461
|
+
timestamp: new Date().toISOString(),
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
case "list_projects": {
|
|
465
|
+
const service = getHistoryService();
|
|
466
|
+
const projects = await service.listProjects();
|
|
467
|
+
return createResponse(projects);
|
|
468
|
+
}
|
|
469
|
+
case "get_recent_activity": {
|
|
470
|
+
const limit = args?.limit ?? 10;
|
|
471
|
+
const sinceTimestamp = parseSince(args?.since);
|
|
472
|
+
// Use session directories (fast - just filesystem metadata)
|
|
473
|
+
const config = loadConfig();
|
|
474
|
+
// Get more than limit if we need to filter by time
|
|
475
|
+
const sessionDirs = listSessionDirectories(config, sinceTimestamp ? 500 : limit, "recent");
|
|
476
|
+
// Filter by time if since is specified
|
|
477
|
+
const filteredDirs = sinceTimestamp
|
|
478
|
+
? sessionDirs.filter(s => s.lastModifiedTimestamp >= sinceTimestamp)
|
|
479
|
+
: sessionDirs;
|
|
480
|
+
// Stream read first user message for each session (fast - stops after finding it)
|
|
481
|
+
const activity = await Promise.all(filteredDirs.slice(0, limit).map(async (s) => {
|
|
482
|
+
try {
|
|
483
|
+
const result = await getFirstUserMessageStream(config.claudeDir, s.uuid);
|
|
484
|
+
const asked = result?.content?.slice(0, 150) + (result?.content?.length > 150 ? "..." : "") || "No user message";
|
|
485
|
+
const project = result?.projectPath?.split("/").pop() || "unknown";
|
|
486
|
+
return {
|
|
487
|
+
sessionId: s.uuid,
|
|
488
|
+
project,
|
|
489
|
+
asked,
|
|
490
|
+
timeAgo: getTimeAgo(new Date(s.lastModified)),
|
|
491
|
+
lastActive: s.lastModified,
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
catch {
|
|
495
|
+
return {
|
|
496
|
+
sessionId: s.uuid,
|
|
497
|
+
project: "unknown",
|
|
498
|
+
asked: "Unable to load",
|
|
499
|
+
timeAgo: getTimeAgo(new Date(s.lastModified)),
|
|
500
|
+
lastActive: s.lastModified,
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
}));
|
|
504
|
+
return createResponse({
|
|
505
|
+
showing: activity.length,
|
|
506
|
+
since: args?.since || null,
|
|
507
|
+
sinceDate: sinceTimestamp ? new Date(sinceTimestamp).toISOString() : null,
|
|
508
|
+
activity,
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
case "list_sessions": {
|
|
512
|
+
const service = getHistoryService();
|
|
513
|
+
const sessions = await service.listSessions({
|
|
514
|
+
projectPath: args?.projectPath,
|
|
515
|
+
startDate: args?.startDate,
|
|
516
|
+
endDate: args?.endDate,
|
|
517
|
+
timezone: args?.timezone,
|
|
518
|
+
});
|
|
519
|
+
const includePreviews = args?.includePreviews ?? true;
|
|
520
|
+
// Enhance sessions with previews if requested
|
|
521
|
+
if (includePreviews && sessions.length > 0) {
|
|
522
|
+
const enhancedSessions = await Promise.all(sessions.map(async (session) => {
|
|
523
|
+
try {
|
|
524
|
+
// Only fetch 1 message for preview (faster)
|
|
525
|
+
const history = await service.getConversationHistory({
|
|
526
|
+
sessionId: session.sessionId,
|
|
527
|
+
limit: 1,
|
|
528
|
+
messageTypes: ["user"],
|
|
529
|
+
});
|
|
530
|
+
const firstMessage = history.entries[0]?.content || "";
|
|
531
|
+
const preview = firstMessage.slice(0, 100) + (firstMessage.length > 100 ? "..." : "");
|
|
532
|
+
// Calculate duration
|
|
533
|
+
const startTime = new Date(session.startTime).getTime();
|
|
534
|
+
const endTime = new Date(session.endTime).getTime();
|
|
535
|
+
const durationMs = endTime - startTime;
|
|
536
|
+
const duration = durationMs > 0
|
|
537
|
+
? `${Math.round(durationMs / 60000)}m`
|
|
538
|
+
: "N/A";
|
|
539
|
+
return {
|
|
540
|
+
sessionId: session.sessionId,
|
|
541
|
+
project: session.projectPath.split("/").pop() || session.projectPath,
|
|
542
|
+
preview,
|
|
543
|
+
messageCount: session.messageCount,
|
|
544
|
+
duration,
|
|
545
|
+
startTime: session.startTime,
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
catch {
|
|
549
|
+
return {
|
|
550
|
+
sessionId: session.sessionId,
|
|
551
|
+
project: session.projectPath.split("/").pop() || session.projectPath,
|
|
552
|
+
preview: "Unable to load",
|
|
553
|
+
messageCount: session.messageCount,
|
|
554
|
+
duration: "N/A",
|
|
555
|
+
startTime: session.startTime,
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
}));
|
|
559
|
+
return createResponse(enhancedSessions);
|
|
560
|
+
}
|
|
561
|
+
return createResponse(sessions);
|
|
562
|
+
}
|
|
563
|
+
case "get_session_summary": {
|
|
564
|
+
const service = getHistoryService();
|
|
565
|
+
const sessionId = args?.sessionId;
|
|
566
|
+
const includeToolCalls = args?.includeToolCalls ?? true;
|
|
567
|
+
if (!sessionId) {
|
|
568
|
+
throw new Error("Session ID is required");
|
|
569
|
+
}
|
|
570
|
+
// Get full conversation for this session
|
|
571
|
+
const history = await service.getConversationHistory({
|
|
572
|
+
sessionId,
|
|
573
|
+
limit: Number.MAX_SAFE_INTEGER,
|
|
574
|
+
messageTypes: ["user", "assistant"],
|
|
575
|
+
});
|
|
576
|
+
if (history.entries.length === 0) {
|
|
577
|
+
return createResponse({
|
|
578
|
+
found: false,
|
|
579
|
+
error: "No messages found for this session",
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
// Extract topics from user messages
|
|
583
|
+
const userMessages = history.entries.filter(e => e.type === "user");
|
|
584
|
+
const topics = userMessages
|
|
585
|
+
.map(m => m.content.slice(0, 100))
|
|
586
|
+
.filter(t => t.length > 10)
|
|
587
|
+
.slice(0, 5);
|
|
588
|
+
// Extract files and commands from assistant messages
|
|
589
|
+
const filesModified = [];
|
|
590
|
+
const commandsRun = [];
|
|
591
|
+
const toolsUsed = [];
|
|
592
|
+
if (includeToolCalls) {
|
|
593
|
+
for (const entry of history.entries) {
|
|
594
|
+
if (entry.type === "assistant") {
|
|
595
|
+
// Extract file paths
|
|
596
|
+
const fileMatches = entry.content.match(/(?:\/[\w.-]+)+\/[\w.-]+/g) || [];
|
|
597
|
+
filesModified.push(...fileMatches.slice(0, 3));
|
|
598
|
+
// Extract bash commands
|
|
599
|
+
const bashMatches = entry.content.match(/`([^`]{3,50})`/g) || [];
|
|
600
|
+
commandsRun.push(...bashMatches.map(m => m.replace(/`/g, "")).slice(0, 2));
|
|
601
|
+
// Extract tool mentions
|
|
602
|
+
const toolMatches = entry.content.match(/\b(Read|Write|Edit|Bash|Grep|Glob|Task)\b/g) || [];
|
|
603
|
+
toolsUsed.push(...toolMatches);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
// Get first and last message for context
|
|
608
|
+
const firstMessage = userMessages[0]?.content || "N/A";
|
|
609
|
+
const lastAssistant = [...history.entries].reverse().find(e => e.type === "assistant")?.content || "N/A";
|
|
610
|
+
// Determine outcome
|
|
611
|
+
const hasError = history.entries.some(e => e.content.toLowerCase().includes("error") ||
|
|
612
|
+
e.content.toLowerCase().includes("failed"));
|
|
613
|
+
const outcome = hasError ? "completed_with_issues" : "completed";
|
|
614
|
+
return createResponse({
|
|
615
|
+
sessionId,
|
|
616
|
+
projectPath: history.entries[0]?.projectPath || "unknown",
|
|
617
|
+
summary: {
|
|
618
|
+
totalMessages: history.entries.length,
|
|
619
|
+
userMessages: userMessages.length,
|
|
620
|
+
assistantMessages: history.entries.length - userMessages.length,
|
|
621
|
+
startTime: history.entries[0]?.timestamp,
|
|
622
|
+
endTime: history.entries[history.entries.length - 1]?.timestamp,
|
|
623
|
+
},
|
|
624
|
+
topics: [...new Set(topics)].slice(0, 5),
|
|
625
|
+
firstRequest: firstMessage.slice(0, 300),
|
|
626
|
+
finalResponse: lastAssistant.slice(0, 500),
|
|
627
|
+
filesInvolved: [...new Set(filesModified)].slice(0, 10),
|
|
628
|
+
commandsRun: [...new Set(commandsRun)].slice(0, 10),
|
|
629
|
+
toolsUsed: [...new Set(toolsUsed)],
|
|
630
|
+
outcome,
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
case "get_conversation_history": {
|
|
634
|
+
const service = getHistoryService();
|
|
635
|
+
const result = await service.getConversationHistory({
|
|
636
|
+
sessionId: args?.sessionId,
|
|
637
|
+
startDate: args?.startDate,
|
|
638
|
+
endDate: args?.endDate,
|
|
639
|
+
limit: Number.MAX_SAFE_INTEGER, // Get all results
|
|
640
|
+
offset: 0,
|
|
641
|
+
messageTypes: args?.messageTypes,
|
|
642
|
+
timezone: args?.timezone,
|
|
643
|
+
});
|
|
644
|
+
return {
|
|
645
|
+
content: [
|
|
646
|
+
{
|
|
647
|
+
type: "text",
|
|
648
|
+
text: handleMCPOutput(JSON.stringify(result, null, 2)),
|
|
649
|
+
},
|
|
650
|
+
],
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
case "search_conversations": {
|
|
654
|
+
const service = getHistoryService();
|
|
655
|
+
const query = args?.query;
|
|
656
|
+
if (!query) {
|
|
657
|
+
throw new Error("Search query is required");
|
|
658
|
+
}
|
|
659
|
+
const results = await service.searchConversations(query, {
|
|
660
|
+
limit: Number.MAX_SAFE_INTEGER, // Get all results
|
|
661
|
+
projectPath: args?.projectPath,
|
|
662
|
+
startDate: args?.startDate,
|
|
663
|
+
endDate: args?.endDate,
|
|
664
|
+
timezone: args?.timezone,
|
|
665
|
+
});
|
|
666
|
+
return {
|
|
667
|
+
content: [
|
|
668
|
+
{
|
|
669
|
+
type: "text",
|
|
670
|
+
text: handleMCPOutput(JSON.stringify(results, null, 2)),
|
|
671
|
+
},
|
|
672
|
+
],
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
case "get_current_session": {
|
|
676
|
+
const service = getHistoryService();
|
|
677
|
+
const session = await service.getCurrentSession();
|
|
678
|
+
if (!session) {
|
|
679
|
+
return createResponse({
|
|
680
|
+
found: false,
|
|
681
|
+
error: "No history file found or history is empty",
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
// Get additional context for the current session
|
|
685
|
+
let messageCount = 0;
|
|
686
|
+
let project = session.projectPath || "unknown";
|
|
687
|
+
let latestPrompt = session.display || "N/A";
|
|
688
|
+
try {
|
|
689
|
+
const history = await service.getConversationHistory({
|
|
690
|
+
sessionId: session.sessionId,
|
|
691
|
+
limit: 1000,
|
|
692
|
+
});
|
|
693
|
+
messageCount = history.entries.length;
|
|
694
|
+
project = history.entries[0]?.projectPath || project;
|
|
695
|
+
}
|
|
696
|
+
catch {
|
|
697
|
+
// Ignore errors getting additional context
|
|
698
|
+
}
|
|
699
|
+
return createResponse({
|
|
700
|
+
found: true,
|
|
701
|
+
sessionId: session.sessionId,
|
|
702
|
+
project: project.split("/").pop() || project,
|
|
703
|
+
projectPath: project,
|
|
704
|
+
latestPrompt,
|
|
705
|
+
messageCount,
|
|
706
|
+
timestamp: session.timestamp,
|
|
707
|
+
timeAgo: getTimeAgo(new Date(session.timestamp)),
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
case "list_session_directories": {
|
|
711
|
+
const service = getHistoryService();
|
|
712
|
+
const limit = args?.limit ?? 20;
|
|
713
|
+
const sort = args?.sort ?? "recent";
|
|
714
|
+
// Get all session UUIDs from session-env directory
|
|
715
|
+
const allUuids = await service.listAllSessionUuids();
|
|
716
|
+
// Get additional metadata by reading the session directories
|
|
717
|
+
const config = loadConfig();
|
|
718
|
+
const sessions = listSessionDirectories(config, 0, sort);
|
|
719
|
+
// Quick return - just UUIDs with timestamps (fast)
|
|
720
|
+
const quickSessions = sessions
|
|
721
|
+
.filter(s => allUuids.includes(s.uuid))
|
|
722
|
+
.slice(0, limit > 0 ? limit : 50)
|
|
723
|
+
.map(s => ({
|
|
724
|
+
sessionId: s.uuid,
|
|
725
|
+
lastActive: getTimeAgo(new Date(s.lastModified)),
|
|
726
|
+
isEmpty: s.isEmpty,
|
|
727
|
+
}));
|
|
728
|
+
return createResponse({
|
|
729
|
+
total: allUuids.length,
|
|
730
|
+
sessions: quickSessions,
|
|
731
|
+
returned: quickSessions.length,
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
case "get_session_by_pid": {
|
|
735
|
+
const service = getHistoryService();
|
|
736
|
+
const pid = args?.pid;
|
|
737
|
+
if (!pid || typeof pid !== "number") {
|
|
738
|
+
throw new Error("Valid PID is required");
|
|
739
|
+
}
|
|
740
|
+
const result = await service.getSessionByPid(pid);
|
|
741
|
+
if (!result) {
|
|
742
|
+
return createResponse({
|
|
743
|
+
found: false,
|
|
744
|
+
error: `No Claude Code session found for PID ${pid}`,
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
return createResponse({
|
|
748
|
+
found: true,
|
|
749
|
+
sessionId: result.sessionId,
|
|
750
|
+
pid: result.pid,
|
|
751
|
+
command: result.command,
|
|
752
|
+
alive: result.alive,
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
case "list_all_session_uuids": {
|
|
756
|
+
const service = getHistoryService();
|
|
757
|
+
const uuids = await service.listAllSessionUuids();
|
|
758
|
+
return createResponse({
|
|
759
|
+
count: uuids.length,
|
|
760
|
+
uuids,
|
|
761
|
+
note: "Use list_session_directories for more useful output with previews and context",
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
default:
|
|
765
|
+
return {
|
|
766
|
+
content: [
|
|
767
|
+
{
|
|
768
|
+
type: "text",
|
|
769
|
+
text: `Unknown tool: ${name}`,
|
|
770
|
+
},
|
|
771
|
+
],
|
|
772
|
+
isError: true,
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
catch (error) {
|
|
777
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
778
|
+
return {
|
|
779
|
+
content: [
|
|
780
|
+
{
|
|
781
|
+
type: "text",
|
|
782
|
+
text: `Error: ${errorMessage}`,
|
|
783
|
+
},
|
|
784
|
+
],
|
|
785
|
+
isError: true,
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
// Start server
|
|
790
|
+
async function main() {
|
|
791
|
+
const config = loadConfig();
|
|
792
|
+
const transport = new StdioServerTransport();
|
|
793
|
+
await server.connect(transport);
|
|
794
|
+
console.error("Claude Code History MCP server running on stdio");
|
|
795
|
+
console.error(`Config: CLAUDE_DIR=${config.claudeDir}`);
|
|
796
|
+
if (config.dopplerProject) {
|
|
797
|
+
console.error(`Config: DOPPLER_PROJECT=${config.dopplerProject}`);
|
|
798
|
+
console.error(`Config: DOPPLER_CONFIG=${config.dopplerConfig}`);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
main().catch((error) => {
|
|
802
|
+
console.error("Fatal error:", error);
|
|
803
|
+
process.exit(1);
|
|
804
|
+
});
|
|
805
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GAEvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AACvF,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,eAAe,EA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AAC,CAAC,CAAC,eAAe,CAAC;QAC9E,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,UAAU,YAAY,EAAE;iBAC/B;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,eAAe;AACf,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,OAAO,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACjE,OAAO,CAAC,KAAK,CAAC,sBAAsB,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;IACxD,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;QAC1B,OAAO,CAAC,KAAK,CAAC,2BAA2B,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC;QAClE,OAAO,CAAC,KAAK,CAAC,0BAA0B,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC;IAClE,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ebowwa/mcp-claude-code-history",
|
|
3
|
+
"version": "1.2.6",
|
|
4
|
+
"description": "MCP server for Claude Code conversation history with useful context and summaries",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"private": false,
|
|
7
|
+
"access": "public",
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"bin": {
|
|
11
|
+
"claude-code-history-mcp": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"dev": "bun --hot src/index.ts",
|
|
21
|
+
"start": "bun run dist/index.js",
|
|
22
|
+
"typecheck": "tsc --noEmit"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@ebowwa/claudecodehistory": "^1.2.4",
|
|
26
|
+
"@ebowwa/large-output": "^1.1.0",
|
|
27
|
+
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^20.0.0",
|
|
31
|
+
"typescript": "^5.0.0"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"bun": ">=1.0.0"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"mcp",
|
|
38
|
+
"claude-code",
|
|
39
|
+
"history",
|
|
40
|
+
"doppler",
|
|
41
|
+
"bun"
|
|
42
|
+
],
|
|
43
|
+
"author": "ebowwa",
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"ownership": {
|
|
46
|
+
"domain": "mcp",
|
|
47
|
+
"responsibilities": [
|
|
48
|
+
"history-mcp-server",
|
|
49
|
+
"conversation-history"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
}
|