integram-mcp 0.4.3 → 0.4.5

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
@@ -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)
@@ -802,6 +802,7 @@ Bot config schema: { description?: "...", shortDescription?: "...", welcomeMessa
802
802
  Bot reactions (commands + keywords) are stored as **automations** with trigger.botId — use create_automation with:
803
803
  - Command: trigger: { type: "on_telegram_command", command: "status", botId: N }
804
804
  - Keyword: trigger: { type: "on_telegram_message", pattern: "привет,hello", matchMode: "contains", botId: N }
805
+ - Intake (every message, incl. media): trigger: { type: "on_telegram_message", botId: N } — no pattern. Optional messageTypes: ["voice","document"]. Runs alongside keyword rules; template vars _message, _message_type, _from_user_id, _message_id, _date, _file_id, _file_name
805
806
  - Payment: trigger: { type: "on_telegram_payment", botId: N } — fires on successful payment
806
807
  - Pre-checkout: trigger: { type: "on_telegram_pre_checkout", botId: N } — validate before charging
807
808
  - Shipping: trigger: { type: "on_telegram_shipping", botId: N } — provide shipping options
@@ -1593,7 +1594,9 @@ const BUILT_IN_TOOL_DEFS = [
1593
1594
  CONFIRM_ACTION_DEF,
1594
1595
  ];
1595
1596
 
1596
- // Group alias map — maps Russian/English synonyms to TOOL_DEFS group names
1597
+ // Group alias map — maps Russian/English SYNONYMS to TOOL_DEFS group names.
1598
+ // Exact group names are matched dynamically against the live catalog (allTools),
1599
+ // so a new backend group is picked up automatically — add here only synonyms.
1597
1600
  const GROUP_ALIASES = {
1598
1601
  документ: 'docs', документы: 'docs', docs: 'docs', doc: 'docs',
1599
1602
  отчёт: 'reports', отчеты: 'reports', отчёты: 'reports', report: 'reports', reports: 'reports',
@@ -1619,16 +1622,29 @@ const GROUP_ALIASES = {
1619
1622
  lookups: 'lookups', lookup: 'lookups', справочник: 'lookups',
1620
1623
  'meta-kb': 'meta-kb', metakb: 'meta-kb', дебат: 'meta-kb', дискусси: 'meta-kb',
1621
1624
  pm: 'pm', проект: 'pm', задач: 'pm', спринт: 'pm', канбан: 'pm', бэклог: 'pm', issue: 'pm', sprint: 'pm', backlog: 'pm', board: 'pm',
1625
+ найткол: 'nightcall', требован: 'nightcall', спецификац: 'nightcall', верификац: 'nightcall',
1626
+ формализ: 'nightcall', formaliz: 'nightcall', governance: 'nightcall', evidence: 'nightcall',
1622
1627
  };
1623
1628
 
1624
1629
  async function handleSearchTools(query) {
1625
1630
  try {
1626
1631
  const q = query.toLowerCase();
1627
1632
  const words = q.split(/\s+/).filter(Boolean);
1633
+ // Live group catalog — single source of truth, new backend groups appear automatically
1634
+ const knownGroups = [...new Set(allTools.map(t => t.group).filter(g => g && g !== 'core'))];
1628
1635
 
1629
- // Phase 1: group-based match — if any query word maps to a group, return all tools from that group
1636
+ const available = t => !activeTools.has(t.name) && !BUILT_IN_NAMES.has(t.name);
1637
+ const toolText = t => `${t.name} ${t.description || ''} ${t.group || ''}`.toLowerCase();
1638
+
1639
+ // Phase 1: group-based match — if any query word names a group (exact, or prefix
1640
+ // when at least 4 chars to avoid short-name false hits) or hits a synonym alias,
1641
+ // return all tools from that group
1630
1642
  const matchedGroups = new Set();
1631
1643
  for (const w of words) {
1644
+ for (const g of knownGroups) {
1645
+ const minLen = Math.min(w.length, g.length);
1646
+ if (w === g || (minLen >= 4 && (g.startsWith(w) || w.startsWith(g)))) matchedGroups.add(g);
1647
+ }
1632
1648
  for (const [alias, group] of Object.entries(GROUP_ALIASES)) {
1633
1649
  if (alias.startsWith(w) || w.startsWith(alias)) matchedGroups.add(group);
1634
1650
  }
@@ -1636,27 +1652,44 @@ async function handleSearchTools(query) {
1636
1652
 
1637
1653
  let matched;
1638
1654
  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
- });
1655
+ matched = allTools.filter(t => available(t) && matchedGroups.has(t.group));
1644
1656
  // Also include tools from other groups where ALL words match
1645
1657
  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
- });
1658
+ const extra = allTools.filter(t =>
1659
+ !groupSet.has(t.name) && available(t) && words.every(w => toolText(t).includes(w)));
1651
1660
  matched = matched.concat(extra);
1652
1661
  } 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
- });
1662
+ // Fallback A: strict AND — all words must appear in name+description+group
1663
+ matched = allTools.filter(t => available(t) && words.every(w => toolText(t).includes(w)));
1664
+
1665
+ // Fallback B: ranked OR — when AND finds nothing, require a majority of words
1666
+ // and rank by where they hit (name > group > description). Keeps AND precision
1667
+ // when it works, adds recall when the query is more verbose than any single
1668
+ // tool description (the "nightcall requirements formalize" → 0 results case).
1669
+ if (!matched.length && words.length > 1) {
1670
+ const minHits = Math.ceil(words.length / 2);
1671
+ matched = allTools
1672
+ .filter(available)
1673
+ .map(t => {
1674
+ const name = t.name.toLowerCase();
1675
+ const group = (t.group || '').toLowerCase();
1676
+ const desc = (t.description || '').toLowerCase();
1677
+ let hits = 0, score = 0;
1678
+ for (const w of words) {
1679
+ const inName = name.includes(w);
1680
+ const inGroup = group.includes(w);
1681
+ const inDesc = desc.includes(w);
1682
+ if (inName || inGroup || inDesc) hits++;
1683
+ if (inName) score += 3;
1684
+ if (inGroup) score += 2;
1685
+ if (inDesc) score += 1;
1686
+ }
1687
+ return { t, hits, score };
1688
+ })
1689
+ .filter(x => x.hits >= minHits)
1690
+ .sort((a, b) => b.score - a.score || b.hits - a.hits)
1691
+ .map(x => x.t);
1692
+ }
1660
1693
  }
1661
1694
 
1662
1695
  // Cap at 30
@@ -1682,8 +1715,11 @@ async function handleSearchTools(query) {
1682
1715
  if (matchedBuiltins.length) parts.push(`Already available (built-in): ${matchedBuiltins.map(t => t.name).join(', ')}.`);
1683
1716
 
1684
1717
  if (!parts.length) {
1718
+ const groupsMsg = knownGroups.length
1719
+ ? knownGroups.sort().join(', ')
1720
+ : '(no tools loaded — select a workspace first)';
1685
1721
  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` }],
1722
+ content: [{ type: 'text', text: `No tools found matching "${query}". Available groups: ${groupsMsg}` }],
1687
1723
  };
1688
1724
  }
1689
1725
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "integram-mcp",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
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",