integram-mcp 0.4.3 → 0.4.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.
Files changed (2) hide show
  1. package/index.js +56 -21
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -166,7 +166,7 @@ Only core tools (~15: CRUD, search, graph, comments, bulk, history) are loaded b
166
166
  - "ai" — text-to-speech synthesis (TTS): speak text, list voices (~2 tools)
167
167
  - "agents" — list and delegate to external AI agents (~2 tools)
168
168
  - "pm" — project management: issues CRUD + bulk ops, checklists, sprints, board, backlog, comments CRUD, issue links, data-links (issue ↔ table/document/report), watchers, templates, trash/restore, members, CSV export, metrics (velocity, burndown, cycle time, workload), AI helpers (triage, decompose, estimate, plan sprint, detect blockers), org aggregation (portfolio, people, cross-project issues) (~53 tools)
169
- - "nightcall" — specification-driven execution: formalize NL→requirements, CNM CRUD, typed graph edges, EffectiveSpecification resolver, execution compiler, DAG generation graph, evidence verification, compliance/release decisions, full pipeline run (~13 tools)
169
+ - "nightcall" — specification-driven execution: CNM requirements graph, formalization proposals (Extraction IR → governance decisions), artifact specifications, EffectiveSpecification resolver, execution compiler, directed-retry pipeline run, evidence verification, compliance/release decisions, waivers (~21 tools)
170
170
  - "orgs" — organizations: create, list, manage multi-workspace orgs and members (~8 tools)
171
171
  - "bulk" — bulk_create, bulk_update, bulk_delete, autofill_batch (~4 tools)
172
172
  - "comments" — comments, reactions on records (~6 tools)
@@ -1593,7 +1593,9 @@ const BUILT_IN_TOOL_DEFS = [
1593
1593
  CONFIRM_ACTION_DEF,
1594
1594
  ];
1595
1595
 
1596
- // Group alias map — maps Russian/English synonyms to TOOL_DEFS group names
1596
+ // Group alias map — maps Russian/English SYNONYMS to TOOL_DEFS group names.
1597
+ // Exact group names are matched dynamically against the live catalog (allTools),
1598
+ // so a new backend group is picked up automatically — add here only synonyms.
1597
1599
  const GROUP_ALIASES = {
1598
1600
  документ: 'docs', документы: 'docs', docs: 'docs', doc: 'docs',
1599
1601
  отчёт: 'reports', отчеты: 'reports', отчёты: 'reports', report: 'reports', reports: 'reports',
@@ -1619,16 +1621,29 @@ const GROUP_ALIASES = {
1619
1621
  lookups: 'lookups', lookup: 'lookups', справочник: 'lookups',
1620
1622
  'meta-kb': 'meta-kb', metakb: 'meta-kb', дебат: 'meta-kb', дискусси: 'meta-kb',
1621
1623
  pm: 'pm', проект: 'pm', задач: 'pm', спринт: 'pm', канбан: 'pm', бэклог: 'pm', issue: 'pm', sprint: 'pm', backlog: 'pm', board: 'pm',
1624
+ найткол: 'nightcall', требован: 'nightcall', спецификац: 'nightcall', верификац: 'nightcall',
1625
+ формализ: 'nightcall', formaliz: 'nightcall', governance: 'nightcall', evidence: 'nightcall',
1622
1626
  };
1623
1627
 
1624
1628
  async function handleSearchTools(query) {
1625
1629
  try {
1626
1630
  const q = query.toLowerCase();
1627
1631
  const words = q.split(/\s+/).filter(Boolean);
1632
+ // Live group catalog — single source of truth, new backend groups appear automatically
1633
+ const knownGroups = [...new Set(allTools.map(t => t.group).filter(g => g && g !== 'core'))];
1628
1634
 
1629
- // Phase 1: group-based match — if any query word maps to a group, return all tools from that group
1635
+ const available = t => !activeTools.has(t.name) && !BUILT_IN_NAMES.has(t.name);
1636
+ const toolText = t => `${t.name} ${t.description || ''} ${t.group || ''}`.toLowerCase();
1637
+
1638
+ // Phase 1: group-based match — if any query word names a group (exact, or prefix
1639
+ // when at least 4 chars to avoid short-name false hits) or hits a synonym alias,
1640
+ // return all tools from that group
1630
1641
  const matchedGroups = new Set();
1631
1642
  for (const w of words) {
1643
+ for (const g of knownGroups) {
1644
+ const minLen = Math.min(w.length, g.length);
1645
+ if (w === g || (minLen >= 4 && (g.startsWith(w) || w.startsWith(g)))) matchedGroups.add(g);
1646
+ }
1632
1647
  for (const [alias, group] of Object.entries(GROUP_ALIASES)) {
1633
1648
  if (alias.startsWith(w) || w.startsWith(alias)) matchedGroups.add(group);
1634
1649
  }
@@ -1636,27 +1651,44 @@ async function handleSearchTools(query) {
1636
1651
 
1637
1652
  let matched;
1638
1653
  if (matchedGroups.size > 0) {
1639
- matched = allTools.filter(t => {
1640
- if (activeTools.has(t.name)) return false;
1641
- if (BUILT_IN_NAMES.has(t.name)) return false;
1642
- return matchedGroups.has(t.group);
1643
- });
1654
+ matched = allTools.filter(t => available(t) && matchedGroups.has(t.group));
1644
1655
  // Also include tools from other groups where ALL words match
1645
1656
  const groupSet = new Set(matched.map(t => t.name));
1646
- const extra = allTools.filter(t => {
1647
- if (groupSet.has(t.name) || activeTools.has(t.name) || BUILT_IN_NAMES.has(t.name)) return false;
1648
- const text = `${t.name} ${t.description || ''} ${t.group || ''}`.toLowerCase();
1649
- return words.every(w => text.includes(w));
1650
- });
1657
+ const extra = allTools.filter(t =>
1658
+ !groupSet.has(t.name) && available(t) && words.every(w => toolText(t).includes(w)));
1651
1659
  matched = matched.concat(extra);
1652
1660
  } else {
1653
- // Fallback: multi-word AND — all words must appear in name+description+group
1654
- matched = allTools.filter(t => {
1655
- if (activeTools.has(t.name)) return false;
1656
- if (BUILT_IN_NAMES.has(t.name)) return false;
1657
- const text = `${t.name} ${t.description || ''} ${t.group || ''}`.toLowerCase();
1658
- return words.every(w => text.includes(w));
1659
- });
1661
+ // Fallback A: strict AND — all words must appear in name+description+group
1662
+ matched = allTools.filter(t => available(t) && words.every(w => toolText(t).includes(w)));
1663
+
1664
+ // Fallback B: ranked OR — when AND finds nothing, require a majority of words
1665
+ // and rank by where they hit (name > group > description). Keeps AND precision
1666
+ // when it works, adds recall when the query is more verbose than any single
1667
+ // tool description (the "nightcall requirements formalize" → 0 results case).
1668
+ if (!matched.length && words.length > 1) {
1669
+ const minHits = Math.ceil(words.length / 2);
1670
+ matched = allTools
1671
+ .filter(available)
1672
+ .map(t => {
1673
+ const name = t.name.toLowerCase();
1674
+ const group = (t.group || '').toLowerCase();
1675
+ const desc = (t.description || '').toLowerCase();
1676
+ let hits = 0, score = 0;
1677
+ for (const w of words) {
1678
+ const inName = name.includes(w);
1679
+ const inGroup = group.includes(w);
1680
+ const inDesc = desc.includes(w);
1681
+ if (inName || inGroup || inDesc) hits++;
1682
+ if (inName) score += 3;
1683
+ if (inGroup) score += 2;
1684
+ if (inDesc) score += 1;
1685
+ }
1686
+ return { t, hits, score };
1687
+ })
1688
+ .filter(x => x.hits >= minHits)
1689
+ .sort((a, b) => b.score - a.score || b.hits - a.hits)
1690
+ .map(x => x.t);
1691
+ }
1660
1692
  }
1661
1693
 
1662
1694
  // Cap at 30
@@ -1682,8 +1714,11 @@ async function handleSearchTools(query) {
1682
1714
  if (matchedBuiltins.length) parts.push(`Already available (built-in): ${matchedBuiltins.map(t => t.name).join(', ')}.`);
1683
1715
 
1684
1716
  if (!parts.length) {
1717
+ const groupsMsg = knownGroups.length
1718
+ ? knownGroups.sort().join(', ')
1719
+ : '(no tools loaded — select a workspace first)';
1685
1720
  return {
1686
- content: [{ type: 'text', text: `No tools found matching "${query}". Available groups: schema, reports, docs, workspace, portal, telegram, grants, codespace, teamchat, graph, meta-kb, kag, memory, timeseries, advisor, agents, bulk, comments, history, objects, lookups, automations, ai, orgs, pm` }],
1721
+ content: [{ type: 'text', text: `No tools found matching "${query}". Available groups: ${groupsMsg}` }],
1687
1722
  };
1688
1723
  }
1689
1724
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "integram-mcp",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "type": "module",
5
5
  "description": "MCP server for Integram — connect AI assistants to your workspace via Model Context Protocol",
6
6
  "mcpName": "io.github.judas-priest/integram",