ronds-mcp-tracker 0.1.2 → 0.1.4
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 +7 -3
- package/dist/config.js +19 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ A Node.js MCP server that records code changes and publishes them to Kafka.
|
|
|
9
9
|
- Failed queue persistence with replay support
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
|
-
Example MCP config (default
|
|
12
|
+
Example MCP config (default worker_id precedence: `./.ai_conifg/config.json` -> `MCP_TRACKER_WORKER_ID` -> OS username):
|
|
13
13
|
|
|
14
14
|
```json
|
|
15
15
|
{
|
|
@@ -39,7 +39,11 @@ Custom worker id:
|
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
## Configuration
|
|
42
|
-
- `
|
|
42
|
+
- `worker_id` resolution order:
|
|
43
|
+
1. `./.ai_conifg/config.json` 的 `worker_id`
|
|
44
|
+
2. 环境变量 `MCP_TRACKER_WORKER_ID`
|
|
45
|
+
3. 系统用户名(`os.userInfo().username`)
|
|
46
|
+
- `MCP_TRACKER_WORKER_ID`: 当本地 `.ai_conifg/config.json` 未提供有效 `worker_id` 时生效。
|
|
43
47
|
- Kafka config is currently hardcoded (see `src/config.ts`) and can be extended later.
|
|
44
48
|
|
|
45
49
|
## Tools
|
|
@@ -77,4 +81,4 @@ Failed events are stored in `~/.mcp-tracker/failed` as JSON files. Old files are
|
|
|
77
81
|
|
|
78
82
|
## Development
|
|
79
83
|
- Build: `npm run build`
|
|
80
|
-
- Test tools list: `echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | node dist/server.js`
|
|
84
|
+
- Test tools list: `echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | node dist/server.js`
|
package/dist/config.js
CHANGED
|
@@ -1,16 +1,34 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
1
2
|
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
2
4
|
export const FAILED_QUEUE_CONFIG = {
|
|
3
5
|
max_files: 1000,
|
|
4
6
|
max_age_hours: 168,
|
|
5
7
|
check_disk_space: true,
|
|
6
8
|
min_disk_space_mb: 100
|
|
7
9
|
};
|
|
10
|
+
function resolveWorkerId() {
|
|
11
|
+
const localConfigPath = path.resolve(process.cwd(), '.ai_conifg', 'config.json');
|
|
12
|
+
try {
|
|
13
|
+
if (fs.existsSync(localConfigPath)) {
|
|
14
|
+
const raw = fs.readFileSync(localConfigPath, 'utf-8');
|
|
15
|
+
const parsed = JSON.parse(raw);
|
|
16
|
+
if (typeof parsed.worker_id === 'string' && parsed.worker_id.trim()) {
|
|
17
|
+
return parsed.worker_id.trim();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// ignore local config read errors, fallback to current logic
|
|
23
|
+
}
|
|
24
|
+
return process.env.MCP_TRACKER_WORKER_ID ?? os.userInfo().username;
|
|
25
|
+
}
|
|
8
26
|
export function loadConfig() {
|
|
9
27
|
const kafka = {
|
|
10
28
|
bootstrap_servers: '192.168.2.121:9092',
|
|
11
29
|
topic: 'code-changes'
|
|
12
30
|
};
|
|
13
|
-
const worker_id =
|
|
31
|
+
const worker_id = resolveWorkerId();
|
|
14
32
|
return {
|
|
15
33
|
kafka,
|
|
16
34
|
worker_id
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
{
|
|
2
2
|
"name": "ronds-mcp-tracker",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"ronds-mcp-tracker": "./bin/cli.js"
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
16
|
+
"ajv": "^8.17.1",
|
|
17
|
+
"ajv-formats": "^3.0.1",
|
|
16
18
|
"diff": "^7.0.0",
|
|
17
19
|
"kafkajs": "^2.2.4"
|
|
18
20
|
},
|