opc-agent 2.1.0 → 3.0.1

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 (144) hide show
  1. package/README.md +603 -545
  2. package/dist/channels/voice.d.ts +59 -0
  3. package/dist/channels/voice.js +351 -1
  4. package/dist/cli.js +172 -1
  5. package/dist/core/agent.d.ts +4 -0
  6. package/dist/core/agent.js +35 -0
  7. package/dist/core/collaboration.d.ts +89 -0
  8. package/dist/core/collaboration.js +201 -0
  9. package/dist/deploy/index.d.ts +40 -0
  10. package/dist/deploy/index.js +261 -0
  11. package/dist/index.d.ts +7 -1
  12. package/dist/index.js +47 -3
  13. package/dist/mcp/servers/calculator-mcp.d.ts +3 -0
  14. package/dist/mcp/servers/calculator-mcp.js +65 -0
  15. package/dist/mcp/servers/crypto-mcp.d.ts +3 -0
  16. package/dist/mcp/servers/crypto-mcp.js +108 -0
  17. package/dist/mcp/servers/database-mcp.d.ts +3 -0
  18. package/dist/mcp/servers/database-mcp.js +73 -0
  19. package/dist/mcp/servers/datetime-mcp.d.ts +3 -0
  20. package/dist/mcp/servers/datetime-mcp.js +71 -0
  21. package/dist/mcp/servers/filesystem.d.ts +3 -0
  22. package/dist/mcp/servers/filesystem.js +101 -0
  23. package/dist/mcp/servers/github-mcp.d.ts +3 -0
  24. package/dist/mcp/servers/github-mcp.js +60 -0
  25. package/dist/mcp/servers/index.d.ts +21 -0
  26. package/dist/mcp/servers/index.js +50 -0
  27. package/dist/mcp/servers/json-mcp.d.ts +3 -0
  28. package/dist/mcp/servers/json-mcp.js +126 -0
  29. package/dist/mcp/servers/memory-mcp.d.ts +3 -0
  30. package/dist/mcp/servers/memory-mcp.js +60 -0
  31. package/dist/mcp/servers/regex-mcp.d.ts +3 -0
  32. package/dist/mcp/servers/regex-mcp.js +56 -0
  33. package/dist/mcp/servers/web-mcp.d.ts +3 -0
  34. package/dist/mcp/servers/web-mcp.js +51 -0
  35. package/dist/schema/oad.d.ts +292 -12
  36. package/dist/schema/oad.js +12 -1
  37. package/dist/security/guardrails.d.ts +50 -0
  38. package/dist/security/guardrails.js +197 -0
  39. package/dist/studio/server.d.ts +31 -1
  40. package/dist/studio/server.js +154 -3
  41. package/dist/studio-ui/index.html +1278 -662
  42. package/dist/tools/integrations/calendar.d.ts +3 -0
  43. package/dist/tools/integrations/calendar.js +73 -0
  44. package/dist/tools/integrations/code-exec.d.ts +3 -0
  45. package/dist/tools/integrations/code-exec.js +42 -0
  46. package/dist/tools/integrations/csv-analyzer.d.ts +3 -0
  47. package/dist/tools/integrations/csv-analyzer.js +142 -0
  48. package/dist/tools/integrations/database.d.ts +3 -0
  49. package/dist/tools/integrations/database.js +44 -0
  50. package/dist/tools/integrations/email-send.d.ts +3 -0
  51. package/dist/tools/integrations/email-send.js +104 -0
  52. package/dist/tools/integrations/git-tool.d.ts +3 -0
  53. package/dist/tools/integrations/git-tool.js +49 -0
  54. package/dist/tools/integrations/github-tool.d.ts +3 -0
  55. package/dist/tools/integrations/github-tool.js +77 -0
  56. package/dist/tools/integrations/image-gen.d.ts +3 -0
  57. package/dist/tools/integrations/image-gen.js +58 -0
  58. package/dist/tools/integrations/index.d.ts +30 -0
  59. package/dist/tools/integrations/index.js +107 -0
  60. package/dist/tools/integrations/jira.d.ts +3 -0
  61. package/dist/tools/integrations/jira.js +85 -0
  62. package/dist/tools/integrations/notion.d.ts +3 -0
  63. package/dist/tools/integrations/notion.js +71 -0
  64. package/dist/tools/integrations/npm-tool.d.ts +3 -0
  65. package/dist/tools/integrations/npm-tool.js +49 -0
  66. package/dist/tools/integrations/pdf-reader.d.ts +3 -0
  67. package/dist/tools/integrations/pdf-reader.js +91 -0
  68. package/dist/tools/integrations/slack.d.ts +3 -0
  69. package/dist/tools/integrations/slack.js +67 -0
  70. package/dist/tools/integrations/summarizer.d.ts +3 -0
  71. package/dist/tools/integrations/summarizer.js +49 -0
  72. package/dist/tools/integrations/translator.d.ts +3 -0
  73. package/dist/tools/integrations/translator.js +48 -0
  74. package/dist/tools/integrations/trello.d.ts +3 -0
  75. package/dist/tools/integrations/trello.js +60 -0
  76. package/dist/tools/integrations/vector-search.d.ts +3 -0
  77. package/dist/tools/integrations/vector-search.js +44 -0
  78. package/dist/tools/integrations/web-scraper.d.ts +3 -0
  79. package/dist/tools/integrations/web-scraper.js +48 -0
  80. package/dist/tools/integrations/web-search.d.ts +3 -0
  81. package/dist/tools/integrations/web-search.js +60 -0
  82. package/dist/tools/integrations/webhook.d.ts +3 -0
  83. package/dist/tools/integrations/webhook.js +39 -0
  84. package/dist/ui/components.d.ts +10 -0
  85. package/dist/ui/components.js +123 -0
  86. package/package.json +3 -3
  87. package/src/channels/voice.ts +365 -0
  88. package/src/cli.ts +176 -2
  89. package/src/core/agent.ts +38 -0
  90. package/src/core/collaboration.ts +275 -0
  91. package/src/deploy/index.ts +255 -0
  92. package/src/index.ts +21 -1
  93. package/src/mcp/servers/calculator-mcp.ts +65 -0
  94. package/src/mcp/servers/crypto-mcp.ts +73 -0
  95. package/src/mcp/servers/database-mcp.ts +72 -0
  96. package/src/mcp/servers/datetime-mcp.ts +69 -0
  97. package/src/mcp/servers/filesystem.ts +66 -0
  98. package/src/mcp/servers/github-mcp.ts +58 -0
  99. package/src/mcp/servers/index.ts +63 -0
  100. package/src/mcp/servers/json-mcp.ts +102 -0
  101. package/src/mcp/servers/memory-mcp.ts +56 -0
  102. package/src/mcp/servers/regex-mcp.ts +53 -0
  103. package/src/mcp/servers/web-mcp.ts +49 -0
  104. package/src/schema/oad.ts +13 -0
  105. package/src/security/guardrails.ts +248 -0
  106. package/src/studio/server.ts +166 -4
  107. package/src/studio-ui/index.html +1278 -662
  108. package/src/tools/integrations/calendar.ts +73 -0
  109. package/src/tools/integrations/code-exec.ts +39 -0
  110. package/src/tools/integrations/csv-analyzer.ts +92 -0
  111. package/src/tools/integrations/database.ts +44 -0
  112. package/src/tools/integrations/email-send.ts +76 -0
  113. package/src/tools/integrations/git-tool.ts +42 -0
  114. package/src/tools/integrations/github-tool.ts +76 -0
  115. package/src/tools/integrations/image-gen.ts +56 -0
  116. package/src/tools/integrations/index.ts +92 -0
  117. package/src/tools/integrations/jira.ts +83 -0
  118. package/src/tools/integrations/notion.ts +71 -0
  119. package/src/tools/integrations/npm-tool.ts +48 -0
  120. package/src/tools/integrations/pdf-reader.ts +58 -0
  121. package/src/tools/integrations/slack.ts +65 -0
  122. package/src/tools/integrations/summarizer.ts +49 -0
  123. package/src/tools/integrations/translator.ts +48 -0
  124. package/src/tools/integrations/trello.ts +60 -0
  125. package/src/tools/integrations/vector-search.ts +42 -0
  126. package/src/tools/integrations/web-scraper.ts +47 -0
  127. package/src/tools/integrations/web-search.ts +58 -0
  128. package/src/tools/integrations/webhook.ts +38 -0
  129. package/src/ui/components.ts +127 -0
  130. package/tests/brain-seed-extended.test.ts +490 -0
  131. package/tests/collaboration.test.ts +319 -0
  132. package/tests/deploy-and-dag.test.ts +196 -0
  133. package/tests/guardrails.test.ts +177 -0
  134. package/tests/integrations.test.ts +249 -0
  135. package/tests/mcp-servers.test.ts +260 -0
  136. package/tests/voice-enhanced.test.ts +169 -0
  137. package/dist/dtv/data.d.ts +0 -18
  138. package/dist/dtv/data.js +0 -25
  139. package/dist/dtv/trust.d.ts +0 -19
  140. package/dist/dtv/trust.js +0 -40
  141. package/dist/dtv/value.d.ts +0 -23
  142. package/dist/dtv/value.js +0 -38
  143. package/dist/marketplace/index.d.ts +0 -34
  144. package/dist/marketplace/index.js +0 -202
@@ -0,0 +1,30 @@
1
+ import type { MCPTool } from '../mcp';
2
+ export { SlackTool } from './slack';
3
+ export { EmailSendTool } from './email-send';
4
+ export { WebhookTool } from './webhook';
5
+ export { NotionTool } from './notion';
6
+ export { GitHubTool } from './github-tool';
7
+ export { JiraTool } from './jira';
8
+ export { CalendarTool } from './calendar';
9
+ export { TrelloTool } from './trello';
10
+ export { WebSearchTool } from './web-search';
11
+ export { WebScraperTool } from './web-scraper';
12
+ export { DatabaseTool } from './database';
13
+ export { VectorSearchTool } from './vector-search';
14
+ export { CodeExecutionTool } from './code-exec';
15
+ export { GitTool } from './git-tool';
16
+ export { NpmTool } from './npm-tool';
17
+ export { ImageGenerationTool } from './image-gen';
18
+ export { PDFReaderTool } from './pdf-reader';
19
+ export { CSVAnalyzerTool } from './csv-analyzer';
20
+ export { SummarizerTool } from './summarizer';
21
+ export { TranslatorTool } from './translator';
22
+ /**
23
+ * Get all 20 pre-built integration tools.
24
+ */
25
+ export declare function getAllIntegrationTools(): MCPTool[];
26
+ /**
27
+ * Get a specific integration tool by name.
28
+ */
29
+ export declare function getIntegrationTool(name: string): MCPTool | undefined;
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TranslatorTool = exports.SummarizerTool = exports.CSVAnalyzerTool = exports.PDFReaderTool = exports.ImageGenerationTool = exports.NpmTool = exports.GitTool = exports.CodeExecutionTool = exports.VectorSearchTool = exports.DatabaseTool = exports.WebScraperTool = exports.WebSearchTool = exports.TrelloTool = exports.CalendarTool = exports.JiraTool = exports.GitHubTool = exports.NotionTool = exports.WebhookTool = exports.EmailSendTool = exports.SlackTool = void 0;
4
+ exports.getAllIntegrationTools = getAllIntegrationTools;
5
+ exports.getIntegrationTool = getIntegrationTool;
6
+ // Communication
7
+ var slack_1 = require("./slack");
8
+ Object.defineProperty(exports, "SlackTool", { enumerable: true, get: function () { return slack_1.SlackTool; } });
9
+ var email_send_1 = require("./email-send");
10
+ Object.defineProperty(exports, "EmailSendTool", { enumerable: true, get: function () { return email_send_1.EmailSendTool; } });
11
+ var webhook_1 = require("./webhook");
12
+ Object.defineProperty(exports, "WebhookTool", { enumerable: true, get: function () { return webhook_1.WebhookTool; } });
13
+ // Productivity
14
+ var notion_1 = require("./notion");
15
+ Object.defineProperty(exports, "NotionTool", { enumerable: true, get: function () { return notion_1.NotionTool; } });
16
+ var github_tool_1 = require("./github-tool");
17
+ Object.defineProperty(exports, "GitHubTool", { enumerable: true, get: function () { return github_tool_1.GitHubTool; } });
18
+ var jira_1 = require("./jira");
19
+ Object.defineProperty(exports, "JiraTool", { enumerable: true, get: function () { return jira_1.JiraTool; } });
20
+ var calendar_1 = require("./calendar");
21
+ Object.defineProperty(exports, "CalendarTool", { enumerable: true, get: function () { return calendar_1.CalendarTool; } });
22
+ var trello_1 = require("./trello");
23
+ Object.defineProperty(exports, "TrelloTool", { enumerable: true, get: function () { return trello_1.TrelloTool; } });
24
+ // Data & Search
25
+ var web_search_1 = require("./web-search");
26
+ Object.defineProperty(exports, "WebSearchTool", { enumerable: true, get: function () { return web_search_1.WebSearchTool; } });
27
+ var web_scraper_1 = require("./web-scraper");
28
+ Object.defineProperty(exports, "WebScraperTool", { enumerable: true, get: function () { return web_scraper_1.WebScraperTool; } });
29
+ var database_1 = require("./database");
30
+ Object.defineProperty(exports, "DatabaseTool", { enumerable: true, get: function () { return database_1.DatabaseTool; } });
31
+ var vector_search_1 = require("./vector-search");
32
+ Object.defineProperty(exports, "VectorSearchTool", { enumerable: true, get: function () { return vector_search_1.VectorSearchTool; } });
33
+ // Code & Dev
34
+ var code_exec_1 = require("./code-exec");
35
+ Object.defineProperty(exports, "CodeExecutionTool", { enumerable: true, get: function () { return code_exec_1.CodeExecutionTool; } });
36
+ var git_tool_1 = require("./git-tool");
37
+ Object.defineProperty(exports, "GitTool", { enumerable: true, get: function () { return git_tool_1.GitTool; } });
38
+ var npm_tool_1 = require("./npm-tool");
39
+ Object.defineProperty(exports, "NpmTool", { enumerable: true, get: function () { return npm_tool_1.NpmTool; } });
40
+ // Media & Files
41
+ var image_gen_1 = require("./image-gen");
42
+ Object.defineProperty(exports, "ImageGenerationTool", { enumerable: true, get: function () { return image_gen_1.ImageGenerationTool; } });
43
+ var pdf_reader_1 = require("./pdf-reader");
44
+ Object.defineProperty(exports, "PDFReaderTool", { enumerable: true, get: function () { return pdf_reader_1.PDFReaderTool; } });
45
+ var csv_analyzer_1 = require("./csv-analyzer");
46
+ Object.defineProperty(exports, "CSVAnalyzerTool", { enumerable: true, get: function () { return csv_analyzer_1.CSVAnalyzerTool; } });
47
+ // AI & Analysis
48
+ var summarizer_1 = require("./summarizer");
49
+ Object.defineProperty(exports, "SummarizerTool", { enumerable: true, get: function () { return summarizer_1.SummarizerTool; } });
50
+ var translator_1 = require("./translator");
51
+ Object.defineProperty(exports, "TranslatorTool", { enumerable: true, get: function () { return translator_1.TranslatorTool; } });
52
+ // Import all tools for registry
53
+ const slack_2 = require("./slack");
54
+ const email_send_2 = require("./email-send");
55
+ const webhook_2 = require("./webhook");
56
+ const notion_2 = require("./notion");
57
+ const github_tool_2 = require("./github-tool");
58
+ const jira_2 = require("./jira");
59
+ const calendar_2 = require("./calendar");
60
+ const trello_2 = require("./trello");
61
+ const web_search_2 = require("./web-search");
62
+ const web_scraper_2 = require("./web-scraper");
63
+ const database_2 = require("./database");
64
+ const vector_search_2 = require("./vector-search");
65
+ const code_exec_2 = require("./code-exec");
66
+ const git_tool_2 = require("./git-tool");
67
+ const npm_tool_2 = require("./npm-tool");
68
+ const image_gen_2 = require("./image-gen");
69
+ const pdf_reader_2 = require("./pdf-reader");
70
+ const csv_analyzer_2 = require("./csv-analyzer");
71
+ const summarizer_2 = require("./summarizer");
72
+ const translator_2 = require("./translator");
73
+ const ALL_INTEGRATION_TOOLS = [
74
+ slack_2.SlackTool,
75
+ email_send_2.EmailSendTool,
76
+ webhook_2.WebhookTool,
77
+ notion_2.NotionTool,
78
+ github_tool_2.GitHubTool,
79
+ jira_2.JiraTool,
80
+ calendar_2.CalendarTool,
81
+ trello_2.TrelloTool,
82
+ web_search_2.WebSearchTool,
83
+ web_scraper_2.WebScraperTool,
84
+ database_2.DatabaseTool,
85
+ vector_search_2.VectorSearchTool,
86
+ code_exec_2.CodeExecutionTool,
87
+ git_tool_2.GitTool,
88
+ npm_tool_2.NpmTool,
89
+ image_gen_2.ImageGenerationTool,
90
+ pdf_reader_2.PDFReaderTool,
91
+ csv_analyzer_2.CSVAnalyzerTool,
92
+ summarizer_2.SummarizerTool,
93
+ translator_2.TranslatorTool,
94
+ ];
95
+ /**
96
+ * Get all 20 pre-built integration tools.
97
+ */
98
+ function getAllIntegrationTools() {
99
+ return [...ALL_INTEGRATION_TOOLS];
100
+ }
101
+ /**
102
+ * Get a specific integration tool by name.
103
+ */
104
+ function getIntegrationTool(name) {
105
+ return ALL_INTEGRATION_TOOLS.find((t) => t.name === name);
106
+ }
107
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,3 @@
1
+ import type { MCPTool } from '../mcp';
2
+ export declare const JiraTool: MCPTool;
3
+ //# sourceMappingURL=jira.d.ts.map
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JiraTool = void 0;
4
+ exports.JiraTool = {
5
+ name: 'jira',
6
+ description: 'Interact with Jira: create issues, update status, search, add comments. Requires JIRA_URL, JIRA_EMAIL, JIRA_API_TOKEN env vars.',
7
+ inputSchema: {
8
+ type: 'object',
9
+ properties: {
10
+ action: { type: 'string', enum: ['create_issue', 'update_status', 'search', 'add_comment'], description: 'Action to perform' },
11
+ project: { type: 'string', description: 'Project key (for create_issue)' },
12
+ summary: { type: 'string', description: 'Issue summary' },
13
+ description: { type: 'string', description: 'Issue description' },
14
+ issue_type: { type: 'string', description: 'Issue type (default: Task)' },
15
+ issue_key: { type: 'string', description: 'Issue key (e.g., PROJ-123)' },
16
+ status: { type: 'string', description: 'Target status (for update_status)' },
17
+ comment: { type: 'string', description: 'Comment text' },
18
+ jql: { type: 'string', description: 'JQL query (for search)' },
19
+ },
20
+ required: ['action'],
21
+ },
22
+ async execute(input) {
23
+ const baseUrl = process.env.JIRA_URL;
24
+ const email = process.env.JIRA_EMAIL;
25
+ const apiToken = process.env.JIRA_API_TOKEN;
26
+ if (!baseUrl || !email || !apiToken)
27
+ return { content: 'Error: JIRA_URL, JIRA_EMAIL, JIRA_API_TOKEN required', isError: true };
28
+ const auth = Buffer.from(`${email}:${apiToken}`).toString('base64');
29
+ const headers = { 'Authorization': `Basic ${auth}`, 'Content-Type': 'application/json', 'Accept': 'application/json' };
30
+ const action = String(input.action ?? '');
31
+ try {
32
+ if (action === 'create_issue') {
33
+ if (!input.project || !input.summary)
34
+ return { content: 'Error: project, summary required', isError: true };
35
+ const res = await fetch(`${baseUrl}/rest/api/3/issue`, {
36
+ method: 'POST', headers,
37
+ body: JSON.stringify({
38
+ fields: {
39
+ project: { key: input.project },
40
+ summary: input.summary,
41
+ description: input.description ? { type: 'doc', version: 1, content: [{ type: 'paragraph', content: [{ type: 'text', text: String(input.description) }] }] } : undefined,
42
+ issuetype: { name: String(input.issue_type ?? 'Task') },
43
+ },
44
+ }),
45
+ });
46
+ const data = await res.json();
47
+ return { content: `Issue created: ${data.key}` };
48
+ }
49
+ if (action === 'update_status') {
50
+ if (!input.issue_key || !input.status)
51
+ return { content: 'Error: issue_key, status required', isError: true };
52
+ const trRes = await fetch(`${baseUrl}/rest/api/3/issue/${input.issue_key}/transitions`, { headers });
53
+ const trData = await trRes.json();
54
+ const transition = trData.transitions?.find((t) => t.name.toLowerCase() === String(input.status).toLowerCase());
55
+ if (!transition)
56
+ return { content: `No transition found for status: ${input.status}`, isError: true };
57
+ await fetch(`${baseUrl}/rest/api/3/issue/${input.issue_key}/transitions`, {
58
+ method: 'POST', headers, body: JSON.stringify({ transition: { id: transition.id } }),
59
+ });
60
+ return { content: `${input.issue_key} moved to ${input.status}` };
61
+ }
62
+ if (action === 'search') {
63
+ if (!input.jql)
64
+ return { content: 'Error: jql required', isError: true };
65
+ const res = await fetch(`${baseUrl}/rest/api/3/search?jql=${encodeURIComponent(String(input.jql))}&maxResults=20`, { headers });
66
+ const data = await res.json();
67
+ return { content: JSON.stringify(data, null, 2).slice(0, 4000) };
68
+ }
69
+ if (action === 'add_comment') {
70
+ if (!input.issue_key || !input.comment)
71
+ return { content: 'Error: issue_key, comment required', isError: true };
72
+ await fetch(`${baseUrl}/rest/api/3/issue/${input.issue_key}/comment`, {
73
+ method: 'POST', headers,
74
+ body: JSON.stringify({ body: { type: 'doc', version: 1, content: [{ type: 'paragraph', content: [{ type: 'text', text: String(input.comment) }] }] } }),
75
+ });
76
+ return { content: `Comment added to ${input.issue_key}` };
77
+ }
78
+ return { content: `Unknown action: ${action}`, isError: true };
79
+ }
80
+ catch (err) {
81
+ return { content: `Jira error: ${err.message}`, isError: true };
82
+ }
83
+ },
84
+ };
85
+ //# sourceMappingURL=jira.js.map
@@ -0,0 +1,3 @@
1
+ import type { MCPTool } from '../mcp';
2
+ export declare const NotionTool: MCPTool;
3
+ //# sourceMappingURL=notion.d.ts.map
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotionTool = void 0;
4
+ exports.NotionTool = {
5
+ name: 'notion',
6
+ description: 'Interact with Notion API: create pages, search, append blocks. Requires NOTION_API_KEY env var.',
7
+ inputSchema: {
8
+ type: 'object',
9
+ properties: {
10
+ action: { type: 'string', enum: ['create_page', 'search', 'append_block'], description: 'Action to perform' },
11
+ parent_id: { type: 'string', description: 'Parent page/database ID' },
12
+ title: { type: 'string', description: 'Page title (for create_page)' },
13
+ content: { type: 'string', description: 'Content text (for create_page or append_block)' },
14
+ query: { type: 'string', description: 'Search query (for search)' },
15
+ block_id: { type: 'string', description: 'Block ID (for append_block)' },
16
+ },
17
+ required: ['action'],
18
+ },
19
+ async execute(input) {
20
+ const apiKey = process.env.NOTION_API_KEY;
21
+ if (!apiKey)
22
+ return { content: 'Error: NOTION_API_KEY required', isError: true };
23
+ const action = String(input.action ?? '');
24
+ const headers = {
25
+ 'Authorization': `Bearer ${apiKey}`,
26
+ 'Content-Type': 'application/json',
27
+ 'Notion-Version': '2022-06-28',
28
+ };
29
+ try {
30
+ if (action === 'create_page') {
31
+ if (!input.parent_id)
32
+ return { content: 'Error: parent_id required', isError: true };
33
+ const res = await fetch('https://api.notion.com/v1/pages', {
34
+ method: 'POST', headers,
35
+ body: JSON.stringify({
36
+ parent: { page_id: input.parent_id },
37
+ properties: { title: { title: [{ text: { content: String(input.title ?? 'Untitled') } }] } },
38
+ children: input.content ? [{ object: 'block', type: 'paragraph', paragraph: { rich_text: [{ text: { content: String(input.content) } }] } }] : [],
39
+ }),
40
+ });
41
+ const data = await res.json();
42
+ return { content: `Page created: ${data.id ?? 'unknown'}` };
43
+ }
44
+ if (action === 'search') {
45
+ const res = await fetch('https://api.notion.com/v1/search', {
46
+ method: 'POST', headers,
47
+ body: JSON.stringify({ query: String(input.query ?? '') }),
48
+ });
49
+ const data = await res.json();
50
+ return { content: JSON.stringify(data, null, 2).slice(0, 4000) };
51
+ }
52
+ if (action === 'append_block') {
53
+ if (!input.block_id)
54
+ return { content: 'Error: block_id required', isError: true };
55
+ const res = await fetch(`https://api.notion.com/v1/blocks/${input.block_id}/children`, {
56
+ method: 'PATCH', headers,
57
+ body: JSON.stringify({
58
+ children: [{ object: 'block', type: 'paragraph', paragraph: { rich_text: [{ text: { content: String(input.content ?? '') } }] } }],
59
+ }),
60
+ });
61
+ const data = await res.json();
62
+ return { content: `Block appended: ${JSON.stringify(data).slice(0, 500)}` };
63
+ }
64
+ return { content: `Unknown action: ${action}`, isError: true };
65
+ }
66
+ catch (err) {
67
+ return { content: `Notion error: ${err.message}`, isError: true };
68
+ }
69
+ },
70
+ };
71
+ //# sourceMappingURL=notion.js.map
@@ -0,0 +1,3 @@
1
+ import type { MCPTool } from '../mcp';
2
+ export declare const NpmTool: MCPTool;
3
+ //# sourceMappingURL=npm-tool.d.ts.map
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NpmTool = void 0;
4
+ exports.NpmTool = {
5
+ name: 'npm',
6
+ description: 'Search npm registry, get package info, or list installed packages.',
7
+ inputSchema: {
8
+ type: 'object',
9
+ properties: {
10
+ action: { type: 'string', enum: ['search', 'info', 'install'], description: 'Action' },
11
+ package: { type: 'string', description: 'Package name' },
12
+ query: { type: 'string', description: 'Search query (for search)' },
13
+ },
14
+ required: ['action'],
15
+ },
16
+ async execute(input) {
17
+ const action = String(input.action ?? '');
18
+ try {
19
+ if (action === 'search') {
20
+ const q = String(input.query ?? input.package ?? '');
21
+ if (!q)
22
+ return { content: 'Error: query required', isError: true };
23
+ const res = await fetch(`https://registry.npmjs.org/-/v1/search?text=${encodeURIComponent(q)}&size=10`);
24
+ const data = await res.json();
25
+ const results = (data.objects ?? []).map((o) => `${o.package.name}@${o.package.version} — ${o.package.description}`).join('\n');
26
+ return { content: results || 'No results' };
27
+ }
28
+ if (action === 'info') {
29
+ const pkg = String(input.package ?? '');
30
+ if (!pkg)
31
+ return { content: 'Error: package required', isError: true };
32
+ const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(pkg)}`);
33
+ if (!res.ok)
34
+ return { content: `Package not found: ${pkg}`, isError: true };
35
+ const data = await res.json();
36
+ const latest = data['dist-tags']?.latest;
37
+ return { content: `${data.name}@${latest}\n${data.description}\nLicense: ${data.license}\nHomepage: ${data.homepage}` };
38
+ }
39
+ if (action === 'install') {
40
+ return { content: 'Error: npm install is not supported via this tool for security. Use shell access instead.', isError: true };
41
+ }
42
+ return { content: `Unknown action: ${action}`, isError: true };
43
+ }
44
+ catch (err) {
45
+ return { content: `NPM error: ${err.message}`, isError: true };
46
+ }
47
+ },
48
+ };
49
+ //# sourceMappingURL=npm-tool.js.map
@@ -0,0 +1,3 @@
1
+ import type { MCPTool } from '../mcp';
2
+ export declare const PDFReaderTool: MCPTool;
3
+ //# sourceMappingURL=pdf-reader.d.ts.map
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.PDFReaderTool = void 0;
37
+ const fs = __importStar(require("fs"));
38
+ exports.PDFReaderTool = {
39
+ name: 'pdf-reader',
40
+ description: 'Extract text content from a PDF file. Uses basic binary parsing (no external deps).',
41
+ inputSchema: {
42
+ type: 'object',
43
+ properties: {
44
+ file_path: { type: 'string', description: 'Path to PDF file' },
45
+ url: { type: 'string', description: 'URL of PDF file (alternative to file_path)' },
46
+ max_length: { type: 'number', description: 'Max characters to return (default: 5000)' },
47
+ },
48
+ required: [],
49
+ },
50
+ async execute(input) {
51
+ const maxLen = Number(input.max_length ?? 5000);
52
+ try {
53
+ let buffer;
54
+ if (input.url) {
55
+ const res = await fetch(String(input.url));
56
+ if (!res.ok)
57
+ return { content: `HTTP ${res.status}`, isError: true };
58
+ buffer = Buffer.from(await res.arrayBuffer());
59
+ }
60
+ else if (input.file_path) {
61
+ buffer = fs.readFileSync(String(input.file_path));
62
+ }
63
+ else {
64
+ return { content: 'Error: file_path or url required', isError: true };
65
+ }
66
+ // Basic PDF text extraction — find text between BT/ET markers and decode
67
+ const content = buffer.toString('latin1');
68
+ const textParts = [];
69
+ // Extract text from stream objects
70
+ const streamRegex = /stream\r?\n([\s\S]*?)\r?\nendstream/g;
71
+ let match;
72
+ while ((match = streamRegex.exec(content)) !== null) {
73
+ const stream = match[1];
74
+ // Extract text shown with Tj or TJ operators
75
+ const tjRegex = /\(([^)]*)\)\s*Tj/g;
76
+ let tjMatch;
77
+ while ((tjMatch = tjRegex.exec(stream)) !== null) {
78
+ textParts.push(tjMatch[1]);
79
+ }
80
+ }
81
+ const text = textParts.join(' ').replace(/\\n/g, '\n').replace(/\\\(/g, '(').replace(/\\\)/g, ')');
82
+ if (!text.trim())
83
+ return { content: '(No extractable text found — PDF may use compressed streams. Consider using a dedicated PDF library.)' };
84
+ return { content: text.slice(0, maxLen), metadata: { pages_approx: (content.match(/\/Type\s*\/Page[^s]/g) || []).length } };
85
+ }
86
+ catch (err) {
87
+ return { content: `PDF error: ${err.message}`, isError: true };
88
+ }
89
+ },
90
+ };
91
+ //# sourceMappingURL=pdf-reader.js.map
@@ -0,0 +1,3 @@
1
+ import type { MCPTool } from '../mcp';
2
+ export declare const SlackTool: MCPTool;
3
+ //# sourceMappingURL=slack.d.ts.map
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SlackTool = void 0;
4
+ exports.SlackTool = {
5
+ name: 'slack',
6
+ description: 'Send messages to Slack channels, list channels, or search messages. Requires SLACK_WEBHOOK_URL or SLACK_BOT_TOKEN env var.',
7
+ inputSchema: {
8
+ type: 'object',
9
+ properties: {
10
+ action: { type: 'string', enum: ['send_message', 'list_channels', 'search'], description: 'Action to perform' },
11
+ channel: { type: 'string', description: 'Channel name or ID (for send_message)' },
12
+ text: { type: 'string', description: 'Message text (for send_message) or search query (for search)' },
13
+ },
14
+ required: ['action'],
15
+ },
16
+ async execute(input) {
17
+ const action = String(input.action ?? '');
18
+ const token = process.env.SLACK_BOT_TOKEN;
19
+ const webhookUrl = process.env.SLACK_WEBHOOK_URL;
20
+ try {
21
+ if (action === 'send_message') {
22
+ if (!input.text)
23
+ return { content: 'Error: text is required', isError: true };
24
+ if (webhookUrl) {
25
+ const res = await fetch(webhookUrl, {
26
+ method: 'POST',
27
+ headers: { 'Content-Type': 'application/json' },
28
+ body: JSON.stringify({ channel: input.channel, text: input.text }),
29
+ });
30
+ return { content: `Message sent (status: ${res.status})` };
31
+ }
32
+ if (!token)
33
+ return { content: 'Error: SLACK_BOT_TOKEN or SLACK_WEBHOOK_URL required', isError: true };
34
+ const res = await fetch('https://slack.com/api/chat.postMessage', {
35
+ method: 'POST',
36
+ headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' },
37
+ body: JSON.stringify({ channel: input.channel, text: input.text }),
38
+ });
39
+ const data = await res.json();
40
+ return { content: data.ok ? 'Message sent' : `Error: ${data.error}`, isError: !data.ok };
41
+ }
42
+ if (action === 'list_channels') {
43
+ if (!token)
44
+ return { content: 'Error: SLACK_BOT_TOKEN required', isError: true };
45
+ const res = await fetch('https://slack.com/api/conversations.list', {
46
+ headers: { 'Authorization': `Bearer ${token}` },
47
+ });
48
+ const data = await res.json();
49
+ return { content: JSON.stringify(data, null, 2) };
50
+ }
51
+ if (action === 'search') {
52
+ if (!token)
53
+ return { content: 'Error: SLACK_BOT_TOKEN required', isError: true };
54
+ const res = await fetch(`https://slack.com/api/search.messages?query=${encodeURIComponent(String(input.text ?? ''))}`, {
55
+ headers: { 'Authorization': `Bearer ${token}` },
56
+ });
57
+ const data = await res.json();
58
+ return { content: JSON.stringify(data, null, 2) };
59
+ }
60
+ return { content: `Unknown action: ${action}`, isError: true };
61
+ }
62
+ catch (err) {
63
+ return { content: `Slack error: ${err.message}`, isError: true };
64
+ }
65
+ },
66
+ };
67
+ //# sourceMappingURL=slack.js.map
@@ -0,0 +1,3 @@
1
+ import type { MCPTool } from '../mcp';
2
+ export declare const SummarizerTool: MCPTool;
3
+ //# sourceMappingURL=summarizer.d.ts.map
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SummarizerTool = void 0;
4
+ exports.SummarizerTool = {
5
+ name: 'summarizer',
6
+ description: 'Summarize long text using an LLM API. Requires OPENAI_API_KEY or LLM_API_URL env var.',
7
+ inputSchema: {
8
+ type: 'object',
9
+ properties: {
10
+ text: { type: 'string', description: 'Text to summarize' },
11
+ max_length: { type: 'number', description: 'Approximate max summary length in words (default: 200)' },
12
+ style: { type: 'string', enum: ['brief', 'detailed', 'bullets'], description: 'Summary style (default: brief)' },
13
+ },
14
+ required: ['text'],
15
+ },
16
+ async execute(input) {
17
+ const text = String(input.text ?? '');
18
+ if (!text)
19
+ return { content: 'Error: text required', isError: true };
20
+ const style = String(input.style ?? 'brief');
21
+ const maxLen = Number(input.max_length ?? 200);
22
+ const prompt = `Summarize the following text in a ${style} style, approximately ${maxLen} words:\n\n${text.slice(0, 15000)}`;
23
+ try {
24
+ const apiKey = process.env.OPENAI_API_KEY;
25
+ const apiUrl = process.env.LLM_API_URL || 'https://api.openai.com/v1/chat/completions';
26
+ if (!apiKey && apiUrl === 'https://api.openai.com/v1/chat/completions') {
27
+ return { content: 'Error: OPENAI_API_KEY or LLM_API_URL required', isError: true };
28
+ }
29
+ const headers = { 'Content-Type': 'application/json' };
30
+ if (apiKey)
31
+ headers['Authorization'] = `Bearer ${apiKey}`;
32
+ const res = await fetch(apiUrl, {
33
+ method: 'POST', headers,
34
+ body: JSON.stringify({
35
+ model: process.env.LLM_MODEL || 'gpt-4o-mini',
36
+ messages: [{ role: 'user', content: prompt }],
37
+ max_tokens: maxLen * 3,
38
+ }),
39
+ });
40
+ const data = await res.json();
41
+ const summary = data.choices?.[0]?.message?.content ?? 'No summary generated';
42
+ return { content: summary };
43
+ }
44
+ catch (err) {
45
+ return { content: `Summarizer error: ${err.message}`, isError: true };
46
+ }
47
+ },
48
+ };
49
+ //# sourceMappingURL=summarizer.js.map
@@ -0,0 +1,3 @@
1
+ import type { MCPTool } from '../mcp';
2
+ export declare const TranslatorTool: MCPTool;
3
+ //# sourceMappingURL=translator.d.ts.map
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TranslatorTool = void 0;
4
+ exports.TranslatorTool = {
5
+ name: 'translator',
6
+ description: 'Translate text between languages using an LLM. Requires OPENAI_API_KEY or LLM_API_URL env var.',
7
+ inputSchema: {
8
+ type: 'object',
9
+ properties: {
10
+ text: { type: 'string', description: 'Text to translate' },
11
+ from: { type: 'string', description: 'Source language (auto-detect if omitted)' },
12
+ to: { type: 'string', description: 'Target language (required)' },
13
+ },
14
+ required: ['text', 'to'],
15
+ },
16
+ async execute(input) {
17
+ const text = String(input.text ?? '');
18
+ const to = String(input.to ?? '');
19
+ if (!text || !to)
20
+ return { content: 'Error: text and to are required', isError: true };
21
+ const from = input.from ? ` from ${input.from}` : '';
22
+ const prompt = `Translate the following text${from} to ${to}. Return only the translation, no explanations:\n\n${text.slice(0, 10000)}`;
23
+ try {
24
+ const apiKey = process.env.OPENAI_API_KEY;
25
+ const apiUrl = process.env.LLM_API_URL || 'https://api.openai.com/v1/chat/completions';
26
+ if (!apiKey && apiUrl === 'https://api.openai.com/v1/chat/completions') {
27
+ return { content: 'Error: OPENAI_API_KEY or LLM_API_URL required', isError: true };
28
+ }
29
+ const headers = { 'Content-Type': 'application/json' };
30
+ if (apiKey)
31
+ headers['Authorization'] = `Bearer ${apiKey}`;
32
+ const res = await fetch(apiUrl, {
33
+ method: 'POST', headers,
34
+ body: JSON.stringify({
35
+ model: process.env.LLM_MODEL || 'gpt-4o-mini',
36
+ messages: [{ role: 'user', content: prompt }],
37
+ }),
38
+ });
39
+ const data = await res.json();
40
+ const translation = data.choices?.[0]?.message?.content ?? 'No translation generated';
41
+ return { content: translation };
42
+ }
43
+ catch (err) {
44
+ return { content: `Translation error: ${err.message}`, isError: true };
45
+ }
46
+ },
47
+ };
48
+ //# sourceMappingURL=translator.js.map
@@ -0,0 +1,3 @@
1
+ import type { MCPTool } from '../mcp';
2
+ export declare const TrelloTool: MCPTool;
3
+ //# sourceMappingURL=trello.d.ts.map