l-log-mcp-server 0.1.6 → 0.1.7
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 +62 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -10
- package/dist/utils/const.d.ts +2 -0
- package/dist/utils/const.d.ts.map +1 -0
- package/package.json +2 -2
- package/scripts/release.zig +130 -0
package/README.md
CHANGED
|
@@ -2,23 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
The standalone MCP (Model Context Protocol) server for `llm-lean-log`. It allows AI agents to search and access your coding task history.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## MCP server with llm-lean-log
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The pairing looks like:
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
```text
|
|
10
|
+
LLM runtime
|
|
11
|
+
-[use CLI to write log]->
|
|
12
|
+
llm-lean-log (token-cheap, structured CSV)
|
|
13
|
+
->
|
|
14
|
+
mcp-server
|
|
15
|
+
<-[use MCP to read log]->
|
|
16
|
+
LLM runtime
|
|
13
17
|
```
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
`llm-lean-log` become MCP memory, which gives you:
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
- auditability (what did the model think last week?)
|
|
22
|
+
- debugging (why did it choose X?)
|
|
23
|
+
- analytics (token burn, drift, behavior change)
|
|
24
|
+
- training data for fine-tuning or evals
|
|
25
|
+
|
|
26
|
+
## How to use?
|
|
27
|
+
|
|
28
|
+
1. Install globally: `bun i -g l-log-mcp-server`.
|
|
29
|
+
2. Add the configuration to your AI client's config file.
|
|
30
|
+
3. Restart your AI client to pick up the new configuration.
|
|
22
31
|
|
|
23
32
|
## Quick Start Configuration
|
|
24
33
|
|
|
@@ -46,6 +55,8 @@ Add this to your `~/.opencode.json`:
|
|
|
46
55
|
}
|
|
47
56
|
```
|
|
48
57
|
|
|
58
|
+
Read more at: [docs/config-for-opencode.md](docs/config-for-opencode.md)
|
|
59
|
+
|
|
49
60
|
### Claude Desktop / Claude Code Configuration
|
|
50
61
|
|
|
51
62
|
Add this to your `claude_config.json` (Desktop) or `.claude/settings.json` (Code):
|
|
@@ -63,21 +74,46 @@ Add this to your `claude_config.json` (Desktop) or `.claude/settings.json` (Code
|
|
|
63
74
|
}
|
|
64
75
|
```
|
|
65
76
|
|
|
66
|
-
## Features
|
|
77
|
+
## Features / usesage
|
|
67
78
|
|
|
68
79
|
### Resources
|
|
69
80
|
|
|
70
|
-
- `memory://recent`: View the last 50 log entries.
|
|
71
|
-
- `memory://stats`: View statistics about your logs.
|
|
81
|
+
- `memory://recent`: View the last 50 log entries from the project history.
|
|
82
|
+
- `memory://stats`: View statistics about your logs (total entries, last entry date, unique tags).
|
|
83
|
+
- `memory://last`: View the very last log entry from the project history.
|
|
84
|
+
|
|
85
|
+
Example User Prompts:
|
|
86
|
+
|
|
87
|
+
- "Show me the last 50 log entries to see what I've been working on recently"
|
|
88
|
+
- "What are my project statistics? How many entries do I have and what tags have I used?"
|
|
89
|
+
- "What was the very last thing I worked on?"
|
|
72
90
|
|
|
73
91
|
### Tools
|
|
74
92
|
|
|
75
|
-
- `search_logs(query)`: Search
|
|
76
|
-
- `get_task_history(taskName)`: Get all
|
|
93
|
+
- `search_logs(query)`: Search the log history for past problems, solutions, or topics.
|
|
94
|
+
- `get_task_history(taskName)`: Get all log entries related to a specific task name.
|
|
95
|
+
|
|
96
|
+
Example User Prompts:
|
|
97
|
+
|
|
98
|
+
- "Search my logs for 'database migration' using llm-memory MCP to see how I handled similar issues before"
|
|
99
|
+
- "Find all entries related to 'authentication system' using llm-memory MCP to understand the development history"
|
|
100
|
+
- "Look up any past 'build errors' using llm-memory MCP to see common solutions"
|
|
101
|
+
- "Look up how I solved 'TypeScript compilation errors' using llm-memory MCP in the past"
|
|
77
102
|
|
|
78
103
|
### Prompts
|
|
79
104
|
|
|
80
|
-
- `
|
|
105
|
+
- `up`: A prompt for daily standup meetings - "What did I do last time and what's next?"
|
|
106
|
+
- `recent_work`: A prompt template to summarize recent activities based on logs.
|
|
107
|
+
- `learned`: Review past mistakes and lessons learned to avoid repeating them.
|
|
108
|
+
|
|
109
|
+
Example User Prompts:
|
|
110
|
+
|
|
111
|
+
- "up from llm-memory mcp"
|
|
112
|
+
- "recent_work from llm-memory"
|
|
113
|
+
- "learned from llm-memory"
|
|
114
|
+
- "Help me with my daily standup - what did I do last time and what's next?"
|
|
115
|
+
- "Summarize what I've been working on recently"
|
|
116
|
+
- "Based on my past mistakes, what should I be careful about in this project?"
|
|
81
117
|
|
|
82
118
|
### Postinstall
|
|
83
119
|
|
|
@@ -116,6 +152,14 @@ You can also get this config anytime by running: l-log-mcp-server --config
|
|
|
116
152
|
l-log-mcp-server --help
|
|
117
153
|
```
|
|
118
154
|
|
|
155
|
+
### Install from source
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
cd packages/mcp-server
|
|
159
|
+
bun i
|
|
160
|
+
bun run build
|
|
161
|
+
```
|
|
162
|
+
|
|
119
163
|
---
|
|
120
164
|
|
|
121
165
|
For more details about the core logic, see [mcp/README.md](../mcp/README.md).
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA8CA;;;;;GAKG;AACH,wBAAsB,GAAG,CACxB,IAAI,GAAE,MAAM,EAA0B,EACtC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,iBAsErD"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
2
4
|
|
|
3
5
|
// src/index.ts
|
|
4
6
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
7
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
8
|
|
|
7
9
|
// ../mcp/dist/index.js
|
|
8
|
-
import { createRequire } from "node:module";
|
|
10
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
9
11
|
import { readFile } from "node:fs/promises";
|
|
10
12
|
var __defProp = Object.defineProperty;
|
|
11
13
|
var __export = (target, all) => {
|
|
@@ -13474,7 +13476,7 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
13474
13476
|
return to;
|
|
13475
13477
|
};
|
|
13476
13478
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
13477
|
-
var
|
|
13479
|
+
var __require2 = /* @__PURE__ */ createRequire2(import.meta.url);
|
|
13478
13480
|
var require_core = __commonJS((exports, module) => {
|
|
13479
13481
|
function deepFreeze(obj) {
|
|
13480
13482
|
if (obj instanceof Map) {
|
|
@@ -53651,8 +53653,8 @@ var require_has_flag = __commonJS((exports, module) => {
|
|
|
53651
53653
|
};
|
|
53652
53654
|
});
|
|
53653
53655
|
var require_supports_color = __commonJS((exports, module) => {
|
|
53654
|
-
var os =
|
|
53655
|
-
var tty =
|
|
53656
|
+
var os = __require2("os");
|
|
53657
|
+
var tty = __require2("tty");
|
|
53656
53658
|
var hasFlag = require_has_flag();
|
|
53657
53659
|
var { env } = process;
|
|
53658
53660
|
var forceColor;
|
|
@@ -54523,6 +54525,11 @@ ${text}`
|
|
|
54523
54525
|
// src/index.ts
|
|
54524
54526
|
import { existsSync } from "node:fs";
|
|
54525
54527
|
import path from "node:path";
|
|
54528
|
+
|
|
54529
|
+
// src/utils/const.ts
|
|
54530
|
+
var MCP_SERVER_VERSION = "0.1.6";
|
|
54531
|
+
|
|
54532
|
+
// src/index.ts
|
|
54526
54533
|
function printConfig() {
|
|
54527
54534
|
const config2 = {
|
|
54528
54535
|
mcp: {
|
|
@@ -54563,7 +54570,7 @@ async function run(args = process.argv.slice(2), env = process.env) {
|
|
|
54563
54570
|
return;
|
|
54564
54571
|
}
|
|
54565
54572
|
if (args.includes("--version") || args.includes("-v") || args.includes("-V")) {
|
|
54566
|
-
console.log(
|
|
54573
|
+
console.log(MCP_SERVER_VERSION);
|
|
54567
54574
|
return;
|
|
54568
54575
|
}
|
|
54569
54576
|
if (args.includes("--help") || args.includes("-h")) {
|
|
@@ -54589,7 +54596,7 @@ Options:
|
|
|
54589
54596
|
}
|
|
54590
54597
|
const server = new McpServer({
|
|
54591
54598
|
name: "l-log-mcp-server",
|
|
54592
|
-
version:
|
|
54599
|
+
version: MCP_SERVER_VERSION
|
|
54593
54600
|
});
|
|
54594
54601
|
const refresh = registerMemoryMcpHandlers(server, LOG_PATH);
|
|
54595
54602
|
await refresh();
|
|
@@ -54597,10 +54604,12 @@ Options:
|
|
|
54597
54604
|
await server.connect(transport);
|
|
54598
54605
|
console.error("MCP Server is running on stdio");
|
|
54599
54606
|
}
|
|
54600
|
-
|
|
54601
|
-
|
|
54602
|
-
|
|
54603
|
-
|
|
54607
|
+
if (__require.main == __require.module) {
|
|
54608
|
+
run().catch((error48) => {
|
|
54609
|
+
console.error("Fatal error in MCP server:", error48);
|
|
54610
|
+
process.exit(1);
|
|
54611
|
+
});
|
|
54612
|
+
}
|
|
54604
54613
|
export {
|
|
54605
54614
|
run
|
|
54606
54615
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../../src/utils/const.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "l-log-mcp-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/bun": "latest",
|
|
37
|
-
"l-log-mcp": "0.1.
|
|
37
|
+
"l-log-mcp": "0.1.2",
|
|
38
38
|
"typescript": "^5.9.3"
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// script to release a new version of the package
|
|
2
|
+
// run `zig run scripts/release.zig`
|
|
3
|
+
// Plus 0.0.1 to the version number in package.json
|
|
4
|
+
// Commit and tag the new version
|
|
5
|
+
// Push the new version to GitHub
|
|
6
|
+
// Publish the new version to npm
|
|
7
|
+
|
|
8
|
+
const std = @import("std");
|
|
9
|
+
const json = std.json;
|
|
10
|
+
const process = std.process;
|
|
11
|
+
|
|
12
|
+
/// Parse version string and increment patch version
|
|
13
|
+
fn incrementVersion(version: []const u8, allocator: std.mem.Allocator) ![]const u8 {
|
|
14
|
+
var iter = std.mem.splitScalar(u8, version, '.');
|
|
15
|
+
const major = try std.fmt.parseInt(u32, iter.next().?, 10);
|
|
16
|
+
const minor = try std.fmt.parseInt(u32, iter.next().?, 10);
|
|
17
|
+
var patch = try std.fmt.parseInt(u32, iter.next().?, 10);
|
|
18
|
+
|
|
19
|
+
patch += 1;
|
|
20
|
+
|
|
21
|
+
return std.fmt.allocPrint(allocator, "{}.{}.{}", .{ major, minor, patch });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/// Execute a command and return output
|
|
25
|
+
fn execCommand(allocator: std.mem.Allocator, args: []const []const u8) ![]const u8 {
|
|
26
|
+
const result = try process.Child.run(.{
|
|
27
|
+
.allocator = allocator,
|
|
28
|
+
.argv = args,
|
|
29
|
+
// 1MB = 1024 * 1024
|
|
30
|
+
.max_output_bytes = 1048576,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
defer allocator.free(result.stdout);
|
|
34
|
+
defer allocator.free(result.stderr);
|
|
35
|
+
|
|
36
|
+
if (result.term.Exited != 0) {
|
|
37
|
+
std.log.err("Command failed: {s}\nStderr: {s}", .{ args[0], result.stderr });
|
|
38
|
+
return error.CommandFailed;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return allocator.dupe(u8, std.mem.trim(u8, result.stdout, "\n"));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/// Read package.json and update version
|
|
45
|
+
fn updatePackageVersion(allocator: std.mem.Allocator) ![]const u8 {
|
|
46
|
+
const file = std.fs.cwd().openFile("package.json", .{}) catch |err| switch (err) {
|
|
47
|
+
error.FileNotFound => {
|
|
48
|
+
std.log.err("package.json not found", .{});
|
|
49
|
+
return error.FileNotFound;
|
|
50
|
+
},
|
|
51
|
+
else => return err,
|
|
52
|
+
};
|
|
53
|
+
defer file.close();
|
|
54
|
+
|
|
55
|
+
const contents = try file.readToEndAlloc(allocator, 1024 * 1024);
|
|
56
|
+
defer allocator.free(contents);
|
|
57
|
+
|
|
58
|
+
var parsed = try json.parseFromSlice(json.Value, allocator, contents, .{});
|
|
59
|
+
defer parsed.deinit();
|
|
60
|
+
|
|
61
|
+
var root = parsed.value.object;
|
|
62
|
+
const current_version = root.get("version").?.string;
|
|
63
|
+
const new_version = try incrementVersion(current_version, allocator);
|
|
64
|
+
|
|
65
|
+
// Update version in parsed JSON
|
|
66
|
+
root.put("version", .{ .string = new_version }) catch unreachable;
|
|
67
|
+
|
|
68
|
+
// Write back to file using simple string replacement
|
|
69
|
+
var new_contents = allocator.alloc(u8, contents.len + 10) catch unreachable;
|
|
70
|
+
defer allocator.free(new_contents);
|
|
71
|
+
|
|
72
|
+
// Find and replace version in the JSON string
|
|
73
|
+
const version_pattern = "\"version\": \"";
|
|
74
|
+
const version_start = std.mem.indexOf(u8, contents, version_pattern).? + version_pattern.len;
|
|
75
|
+
const version_end = std.mem.indexOf(u8, contents[version_start..], "\"").? + version_start;
|
|
76
|
+
|
|
77
|
+
// Copy before version
|
|
78
|
+
std.mem.copyForwards(u8, new_contents[0..version_start], contents[0..version_start]);
|
|
79
|
+
// Copy new version
|
|
80
|
+
std.mem.copyForwards(u8, new_contents[version_start .. version_start + new_version.len], new_version);
|
|
81
|
+
// Copy after version
|
|
82
|
+
std.mem.copyForwards(u8, new_contents[version_start + new_version.len ..], contents[version_end..]);
|
|
83
|
+
|
|
84
|
+
const actual_len = version_start + new_version.len + (contents.len - version_end);
|
|
85
|
+
try std.fs.cwd().writeFile(.{ .sub_path = "package.json", .data = new_contents[0..actual_len] });
|
|
86
|
+
|
|
87
|
+
std.log.info("Updated version from {s} to {s}", .{ current_version, new_version });
|
|
88
|
+
return new_version;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
pub fn main() !void {
|
|
92
|
+
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
|
93
|
+
defer _ = gpa.deinit();
|
|
94
|
+
const allocator = gpa.allocator();
|
|
95
|
+
|
|
96
|
+
std.log.info("Starting release process...", .{});
|
|
97
|
+
|
|
98
|
+
// Update version in package.json
|
|
99
|
+
const new_version = try updatePackageVersion(allocator);
|
|
100
|
+
defer allocator.free(new_version);
|
|
101
|
+
|
|
102
|
+
// Build the package
|
|
103
|
+
std.log.info("Building package...", .{});
|
|
104
|
+
_ = try execCommand(allocator, &[_][]const u8{ "bun", "run", "build" });
|
|
105
|
+
|
|
106
|
+
// Run tests
|
|
107
|
+
std.log.info("Running tests...", .{});
|
|
108
|
+
_ = try execCommand(allocator, &[_][]const u8{ "bun", "test" });
|
|
109
|
+
|
|
110
|
+
// Commit changes
|
|
111
|
+
std.log.info("Committing changes...", .{});
|
|
112
|
+
_ = try execCommand(allocator, &[_][]const u8{ "git", "add", "package.json" });
|
|
113
|
+
const commit_message = try std.fmt.allocPrint(allocator, "chore: release v{s}", .{new_version});
|
|
114
|
+
defer allocator.free(commit_message);
|
|
115
|
+
_ = try execCommand(allocator, &[_][]const u8{ "git", "commit", "-m", commit_message });
|
|
116
|
+
|
|
117
|
+
// Create and push tag
|
|
118
|
+
std.log.info("Creating and pushing tag...", .{});
|
|
119
|
+
const tag_name = try std.fmt.allocPrint(allocator, "v{s}", .{new_version});
|
|
120
|
+
defer allocator.free(tag_name);
|
|
121
|
+
_ = try execCommand(allocator, &[_][]const u8{ "git", "tag", tag_name });
|
|
122
|
+
_ = try execCommand(allocator, &[_][]const u8{ "git", "push", "origin", "main" });
|
|
123
|
+
_ = try execCommand(allocator, &[_][]const u8{ "git", "push", "origin", tag_name });
|
|
124
|
+
|
|
125
|
+
// TODO: Publish to npm
|
|
126
|
+
// std.log.info("Publishing to npm...", .{});
|
|
127
|
+
// try execCommand(allocator, &[_][]const u8{ "npm", "publish" });
|
|
128
|
+
|
|
129
|
+
std.log.info("Release v{s} completed successfully!", .{new_version});
|
|
130
|
+
}
|