integram-mcp 0.4.1 → 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 +57 -21
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -165,7 +165,8 @@ Only core tools (~15: CRUD, search, graph, comments, bulk, history) are loaded b
165
165
  - "advisor" — ask platform expert for advice on schema design, best practices (~2 tools)
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
- - "pm" — project management: issues CRUD, sprints, board, backlog, comments, links, watchers, templates, trash, metrics (velocity, burndown, cycle time, workload), org aggregation (portfolio, people, cross-project issues) (~33 tools)
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: 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)
169
170
  - "orgs" — organizations: create, list, manage multi-workspace orgs and members (~8 tools)
170
171
  - "bulk" — bulk_create, bulk_update, bulk_delete, autofill_batch (~4 tools)
171
172
  - "comments" — comments, reactions on records (~6 tools)
@@ -1592,7 +1593,9 @@ const BUILT_IN_TOOL_DEFS = [
1592
1593
  CONFIRM_ACTION_DEF,
1593
1594
  ];
1594
1595
 
1595
- // 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.
1596
1599
  const GROUP_ALIASES = {
1597
1600
  документ: 'docs', документы: 'docs', docs: 'docs', doc: 'docs',
1598
1601
  отчёт: 'reports', отчеты: 'reports', отчёты: 'reports', report: 'reports', reports: 'reports',
@@ -1618,16 +1621,29 @@ const GROUP_ALIASES = {
1618
1621
  lookups: 'lookups', lookup: 'lookups', справочник: 'lookups',
1619
1622
  'meta-kb': 'meta-kb', metakb: 'meta-kb', дебат: 'meta-kb', дискусси: 'meta-kb',
1620
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',
1621
1626
  };
1622
1627
 
1623
1628
  async function handleSearchTools(query) {
1624
1629
  try {
1625
1630
  const q = query.toLowerCase();
1626
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'))];
1627
1634
 
1628
- // 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
1629
1641
  const matchedGroups = new Set();
1630
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
+ }
1631
1647
  for (const [alias, group] of Object.entries(GROUP_ALIASES)) {
1632
1648
  if (alias.startsWith(w) || w.startsWith(alias)) matchedGroups.add(group);
1633
1649
  }
@@ -1635,27 +1651,44 @@ async function handleSearchTools(query) {
1635
1651
 
1636
1652
  let matched;
1637
1653
  if (matchedGroups.size > 0) {
1638
- matched = allTools.filter(t => {
1639
- if (activeTools.has(t.name)) return false;
1640
- if (BUILT_IN_NAMES.has(t.name)) return false;
1641
- return matchedGroups.has(t.group);
1642
- });
1654
+ matched = allTools.filter(t => available(t) && matchedGroups.has(t.group));
1643
1655
  // Also include tools from other groups where ALL words match
1644
1656
  const groupSet = new Set(matched.map(t => t.name));
1645
- const extra = allTools.filter(t => {
1646
- if (groupSet.has(t.name) || activeTools.has(t.name) || BUILT_IN_NAMES.has(t.name)) return false;
1647
- const text = `${t.name} ${t.description || ''} ${t.group || ''}`.toLowerCase();
1648
- return words.every(w => text.includes(w));
1649
- });
1657
+ const extra = allTools.filter(t =>
1658
+ !groupSet.has(t.name) && available(t) && words.every(w => toolText(t).includes(w)));
1650
1659
  matched = matched.concat(extra);
1651
1660
  } else {
1652
- // Fallback: multi-word AND — all words must appear in name+description+group
1653
- matched = allTools.filter(t => {
1654
- if (activeTools.has(t.name)) return false;
1655
- if (BUILT_IN_NAMES.has(t.name)) return false;
1656
- const text = `${t.name} ${t.description || ''} ${t.group || ''}`.toLowerCase();
1657
- return words.every(w => text.includes(w));
1658
- });
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
+ }
1659
1692
  }
1660
1693
 
1661
1694
  // Cap at 30
@@ -1681,8 +1714,11 @@ async function handleSearchTools(query) {
1681
1714
  if (matchedBuiltins.length) parts.push(`Already available (built-in): ${matchedBuiltins.map(t => t.name).join(', ')}.`);
1682
1715
 
1683
1716
  if (!parts.length) {
1717
+ const groupsMsg = knownGroups.length
1718
+ ? knownGroups.sort().join(', ')
1719
+ : '(no tools loaded — select a workspace first)';
1684
1720
  return {
1685
- 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}` }],
1686
1722
  };
1687
1723
  }
1688
1724
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "integram-mcp",
3
- "version": "0.4.1",
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",