@neurynae/toolcairn-mcp 0.10.5 → 0.10.7

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/index.js CHANGED
@@ -1001,8 +1001,10 @@ var suggestGraphUpdateSchema = {
1001
1001
  tools: z.array(z.object({
1002
1002
  tool_name: z.string().min(1),
1003
1003
  github_url: z.string().url().optional(),
1004
- description: z.string().optional()
1005
- })).min(1).max(200).optional().describe('Batch of tools to stage for admin review. Use with suggestion_type="new_tool". Overrides single-tool fields when present.'),
1004
+ description: z.string().optional(),
1005
+ ecosystem: z.string().min(1).optional()
1006
+ })).min(1).max(200).optional().describe('Batch of tools to stage for admin review. Use with suggestion_type="new_tool". Each entry may include `ecosystem` (npm/pypi/cargo/\u2026) so the engine can cross-check the authoritative github_url from the package registry. Overrides single-tool fields when present.'),
1007
+ ecosystem: z.string().min(1).optional(),
1006
1008
  relationship: z.object({
1007
1009
  source_tool: z.string(),
1008
1010
  target_tool: z.string(),
@@ -4105,6 +4107,14 @@ async function scanProject(projectRoot, options = {}) {
4105
4107
  const categories = graph?.tool?.categories;
4106
4108
  const github_url = githubUrls.get(key) ?? local_github_url;
4107
4109
  const version = locations.find((l) => l.resolved_version)?.resolved_version ?? locations[0]?.version_constraint;
4110
+ const toolRef = graph?.tool;
4111
+ const docs = toolRef?.docs ? {
4112
+ readme_url: toolRef.docs.readme_url ?? void 0,
4113
+ docs_url: toolRef.docs.docs_url ?? void 0,
4114
+ api_url: toolRef.docs.api_url ?? void 0,
4115
+ changelog_url: toolRef.docs.changelog_url ?? void 0
4116
+ } : void 0;
4117
+ const hasDocs = docs && Object.values(docs).some((v) => v !== void 0);
4108
4118
  confirmed.push({
4109
4119
  name: name2,
4110
4120
  source,
@@ -4116,7 +4126,12 @@ async function scanProject(projectRoot, options = {}) {
4116
4126
  canonical_name: canonical,
4117
4127
  categories,
4118
4128
  match_method: matchMethod,
4119
- locations
4129
+ locations,
4130
+ description: toolRef?.description ?? void 0,
4131
+ license: toolRef?.license ?? void 0,
4132
+ homepage_url: toolRef?.homepage_url ?? void 0,
4133
+ docs: hasDocs ? docs : void 0,
4134
+ package_managers: toolRef?.package_managers && toolRef.package_managers.length > 0 ? toolRef.package_managers : void 0
4120
4135
  });
4121
4136
  }
4122
4137
  confirmed.sort((a, b) => {
@@ -4315,72 +4330,46 @@ var TOOLCAIRN_MCP_ENTRY = IS_WINDOWS ? {
4315
4330
  }
4316
4331
  };
4317
4332
  var CORE_RULES = `
4318
- ## ToolCairn \u2014 Tool Intelligence MCP
4319
-
4320
- ToolCairn is your tool intelligence co-pilot. It has a graph database of 500+ indexed tools with health signals, compatibility data, and known issue tracking. Always use it before recommending any tool, library, or framework.
4321
-
4322
- ### The Server Owns .toolcairn/ (v0.10.0+)
4323
-
4324
- The MCP server reads and writes \`.toolcairn/config.json\` and
4325
- \`.toolcairn/audit-log.jsonl\` atomically under a cross-process lock.
4326
- NEVER read or write these files directly \u2014 call the MCP tools instead.
4327
-
4328
- ### Workflow for Tool Selection
4329
-
4330
- 1. **Session start**: Typically auto-init has already run during \`toolcairn_auth\` so
4331
- \`.toolcairn/config.json\` is provisioned. Start by calling \`read_project_config\`
4332
- with the project_root to load the snapshot. If it returns \`status: "not_initialized"\`
4333
- (rare \u2014 only when auto-init skipped the root), call \`toolcairn_init\`.
4334
- 2. **First-turn drain protocol** (CRITICAL \u2014 runs BEFORE your first reply to the user):
4335
- If the auth response OR \`read_project_config\` returned non-empty \`unknown_tools[]\`,
4336
- you MUST submit them in ONE call:
4337
- - \`suggest_graph_update\` with \`suggestion_type: "new_tool"\` and
4338
- \`data.tools: <the full unknown_tools array, each entry is {tool_name, github_url}>\`
4339
- These are STAGED for admin review \u2014 they do NOT enter the live graph until approved.
4340
- Immediately after, call \`update_project_config\` with
4341
- \`action: "mark_suggestions_sent"\` and \`data.tool_names: [names that staged ok]\`.
4342
- In multi-root workspaces repeat once per root (each has its own \`unknown_tools[]\`).
4343
- Do not skip \u2014 this is how ToolCairn learns about your project's OSS stack.
4344
- 3. **Before recommending any tool**: Call \`search_tools\` first. Never recommend from
4345
- training data alone.
4346
- 4. **When user describes a use case**: Call \`classify_prompt\`, then \`refine_requirement\`
4347
- if tool selection is needed.
4348
- 5. **When a tool is selected / replaced / dropped**: Call \`update_project_config\` with
4349
- project_root + action \u2014 the server atomically updates config.json and appends to
4350
- audit-log.jsonl.
4351
- 6. **When encountering an error with a tool**: Call \`check_issue\` before debugging \u2014
4352
- it may be a known issue with an open GitHub ticket.
4353
- 7. **When user asks to compare tools**: Call \`compare_tools\`.
4354
- 8. **When user chooses a non-indexed/proprietary tool**: Call \`update_project_config\`
4355
- with \`data: { source: "non_oss" }\`.
4356
-
4357
- ### Available ToolCairn MCP Tools
4358
-
4359
- | Tool | When to use |
4360
- |------|------------|
4361
- | \`classify_prompt\` | User describes a task \u2014 determine if tool search needed |
4362
- | \`refine_requirement\` | Decompose vague use case into searchable tool needs |
4363
- | \`search_tools\` | Find the best tool for a specific need |
4364
- | \`search_tools_respond\` | Answer clarification questions from search_tools |
4365
- | \`get_stack\` | Get recommended tool stack for a use case |
4366
- | \`check_issue\` | Check if an error is a known tool bug before debugging |
4367
- | \`check_compatibility\` | Check if two tools work well together |
4368
- | \`compare_tools\` | Compare two tools with health and graph data |
4369
- | \`report_outcome\` | Report whether a recommended tool worked (improves future results) |
4370
- | \`toolcairn_init\` | One-call project bootstrap (auto-discovers + writes config.json) |
4371
- | \`read_project_config\` | Read .toolcairn/config.json from disk (returns structured snapshot) |
4372
- | \`update_project_config\` | Apply a mutation (add_tool / remove_tool / update_tool / add_evaluation) |
4373
- | \`suggest_graph_update\` | Suggest a new tool or relationship for the ToolCairn graph |
4333
+ ## ToolCairn MCP \u2014 Tool Intelligence
4334
+
4335
+ Graph-backed catalog of tools with health, compatibility, and issue data. Always consult before recommending a tool/library/framework. The server owns \`.toolcairn/config.json\` + \`audit-log.jsonl\` under a cross-process lock \u2014 never read/write these files directly; use the MCP tools.
4336
+
4337
+ ### First-turn protocol
4338
+
4339
+ 1. \`read_project_config({ project_root })\`. If \`status:"not_initialized"\`, call \`toolcairn_init\`. (Auto-init usually ran during \`toolcairn_auth\` already.)
4340
+ 2. **If \`unknown_tools[]\` is non-empty** \u2014 BEFORE replying to the user:
4341
+ - \`suggest_graph_update({ suggestion_type:"new_tool", data:{ tools: <unknown_tools array> } })\` \u2014 entries are STAGED for admin review, NOT live.
4342
+ - \`update_project_config({ action:"mark_suggestions_sent", data:{ tool_names: <names that staged ok> } })\`.
4343
+ - Repeat per root in monorepos (each has its own list).
4344
+
4345
+ ### Tool reference
4346
+
4347
+ | Tool | Trigger |
4348
+ |------|---------|
4349
+ | \`classify_prompt\` | User describes a task \u2014 decide whether tool search is needed |
4350
+ | \`refine_requirement\` | Decompose a use case into searchable sub-needs (required input for \`get_stack\`) |
4351
+ | \`search_tools\` | Find the best tool for one specific need |
4352
+ | \`search_tools_respond\` | Submit clarification answers for an in-progress search session |
4353
+ | \`get_stack\` | Build a version-compatible multi-layer stack for a use case |
4354
+ | \`compare_tools\` | Head-to-head comparison of two tools |
4355
+ | \`check_compatibility\` | Version-aware compatibility check between two tools |
4356
+ | \`check_issue\` | LAST RESORT \u2014 known-bug lookup after 4+ retries + docs review |
4357
+ | \`verify_suggestion\` | Validate agent-picked tool names against the graph |
4358
+ | \`report_outcome\` | Fire-and-forget feedback after using a recommended tool |
4359
+ | \`suggest_graph_update\` | Stage a new tool / edge / use-case for admin review (never writes live) |
4360
+ | \`toolcairn_init\` | Manual project re-scan (auto-init usually covers it) |
4361
+ | \`read_project_config\` | Load project snapshot (confirmed, pending, unknown, stale, metadata) |
4362
+ | \`update_project_config\` | Mutate confirmed tools or mark unknown suggestions sent |
4363
+ | \`toolcairn_auth\` | Login / status / logout for ToolCairn credentials |
4374
4364
 
4375
4365
  ### Rules
4376
4366
 
4377
- - NEVER recommend a tool without first checking ToolCairn unless the tool is already in the project config
4378
- - Always call \`read_project_config\` at the start of a session
4379
- - NEVER write to .toolcairn/config.json or .toolcairn/audit-log.jsonl yourself \u2014 the server owns them
4380
- - Prefer open-source tools from ToolCairn index; flag proprietary alternatives clearly
4381
- - After selecting a tool, always call \`update_project_config\` to persist it
4382
- - After using a tool successfully/unsuccessfully, call \`report_outcome\`
4383
- - **Drain \`unknown_tools[]\` before your first reply** via \`suggest_graph_update\` (batch) + \`update_project_config\` action="mark_suggestions_sent". Staging-only \u2014 admin approval gates live promotion.
4367
+ - Never recommend a tool that isn't in \`confirmed_tools\` without first hitting \`search_tools\` / \`get_stack\`.
4368
+ - After selecting a tool: \`update_project_config({ action:"add_tool", tool_name, data: {...} })\`. Pass \`data.source:"non_oss"\` for proprietary picks.
4369
+ - After using a tool (success or failure): \`report_outcome\`.
4370
+ - Use \`check_issue\` only after docs + 4 retries \u2014 it's network-heavy.
4371
+ - Confirmed tools in config.json carry graph enrichment: \`description\`, \`license\`, \`homepage_url\`, \`docs.{readme_url,docs_url,api_url,changelog_url}\`, and \`package_managers[]\` with install commands. Prefer these over re-fetching.
4372
+ - Suggestions are STAGED; admin approval gates live-graph promotion.
4384
4373
  `;
4385
4374
  function getClaudeInstructions() {
4386
4375
  return {
@@ -5106,7 +5095,11 @@ async function submitUnknownsToEngine(remote, pending) {
5106
5095
  const res = await remote.suggestGraphUpdate({
5107
5096
  suggestion_type: "new_tool",
5108
5097
  data: {
5109
- tools: pending.map((t) => ({ tool_name: t.name, github_url: t.github_url }))
5098
+ tools: pending.map((t) => ({
5099
+ tool_name: t.name,
5100
+ github_url: t.github_url,
5101
+ ecosystem: t.ecosystem
5102
+ }))
5110
5103
  },
5111
5104
  confidence: 0.5
5112
5105
  });