@neurynae/toolcairn-mcp 0.8.2 → 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 +69 -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),
|
|
@@ -858,11 +875,12 @@ async function createIfAbsent(filePath, content, label) {
|
|
|
858
875
|
// src/server.prod.ts
|
|
859
876
|
init_esm_shims();
|
|
860
877
|
var import_config = __toESM(require_dist(), 1);
|
|
878
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
861
879
|
|
|
862
|
-
// ../../packages/tools/dist/
|
|
880
|
+
// ../../packages/tools-local/dist/index.js
|
|
863
881
|
init_esm_shims();
|
|
864
882
|
|
|
865
|
-
// ../../packages/tools/dist/schemas.js
|
|
883
|
+
// ../../packages/tools-local/dist/schemas.js
|
|
866
884
|
init_esm_shims();
|
|
867
885
|
import { z } from "zod";
|
|
868
886
|
var searchToolsSchema = {
|
|
@@ -987,7 +1005,7 @@ var refineRequirementSchema = {
|
|
|
987
1005
|
}).optional()
|
|
988
1006
|
};
|
|
989
1007
|
|
|
990
|
-
// ../../packages/tools/dist/utils.js
|
|
1008
|
+
// ../../packages/tools-local/dist/utils.js
|
|
991
1009
|
init_esm_shims();
|
|
992
1010
|
function okResult(data) {
|
|
993
1011
|
return {
|
|
@@ -1001,10 +1019,10 @@ function errResult(error, message) {
|
|
|
1001
1019
|
};
|
|
1002
1020
|
}
|
|
1003
1021
|
|
|
1004
|
-
// ../../packages/tools/dist/handlers/classify-prompt.js
|
|
1022
|
+
// ../../packages/tools-local/dist/handlers/classify-prompt.js
|
|
1005
1023
|
init_esm_shims();
|
|
1006
1024
|
import pino2 from "pino";
|
|
1007
|
-
var logger2 = pino2({ name: "@
|
|
1025
|
+
var logger2 = pino2({ name: "@toolcairn/tools:classify-prompt" });
|
|
1008
1026
|
var TOOL_REQUIRED_CLASSIFICATIONS = [
|
|
1009
1027
|
"tool_discovery",
|
|
1010
1028
|
"stack_building",
|
|
@@ -1063,16 +1081,16 @@ Respond with ONLY 0 or 1.`;
|
|
|
1063
1081
|
}
|
|
1064
1082
|
}
|
|
1065
1083
|
|
|
1066
|
-
// ../../packages/tools/dist/handlers/
|
|
1084
|
+
// ../../packages/tools-local/dist/handlers/toolcairn-init.js
|
|
1067
1085
|
init_esm_shims();
|
|
1068
1086
|
import pino3 from "pino";
|
|
1069
1087
|
|
|
1070
|
-
// ../../packages/tools/dist/templates/agent-instructions.js
|
|
1088
|
+
// ../../packages/tools-local/dist/templates/agent-instructions.js
|
|
1071
1089
|
init_esm_shims();
|
|
1072
1090
|
var TOOLPILOT_MCP_ENTRY = {
|
|
1073
1091
|
toolpilot: {
|
|
1074
1092
|
command: "npx",
|
|
1075
|
-
args: ["-y", "@
|
|
1093
|
+
args: ["-y", "@toolcairn/mcp@latest"]
|
|
1076
1094
|
}
|
|
1077
1095
|
};
|
|
1078
1096
|
var CORE_RULES = `
|
|
@@ -1203,13 +1221,13 @@ function getOpenCodeMcpEntry(serverPath) {
|
|
|
1203
1221
|
return {
|
|
1204
1222
|
toolpilot: {
|
|
1205
1223
|
type: "local",
|
|
1206
|
-
command: resolvedPath ? ["node", resolvedPath] : ["npx", "-y", "@
|
|
1224
|
+
command: resolvedPath ? ["node", resolvedPath] : ["npx", "-y", "@toolcairn/mcp@latest"],
|
|
1207
1225
|
enabled: true
|
|
1208
1226
|
}
|
|
1209
1227
|
};
|
|
1210
1228
|
}
|
|
1211
1229
|
|
|
1212
|
-
// ../../packages/tools/dist/templates/generate-tracker.js
|
|
1230
|
+
// ../../packages/tools-local/dist/templates/generate-tracker.js
|
|
1213
1231
|
init_esm_shims();
|
|
1214
1232
|
function generateTrackerHtml2(eventsPath) {
|
|
1215
1233
|
return `<!DOCTYPE html>
|
|
@@ -1614,9 +1632,9 @@ if (!EVENTS_PATH || EVENTS_PATH === 'null') {
|
|
|
1614
1632
|
</html>`;
|
|
1615
1633
|
}
|
|
1616
1634
|
|
|
1617
|
-
// ../../packages/tools/dist/handlers/
|
|
1618
|
-
var logger3 = pino3({ name: "@
|
|
1619
|
-
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) {
|
|
1620
1638
|
try {
|
|
1621
1639
|
logger3.info({ agent: args.agent, project_root: args.project_root }, "toolpilot_init called");
|
|
1622
1640
|
const instructions = getInstructionsForAgent(args.agent);
|
|
@@ -1701,10 +1719,10 @@ async function handleToolpilotInit(args) {
|
|
|
1701
1719
|
}
|
|
1702
1720
|
}
|
|
1703
1721
|
|
|
1704
|
-
// ../../packages/tools/dist/handlers/init-project-config.js
|
|
1722
|
+
// ../../packages/tools-local/dist/handlers/init-project-config.js
|
|
1705
1723
|
init_esm_shims();
|
|
1706
1724
|
import pino4 from "pino";
|
|
1707
|
-
var logger4 = pino4({ name: "@
|
|
1725
|
+
var logger4 = pino4({ name: "@toolcairn/tools:init-project-config" });
|
|
1708
1726
|
async function handleInitProjectConfig(args) {
|
|
1709
1727
|
try {
|
|
1710
1728
|
logger4.info({ project: args.project_name }, "init_project_config called");
|
|
@@ -1751,10 +1769,10 @@ async function handleInitProjectConfig(args) {
|
|
|
1751
1769
|
}
|
|
1752
1770
|
}
|
|
1753
1771
|
|
|
1754
|
-
// ../../packages/tools/dist/handlers/read-project-config.js
|
|
1772
|
+
// ../../packages/tools-local/dist/handlers/read-project-config.js
|
|
1755
1773
|
init_esm_shims();
|
|
1756
1774
|
import pino5 from "pino";
|
|
1757
|
-
var logger5 = pino5({ name: "@
|
|
1775
|
+
var logger5 = pino5({ name: "@toolcairn/tools:read-project-config" });
|
|
1758
1776
|
var STALENESS_THRESHOLD_DAYS = 90;
|
|
1759
1777
|
function daysSince(isoDate) {
|
|
1760
1778
|
return (Date.now() - new Date(isoDate).getTime()) / (1e3 * 60 * 60 * 24);
|
|
@@ -1812,10 +1830,10 @@ async function handleReadProjectConfig(args) {
|
|
|
1812
1830
|
}
|
|
1813
1831
|
}
|
|
1814
1832
|
|
|
1815
|
-
// ../../packages/tools/dist/handlers/update-project-config.js
|
|
1833
|
+
// ../../packages/tools-local/dist/handlers/update-project-config.js
|
|
1816
1834
|
init_esm_shims();
|
|
1817
1835
|
import pino6 from "pino";
|
|
1818
|
-
var logger6 = pino6({ name: "@
|
|
1836
|
+
var logger6 = pino6({ name: "@toolcairn/tools:update-project-config" });
|
|
1819
1837
|
async function handleUpdateProjectConfig(args) {
|
|
1820
1838
|
try {
|
|
1821
1839
|
logger6.info({ action: args.action, tool: args.tool_name }, "update_project_config called");
|
|
@@ -1931,17 +1949,6 @@ import { appendFile, mkdir as mkdir3 } from "fs/promises";
|
|
|
1931
1949
|
import { dirname } from "path";
|
|
1932
1950
|
import pino7 from "pino";
|
|
1933
1951
|
var logger7 = pino7({ name: "@toolcairn/mcp-server:event-logger" });
|
|
1934
|
-
var _prisma = null;
|
|
1935
|
-
async function getPrisma() {
|
|
1936
|
-
if (!_prisma) {
|
|
1937
|
-
try {
|
|
1938
|
-
const mod = await import("./dist-LZ2PMHGT.js");
|
|
1939
|
-
_prisma = new mod.PrismaClient();
|
|
1940
|
-
} catch {
|
|
1941
|
-
}
|
|
1942
|
-
}
|
|
1943
|
-
return _prisma;
|
|
1944
|
-
}
|
|
1945
1952
|
function isTrackingEnabled() {
|
|
1946
1953
|
return process.env.TOOLCAIRN_TRACKING_ENABLED !== "false";
|
|
1947
1954
|
}
|
|
@@ -1988,25 +1995,6 @@ async function writeToFile(eventsPath, event) {
|
|
|
1988
1995
|
logger7.warn({ err: e, path: eventsPath }, "Failed to write event to JSONL file");
|
|
1989
1996
|
}
|
|
1990
1997
|
}
|
|
1991
|
-
async function writeToPrisma(event) {
|
|
1992
|
-
try {
|
|
1993
|
-
const prisma = await getPrisma();
|
|
1994
|
-
if (!prisma) return;
|
|
1995
|
-
await prisma.mcpEvent.create({
|
|
1996
|
-
data: {
|
|
1997
|
-
id: event.id,
|
|
1998
|
-
tool_name: event.tool_name,
|
|
1999
|
-
query_id: event.query_id,
|
|
2000
|
-
duration_ms: event.duration_ms,
|
|
2001
|
-
status: event.status,
|
|
2002
|
-
metadata: event.metadata ? JSON.parse(JSON.stringify(event.metadata)) : void 0,
|
|
2003
|
-
created_at: new Date(event.created_at)
|
|
2004
|
-
}
|
|
2005
|
-
});
|
|
2006
|
-
} catch (e) {
|
|
2007
|
-
logger7.warn({ err: e }, "Failed to write McpEvent to Prisma");
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
1998
|
function withEventLogging(toolName, handler) {
|
|
2011
1999
|
return async (args) => {
|
|
2012
2000
|
if (!isTrackingEnabled()) {
|
|
@@ -2032,8 +2020,6 @@ function withEventLogging(toolName, handler) {
|
|
|
2032
2020
|
metadata: result ? extractMetadata(toolName, result) : null,
|
|
2033
2021
|
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2034
2022
|
};
|
|
2035
|
-
writeToPrisma(event).catch(() => {
|
|
2036
|
-
});
|
|
2037
2023
|
const eventsPath = getEventsPath();
|
|
2038
2024
|
if (eventsPath) {
|
|
2039
2025
|
writeToFile(eventsPath, event).catch(() => {
|
|
@@ -2114,7 +2100,7 @@ async function addToolsToServer(server) {
|
|
|
2114
2100
|
description: "Set up ToolCairn integration for the current project. Generates agent instruction content, MCP config entry, and project config initializer.",
|
|
2115
2101
|
inputSchema: toolpilotInitSchema
|
|
2116
2102
|
},
|
|
2117
|
-
withEventLogging("toolcairn_init", async (args) =>
|
|
2103
|
+
withEventLogging("toolcairn_init", async (args) => handleToolcairnInit(args))
|
|
2118
2104
|
);
|
|
2119
2105
|
server.registerTool(
|
|
2120
2106
|
"init_project_config",
|