@neurynae/toolcairn-mcp 0.8.3 → 0.8.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/bin/toolpilot-mcp.js +1 -1
- package/dist/index.js +68 -83
- package/dist/index.js.map +1 -1
- package/package.json +9 -18
- package/dist/chunk-B74KV6FC.js +0 -59
- package/dist/chunk-B74KV6FC.js.map +0 -1
- package/dist/dist-LZ2PMHGT.js +0 -6056
- package/dist/dist-LZ2PMHGT.js.map +0 -1
package/bin/toolpilot-mcp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Entry point for `npx @
|
|
2
|
+
// Entry point for `npx @toolcairn/mcp` or `toolpilot-mcp` CLI.
|
|
3
3
|
// Forces TOOLPILOT_MODE=production so the server uses the HTTP bridge.
|
|
4
4
|
process.env.TOOLPILOT_MODE = process.env.TOOLPILOT_MODE ?? 'production';
|
|
5
5
|
import('../dist/index.js');
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,47 @@
|
|
|
1
1
|
import { createRequire as __nodeCreateRequire } from 'module'; const require = __nodeCreateRequire(import.meta.url);
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
+
}) : x)(function(x) {
|
|
11
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
+
});
|
|
14
|
+
var __esm = (fn, res) => function __init() {
|
|
15
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
16
|
+
};
|
|
17
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
18
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
|
|
37
|
+
// ../../node_modules/.pnpm/tsup@8.5.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js
|
|
38
|
+
import path from "path";
|
|
39
|
+
import { fileURLToPath } from "url";
|
|
40
|
+
var init_esm_shims = __esm({
|
|
41
|
+
"../../node_modules/.pnpm/tsup@8.5.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js"() {
|
|
42
|
+
"use strict";
|
|
43
|
+
}
|
|
44
|
+
});
|
|
8
45
|
|
|
9
46
|
// ../../packages/config/dist/index.js
|
|
10
47
|
var require_dist = __commonJS({
|
|
@@ -15,34 +52,14 @@ var require_dist = __commonJS({
|
|
|
15
52
|
exports.config = void 0;
|
|
16
53
|
var zod_1 = __require("zod");
|
|
17
54
|
var configSchema = zod_1.z.object({
|
|
18
|
-
// ── Memgraph ──────────────────────────────────────────────────────────────
|
|
19
|
-
MEMGRAPH_URL: zod_1.z.string().default("bolt://localhost:7687"),
|
|
20
|
-
MEMGRAPH_USER: zod_1.z.string().default(""),
|
|
21
|
-
MEMGRAPH_PASSWORD: zod_1.z.string().default(""),
|
|
22
|
-
// ── Qdrant ────────────────────────────────────────────────────────────────
|
|
23
|
-
QDRANT_URL: zod_1.z.string().default("http://localhost:6333"),
|
|
24
|
-
QDRANT_API_KEY: zod_1.z.string().optional(),
|
|
25
|
-
// ── PostgreSQL ────────────────────────────────────────────────────────────
|
|
26
|
-
DATABASE_URL: zod_1.z.string().default("postgresql://toolpilot:toolpilot@localhost:5432/toolpilot"),
|
|
27
|
-
// ── Redis ─────────────────────────────────────────────────────────────────
|
|
28
|
-
REDIS_URL: zod_1.z.string().default("redis://localhost:6379"),
|
|
29
|
-
// ── Nomic Embed Code ──────────────────────────────────────────────────────
|
|
30
|
-
NOMIC_API_KEY: zod_1.z.string().optional(),
|
|
31
|
-
// ── GitHub (Indexer) ──────────────────────────────────────────────────────
|
|
32
|
-
GITHUB_TOKEN: zod_1.z.string().optional(),
|
|
33
55
|
// ── MCP Server ────────────────────────────────────────────────────────────
|
|
34
56
|
MCP_SERVER_PORT: zod_1.z.coerce.number().int().positive().default(3001),
|
|
35
57
|
MCP_SERVER_HOST: zod_1.z.string().default("0.0.0.0"),
|
|
36
|
-
// ── Web App ───────────────────────────────────────────────────────────────
|
|
37
|
-
NEXT_PUBLIC_APP_URL: zod_1.z.string().default("http://localhost:3000"),
|
|
38
|
-
ADMIN_SECRET: zod_1.z.string().default("change-me-in-production"),
|
|
39
58
|
// ── Deployment Mode ───────────────────────────────────────────────────────
|
|
40
59
|
/** dev: direct Docker DB connections | production: HTTP client to remote API */
|
|
41
60
|
TOOLPILOT_MODE: zod_1.z.enum(["dev", "staging", "production"]).default("dev"),
|
|
42
|
-
/** URL of the
|
|
61
|
+
/** URL of the ToolCairn HTTP API (used when TOOLPILOT_MODE=production) */
|
|
43
62
|
TOOLPILOT_API_URL: zod_1.z.string().default("https://api.neurynae.com"),
|
|
44
|
-
/** Secret shared between Cloudflare Worker and the API origin server */
|
|
45
|
-
ORIGIN_SECRET: zod_1.z.string().optional(),
|
|
46
63
|
// ── General ───────────────────────────────────────────────────────────────
|
|
47
64
|
NODE_ENV: zod_1.z.enum(["development", "test", "production"]).default("development"),
|
|
48
65
|
LOG_LEVEL: zod_1.z.enum(["fatal", "error", "warn", "info", "debug", "trace"]).default("info")
|
|
@@ -132,9 +149,9 @@ var ToolCairnClient = class {
|
|
|
132
149
|
}
|
|
133
150
|
}
|
|
134
151
|
// ── Private ──────────────────────────────────────────────────────────────
|
|
135
|
-
async post(
|
|
152
|
+
async post(path2, body) {
|
|
136
153
|
try {
|
|
137
|
-
const res = await this.rawPost(
|
|
154
|
+
const res = await this.rawPost(path2, body);
|
|
138
155
|
const data = await res.json();
|
|
139
156
|
if (data && typeof data === "object" && "content" in data) {
|
|
140
157
|
return data;
|
|
@@ -159,7 +176,7 @@ var ToolCairnClient = class {
|
|
|
159
176
|
};
|
|
160
177
|
}
|
|
161
178
|
}
|
|
162
|
-
rawPost(
|
|
179
|
+
rawPost(path2, body) {
|
|
163
180
|
const headers = {
|
|
164
181
|
"Content-Type": "application/json",
|
|
165
182
|
"X-ToolCairn-Key": this.apiKey,
|
|
@@ -168,7 +185,7 @@ var ToolCairnClient = class {
|
|
|
168
185
|
if (this.accessToken) {
|
|
169
186
|
headers.Authorization = `Bearer ${this.accessToken}`;
|
|
170
187
|
}
|
|
171
|
-
return fetch(`${this.baseUrl}${
|
|
188
|
+
return fetch(`${this.baseUrl}${path2}`, {
|
|
172
189
|
method: "POST",
|
|
173
190
|
headers,
|
|
174
191
|
body: JSON.stringify(body),
|
|
@@ -860,10 +877,10 @@ init_esm_shims();
|
|
|
860
877
|
var import_config = __toESM(require_dist(), 1);
|
|
861
878
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
862
879
|
|
|
863
|
-
// ../../packages/tools/dist/
|
|
880
|
+
// ../../packages/tools-local/dist/index.js
|
|
864
881
|
init_esm_shims();
|
|
865
882
|
|
|
866
|
-
// ../../packages/tools/dist/schemas.js
|
|
883
|
+
// ../../packages/tools-local/dist/schemas.js
|
|
867
884
|
init_esm_shims();
|
|
868
885
|
import { z } from "zod";
|
|
869
886
|
var searchToolsSchema = {
|
|
@@ -988,7 +1005,7 @@ var refineRequirementSchema = {
|
|
|
988
1005
|
}).optional()
|
|
989
1006
|
};
|
|
990
1007
|
|
|
991
|
-
// ../../packages/tools/dist/utils.js
|
|
1008
|
+
// ../../packages/tools-local/dist/utils.js
|
|
992
1009
|
init_esm_shims();
|
|
993
1010
|
function okResult(data) {
|
|
994
1011
|
return {
|
|
@@ -1002,10 +1019,10 @@ function errResult(error, message) {
|
|
|
1002
1019
|
};
|
|
1003
1020
|
}
|
|
1004
1021
|
|
|
1005
|
-
// ../../packages/tools/dist/handlers/classify-prompt.js
|
|
1022
|
+
// ../../packages/tools-local/dist/handlers/classify-prompt.js
|
|
1006
1023
|
init_esm_shims();
|
|
1007
1024
|
import pino2 from "pino";
|
|
1008
|
-
var logger2 = pino2({ name: "@
|
|
1025
|
+
var logger2 = pino2({ name: "@toolcairn/tools:classify-prompt" });
|
|
1009
1026
|
var TOOL_REQUIRED_CLASSIFICATIONS = [
|
|
1010
1027
|
"tool_discovery",
|
|
1011
1028
|
"stack_building",
|
|
@@ -1064,16 +1081,16 @@ Respond with ONLY 0 or 1.`;
|
|
|
1064
1081
|
}
|
|
1065
1082
|
}
|
|
1066
1083
|
|
|
1067
|
-
// ../../packages/tools/dist/handlers/
|
|
1084
|
+
// ../../packages/tools-local/dist/handlers/toolcairn-init.js
|
|
1068
1085
|
init_esm_shims();
|
|
1069
1086
|
import pino3 from "pino";
|
|
1070
1087
|
|
|
1071
|
-
// ../../packages/tools/dist/templates/agent-instructions.js
|
|
1088
|
+
// ../../packages/tools-local/dist/templates/agent-instructions.js
|
|
1072
1089
|
init_esm_shims();
|
|
1073
1090
|
var TOOLPILOT_MCP_ENTRY = {
|
|
1074
1091
|
toolpilot: {
|
|
1075
1092
|
command: "npx",
|
|
1076
|
-
args: ["-y", "@
|
|
1093
|
+
args: ["-y", "@toolcairn/mcp@latest"]
|
|
1077
1094
|
}
|
|
1078
1095
|
};
|
|
1079
1096
|
var CORE_RULES = `
|
|
@@ -1204,13 +1221,13 @@ function getOpenCodeMcpEntry(serverPath) {
|
|
|
1204
1221
|
return {
|
|
1205
1222
|
toolpilot: {
|
|
1206
1223
|
type: "local",
|
|
1207
|
-
command: resolvedPath ? ["node", resolvedPath] : ["npx", "-y", "@
|
|
1224
|
+
command: resolvedPath ? ["node", resolvedPath] : ["npx", "-y", "@toolcairn/mcp@latest"],
|
|
1208
1225
|
enabled: true
|
|
1209
1226
|
}
|
|
1210
1227
|
};
|
|
1211
1228
|
}
|
|
1212
1229
|
|
|
1213
|
-
// ../../packages/tools/dist/templates/generate-tracker.js
|
|
1230
|
+
// ../../packages/tools-local/dist/templates/generate-tracker.js
|
|
1214
1231
|
init_esm_shims();
|
|
1215
1232
|
function generateTrackerHtml2(eventsPath) {
|
|
1216
1233
|
return `<!DOCTYPE html>
|
|
@@ -1615,9 +1632,9 @@ if (!EVENTS_PATH || EVENTS_PATH === 'null') {
|
|
|
1615
1632
|
</html>`;
|
|
1616
1633
|
}
|
|
1617
1634
|
|
|
1618
|
-
// ../../packages/tools/dist/handlers/
|
|
1619
|
-
var logger3 = pino3({ name: "@
|
|
1620
|
-
async function
|
|
1635
|
+
// ../../packages/tools-local/dist/handlers/toolcairn-init.js
|
|
1636
|
+
var logger3 = pino3({ name: "@toolcairn/tools:toolpilot-init" });
|
|
1637
|
+
async function handleToolcairnInit(args) {
|
|
1621
1638
|
try {
|
|
1622
1639
|
logger3.info({ agent: args.agent, project_root: args.project_root }, "toolpilot_init called");
|
|
1623
1640
|
const instructions = getInstructionsForAgent(args.agent);
|
|
@@ -1702,10 +1719,10 @@ async function handleToolpilotInit(args) {
|
|
|
1702
1719
|
}
|
|
1703
1720
|
}
|
|
1704
1721
|
|
|
1705
|
-
// ../../packages/tools/dist/handlers/init-project-config.js
|
|
1722
|
+
// ../../packages/tools-local/dist/handlers/init-project-config.js
|
|
1706
1723
|
init_esm_shims();
|
|
1707
1724
|
import pino4 from "pino";
|
|
1708
|
-
var logger4 = pino4({ name: "@
|
|
1725
|
+
var logger4 = pino4({ name: "@toolcairn/tools:init-project-config" });
|
|
1709
1726
|
async function handleInitProjectConfig(args) {
|
|
1710
1727
|
try {
|
|
1711
1728
|
logger4.info({ project: args.project_name }, "init_project_config called");
|
|
@@ -1752,10 +1769,10 @@ async function handleInitProjectConfig(args) {
|
|
|
1752
1769
|
}
|
|
1753
1770
|
}
|
|
1754
1771
|
|
|
1755
|
-
// ../../packages/tools/dist/handlers/read-project-config.js
|
|
1772
|
+
// ../../packages/tools-local/dist/handlers/read-project-config.js
|
|
1756
1773
|
init_esm_shims();
|
|
1757
1774
|
import pino5 from "pino";
|
|
1758
|
-
var logger5 = pino5({ name: "@
|
|
1775
|
+
var logger5 = pino5({ name: "@toolcairn/tools:read-project-config" });
|
|
1759
1776
|
var STALENESS_THRESHOLD_DAYS = 90;
|
|
1760
1777
|
function daysSince(isoDate) {
|
|
1761
1778
|
return (Date.now() - new Date(isoDate).getTime()) / (1e3 * 60 * 60 * 24);
|
|
@@ -1813,10 +1830,10 @@ async function handleReadProjectConfig(args) {
|
|
|
1813
1830
|
}
|
|
1814
1831
|
}
|
|
1815
1832
|
|
|
1816
|
-
// ../../packages/tools/dist/handlers/update-project-config.js
|
|
1833
|
+
// ../../packages/tools-local/dist/handlers/update-project-config.js
|
|
1817
1834
|
init_esm_shims();
|
|
1818
1835
|
import pino6 from "pino";
|
|
1819
|
-
var logger6 = pino6({ name: "@
|
|
1836
|
+
var logger6 = pino6({ name: "@toolcairn/tools:update-project-config" });
|
|
1820
1837
|
async function handleUpdateProjectConfig(args) {
|
|
1821
1838
|
try {
|
|
1822
1839
|
logger6.info({ action: args.action, tool: args.tool_name }, "update_project_config called");
|
|
@@ -1932,17 +1949,6 @@ import { appendFile, mkdir as mkdir3 } from "fs/promises";
|
|
|
1932
1949
|
import { dirname } from "path";
|
|
1933
1950
|
import pino7 from "pino";
|
|
1934
1951
|
var logger7 = pino7({ name: "@toolcairn/mcp-server:event-logger" });
|
|
1935
|
-
var _prisma = null;
|
|
1936
|
-
async function getPrisma() {
|
|
1937
|
-
if (!_prisma) {
|
|
1938
|
-
try {
|
|
1939
|
-
const mod = await import("./dist-LZ2PMHGT.js");
|
|
1940
|
-
_prisma = new mod.PrismaClient();
|
|
1941
|
-
} catch {
|
|
1942
|
-
}
|
|
1943
|
-
}
|
|
1944
|
-
return _prisma;
|
|
1945
|
-
}
|
|
1946
1952
|
function isTrackingEnabled() {
|
|
1947
1953
|
return process.env.TOOLCAIRN_TRACKING_ENABLED !== "false";
|
|
1948
1954
|
}
|
|
@@ -1989,25 +1995,6 @@ async function writeToFile(eventsPath, event) {
|
|
|
1989
1995
|
logger7.warn({ err: e, path: eventsPath }, "Failed to write event to JSONL file");
|
|
1990
1996
|
}
|
|
1991
1997
|
}
|
|
1992
|
-
async function writeToPrisma(event) {
|
|
1993
|
-
try {
|
|
1994
|
-
const prisma = await getPrisma();
|
|
1995
|
-
if (!prisma) return;
|
|
1996
|
-
await prisma.mcpEvent.create({
|
|
1997
|
-
data: {
|
|
1998
|
-
id: event.id,
|
|
1999
|
-
tool_name: event.tool_name,
|
|
2000
|
-
query_id: event.query_id,
|
|
2001
|
-
duration_ms: event.duration_ms,
|
|
2002
|
-
status: event.status,
|
|
2003
|
-
metadata: event.metadata ? JSON.parse(JSON.stringify(event.metadata)) : void 0,
|
|
2004
|
-
created_at: new Date(event.created_at)
|
|
2005
|
-
}
|
|
2006
|
-
});
|
|
2007
|
-
} catch (e) {
|
|
2008
|
-
logger7.warn({ err: e }, "Failed to write McpEvent to Prisma");
|
|
2009
|
-
}
|
|
2010
|
-
}
|
|
2011
1998
|
function withEventLogging(toolName, handler) {
|
|
2012
1999
|
return async (args) => {
|
|
2013
2000
|
if (!isTrackingEnabled()) {
|
|
@@ -2033,8 +2020,6 @@ function withEventLogging(toolName, handler) {
|
|
|
2033
2020
|
metadata: result ? extractMetadata(toolName, result) : null,
|
|
2034
2021
|
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2035
2022
|
};
|
|
2036
|
-
writeToPrisma(event).catch(() => {
|
|
2037
|
-
});
|
|
2038
2023
|
const eventsPath = getEventsPath();
|
|
2039
2024
|
if (eventsPath) {
|
|
2040
2025
|
writeToFile(eventsPath, event).catch(() => {
|
|
@@ -2115,7 +2100,7 @@ async function addToolsToServer(server) {
|
|
|
2115
2100
|
description: "Set up ToolCairn integration for the current project. Generates agent instruction content, MCP config entry, and project config initializer.",
|
|
2116
2101
|
inputSchema: toolpilotInitSchema
|
|
2117
2102
|
},
|
|
2118
|
-
withEventLogging("toolcairn_init", async (args) =>
|
|
2103
|
+
withEventLogging("toolcairn_init", async (args) => handleToolcairnInit(args))
|
|
2119
2104
|
);
|
|
2120
2105
|
server.registerTool(
|
|
2121
2106
|
"init_project_config",
|