@prom.codes/context-mcp 0.4.0 → 0.4.2
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/bin.js +16 -4
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -8330,12 +8330,16 @@ async function composeFromEnv(opts) {
|
|
|
8330
8330
|
const env = opts.env;
|
|
8331
8331
|
const override = (opts.workspaceRootOverride ?? "").trim();
|
|
8332
8332
|
const envRoot = (env.PROMETHEUS_WORKSPACE_ROOT ?? "").trim();
|
|
8333
|
-
const
|
|
8333
|
+
const claudeRoot = (env.CLAUDE_PROJECT_DIR ?? "").trim();
|
|
8334
|
+
const workspaceRoot = override !== "" ? override : envRoot !== "" ? envRoot : claudeRoot !== "" ? claudeRoot : process.cwd();
|
|
8334
8335
|
const workspaceId = (env.PROMETHEUS_WORKSPACE_ID ?? "") !== "" ? env.PROMETHEUS_WORKSPACE_ID : workspaceRoot;
|
|
8335
8336
|
const workspaceName = (env.PROMETHEUS_WORKSPACE_NAME ?? "") !== "" ? env.PROMETHEUS_WORKSPACE_NAME : basename5(workspaceRoot) || workspaceRoot;
|
|
8336
8337
|
const { id: providerId, provider: embedder, regionMode } = discoverEmbeddingProvider(env, opts.fetch);
|
|
8337
8338
|
const apiKeyPresent = (env.PROMETHEUS_API_KEY ?? "") !== "";
|
|
8338
|
-
const storageOptions =
|
|
8339
|
+
const storageOptions = {
|
|
8340
|
+
writable: true,
|
|
8341
|
+
defaultDbPath: getStableDbPath(workspaceRoot)
|
|
8342
|
+
};
|
|
8339
8343
|
const { id: storageBackend, adapter: storage, dbPath } = discoverStorageBackend(env, regionMode, storageOptions);
|
|
8340
8344
|
await storage.init();
|
|
8341
8345
|
const retriever = new HybridRetriever({ storage, embedder });
|
|
@@ -8950,6 +8954,10 @@ var SERVER_IDENTITY = {
|
|
|
8950
8954
|
function errMessage(err) {
|
|
8951
8955
|
return err instanceof Error ? err.message : String(err);
|
|
8952
8956
|
}
|
|
8957
|
+
function looksLikeMissingNativeBinding(msg) {
|
|
8958
|
+
return /bindings file|better_sqlite3\.node|could not locate the bindings|node_module_version|was compiled against a different|invalid elf|\.node['"\s]/i.test(msg);
|
|
8959
|
+
}
|
|
8960
|
+
var NATIVE_BINDING_HINT = '\nThis looks like the native `better-sqlite3` module failed to load \u2014 usually\nbecause npm `ignore-scripts=true` (corporate hardening) made `npx` skip the\nnative build, so the binary was never produced. Fix it once, keeping your\nhardening intact:\n npm install -g @prom.codes/context-mcp --ignore-scripts=false --foreground-scripts\nthen point Claude Code at the built binary instead of npx:\n claude mcp add context -- node "$(npm root -g)/@prom.codes/context-mcp/dist/bin.js"\nDocs: https://prom.codes/docs/mcp/claude-code\n';
|
|
8953
8961
|
function startManagedIndexing(composed) {
|
|
8954
8962
|
const indexer = new WorkspaceIndexer({
|
|
8955
8963
|
root: composed.workspaceRoot,
|
|
@@ -8984,6 +8992,8 @@ function startManagedIndexing(composed) {
|
|
|
8984
8992
|
async function main() {
|
|
8985
8993
|
const env = process.env;
|
|
8986
8994
|
const explicitRoot = (env.PROMETHEUS_WORKSPACE_ROOT ?? "").trim();
|
|
8995
|
+
const claudeRoot = (env.CLAUDE_PROJECT_DIR ?? "").trim();
|
|
8996
|
+
const eagerVia = explicitRoot !== "" ? "PROMETHEUS_WORKSPACE_ROOT" : claudeRoot !== "" ? "CLAUDE_PROJECT_DIR" : null;
|
|
8987
8997
|
const transport = new StdioServerTransport();
|
|
8988
8998
|
const server = new McpServer2(SERVER_IDENTITY, { capabilities: { tools: {} } });
|
|
8989
8999
|
let composed = null;
|
|
@@ -9018,8 +9028,8 @@ async function main() {
|
|
|
9018
9028
|
if (composed.managed)
|
|
9019
9029
|
managedIndexer = startManagedIndexing(composed);
|
|
9020
9030
|
};
|
|
9021
|
-
if (
|
|
9022
|
-
await boot(void 0,
|
|
9031
|
+
if (eagerVia !== null) {
|
|
9032
|
+
await boot(void 0, eagerVia);
|
|
9023
9033
|
await server.connect(transport);
|
|
9024
9034
|
return;
|
|
9025
9035
|
}
|
|
@@ -9051,5 +9061,7 @@ main().catch((err) => {
|
|
|
9051
9061
|
const message = err instanceof Error ? err.message : String(err);
|
|
9052
9062
|
process.stderr.write(`prometheus-context-mcp: fatal: ${message}
|
|
9053
9063
|
`);
|
|
9064
|
+
if (looksLikeMissingNativeBinding(message))
|
|
9065
|
+
process.stderr.write(NATIVE_BINDING_HINT);
|
|
9054
9066
|
process.exit(1);
|
|
9055
9067
|
});
|