codeblog-mcp 2.1.5 → 2.2.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/dist/cli.d.ts +2 -0
- package/dist/cli.js +6 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +26 -22
- package/dist/lib/registry.js +4 -0
- package/dist/scanners/cursor.js +23 -2
- package/dist/scanners/windsurf.js +19 -2
- package/package.json +7 -4
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
/**
|
|
3
|
+
* Create a fully configured McpServer with all scanners and tools registered.
|
|
4
|
+
* Does NOT connect to any transport — the caller decides how to connect.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createServer(version?: string): McpServer;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
2
|
import { createRequire } from "module";
|
|
5
3
|
import { registerAllScanners } from "./scanners/index.js";
|
|
6
4
|
import { registerSetupTools } from "./tools/setup.js";
|
|
@@ -8,24 +6,30 @@ import { registerSessionTools } from "./tools/sessions.js";
|
|
|
8
6
|
import { registerPostingTools } from "./tools/posting.js";
|
|
9
7
|
import { registerForumTools } from "./tools/forum.js";
|
|
10
8
|
import { registerAgentTools } from "./tools/agents.js";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
9
|
+
function getVersion() {
|
|
10
|
+
try {
|
|
11
|
+
const req = createRequire(import.meta.url);
|
|
12
|
+
return req("../package.json").version;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return "0.0.0";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a fully configured McpServer with all scanners and tools registered.
|
|
20
|
+
* Does NOT connect to any transport — the caller decides how to connect.
|
|
21
|
+
*/
|
|
22
|
+
export function createServer(version) {
|
|
23
|
+
const pkgVersion = version ?? getVersion();
|
|
24
|
+
registerAllScanners();
|
|
25
|
+
const server = new McpServer({
|
|
26
|
+
name: "codeblog",
|
|
27
|
+
version: pkgVersion,
|
|
28
|
+
});
|
|
29
|
+
registerSetupTools(server, pkgVersion);
|
|
30
|
+
registerSessionTools(server);
|
|
31
|
+
registerPostingTools(server);
|
|
32
|
+
registerForumTools(server);
|
|
33
|
+
registerAgentTools(server);
|
|
34
|
+
return server;
|
|
30
35
|
}
|
|
31
|
-
main().catch(console.error);
|
package/dist/lib/registry.js
CHANGED
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
// (missing deps, changed file formats, permission errors, etc.)
|
|
4
4
|
// MUST NEVER take down the whole MCP server.
|
|
5
5
|
const scanners = [];
|
|
6
|
+
const registeredSources = new Set();
|
|
6
7
|
export function registerScanner(scanner) {
|
|
8
|
+
if (registeredSources.has(scanner.sourceType))
|
|
9
|
+
return;
|
|
10
|
+
registeredSources.add(scanner.sourceType);
|
|
7
11
|
scanners.push(scanner);
|
|
8
12
|
}
|
|
9
13
|
export function getScanners() {
|
package/dist/scanners/cursor.js
CHANGED
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
import * as path from "path";
|
|
2
2
|
import * as fs from "fs";
|
|
3
|
-
import BetterSqlite3 from "better-sqlite3";
|
|
4
3
|
import { getHome, getPlatform } from "../lib/platform.js";
|
|
5
4
|
import { listFiles, listDirs, safeReadFile, safeReadJson, safeStats, extractProjectDescription, decodeDirNameToPath } from "../lib/fs-utils.js";
|
|
5
|
+
// Lazy-loaded SQLite module (better-sqlite3 or bun:sqlite)
|
|
6
|
+
let BetterSqlite3 = null;
|
|
7
|
+
let sqliteLoadAttempted = false;
|
|
8
|
+
function getSqlite() {
|
|
9
|
+
if (sqliteLoadAttempted)
|
|
10
|
+
return BetterSqlite3;
|
|
11
|
+
sqliteLoadAttempted = true;
|
|
12
|
+
try {
|
|
13
|
+
BetterSqlite3 = require("better-sqlite3");
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
try {
|
|
17
|
+
// Fallback for Bun runtime
|
|
18
|
+
BetterSqlite3 = null;
|
|
19
|
+
}
|
|
20
|
+
catch { /* */ }
|
|
21
|
+
}
|
|
22
|
+
return BetterSqlite3;
|
|
23
|
+
}
|
|
6
24
|
// Cursor stores conversations in THREE places (all supported for version compatibility):
|
|
7
25
|
//
|
|
8
26
|
// FORMAT 1 — Agent transcripts (plain text, XML-like tags):
|
|
@@ -20,8 +38,11 @@ import { listFiles, listDirs, safeReadFile, safeReadJson, safeStats, extractProj
|
|
|
20
38
|
// bubbleId:<composerId>:<bubbleId> — individual message content (type 1=user, 2=ai)
|
|
21
39
|
// Run a callback with a shared DB connection, safely closing on completion
|
|
22
40
|
function withDb(dbPath, fn, fallback) {
|
|
41
|
+
const Sqlite = getSqlite();
|
|
42
|
+
if (!Sqlite)
|
|
43
|
+
return fallback;
|
|
23
44
|
try {
|
|
24
|
-
const db = new
|
|
45
|
+
const db = new Sqlite(dbPath, { readonly: true, fileMustExist: true });
|
|
25
46
|
try {
|
|
26
47
|
return fn(db);
|
|
27
48
|
}
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import * as path from "path";
|
|
2
2
|
import * as fs from "fs";
|
|
3
|
-
import BetterSqlite3 from "better-sqlite3";
|
|
4
3
|
import { getHome, getPlatform } from "../lib/platform.js";
|
|
5
4
|
import { listDirs, safeReadJson, safeStats, extractProjectDescription } from "../lib/fs-utils.js";
|
|
5
|
+
// Lazy-loaded SQLite module (better-sqlite3 or bun:sqlite)
|
|
6
|
+
let BetterSqlite3 = null;
|
|
7
|
+
let sqliteLoadAttempted = false;
|
|
8
|
+
function getSqlite() {
|
|
9
|
+
if (sqliteLoadAttempted)
|
|
10
|
+
return BetterSqlite3;
|
|
11
|
+
sqliteLoadAttempted = true;
|
|
12
|
+
try {
|
|
13
|
+
BetterSqlite3 = require("better-sqlite3");
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
BetterSqlite3 = null;
|
|
17
|
+
}
|
|
18
|
+
return BetterSqlite3;
|
|
19
|
+
}
|
|
6
20
|
export const windsurfScanner = {
|
|
7
21
|
name: "Windsurf",
|
|
8
22
|
sourceType: "windsurf",
|
|
@@ -138,8 +152,11 @@ export const windsurfScanner = {
|
|
|
138
152
|
},
|
|
139
153
|
};
|
|
140
154
|
function readVscdbChatSessions(dbPath) {
|
|
155
|
+
const Sqlite = getSqlite();
|
|
156
|
+
if (!Sqlite)
|
|
157
|
+
return null;
|
|
141
158
|
try {
|
|
142
|
-
const db = new
|
|
159
|
+
const db = new Sqlite(dbPath, { readonly: true, fileMustExist: true });
|
|
143
160
|
let row;
|
|
144
161
|
try {
|
|
145
162
|
row = db.prepare("SELECT value FROM ItemTable WHERE key = 'chat.ChatSessionStore.index'").get();
|
package/package.json
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeblog-mcp",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "CodeBlog MCP server — 26 tools for AI agents to fully participate in a coding forum. Scan 9 IDEs, auto-post insights, manage agents, edit/delete posts, bookmark, notifications, follow users, weekly digest, trending topics, and more",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"codeblog-mcp": "./dist/
|
|
7
|
+
"codeblog-mcp": "./dist/cli.js"
|
|
8
8
|
},
|
|
9
9
|
"main": "./dist/index.js",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./dist/index.js"
|
|
12
|
+
},
|
|
10
13
|
"files": [
|
|
11
14
|
"dist"
|
|
12
15
|
],
|
|
13
16
|
"scripts": {
|
|
14
|
-
"build": "tsc && node -e \"require('fs').chmodSync('dist/
|
|
15
|
-
"dev": "tsx src/
|
|
17
|
+
"build": "tsc && node -e \"require('fs').chmodSync('dist/cli.js',0o755)\"",
|
|
18
|
+
"dev": "tsx src/cli.ts",
|
|
16
19
|
"release": "tsx scripts/release.ts",
|
|
17
20
|
"prepublishOnly": "npm run build"
|
|
18
21
|
},
|