@weave_protocol/mund 0.1.13 → 0.2.2

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/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@weave_protocol/mund",
3
- "version": "0.1.13",
3
+ "version": "0.2.2",
4
4
  "description": "The Guardian Protocol - MCP-based security monitoring for agentic AI systems",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
7
- "mund-mcp": "./dist/index.js"
7
+ "mund-mcp": "dist/index.js"
8
8
  },
9
9
  "type": "module",
10
10
  "scripts": {
@@ -20,7 +20,7 @@
20
20
  "license": "Apache-2.0",
21
21
  "repository": {
22
22
  "type": "git",
23
- "url": "https://github.com/Tyox-all/Weave_Protocol.git"
23
+ "url": "git+https://github.com/Tyox-all/Weave_Protocol.git"
24
24
  },
25
25
  "engines": {
26
26
  "node": ">=20.0.0"
package/src/index.ts CHANGED
@@ -2,8 +2,6 @@
2
2
  /**
3
3
  * Mund - The Guardian Protocol
4
4
  * Main Entry Point
5
- *
6
- * An MCP-based security monitoring protocol for agentic AI systems.
7
5
  */
8
6
 
9
7
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
@@ -18,6 +16,21 @@ import { AnalyzerEngine } from './analyzers/index.js';
18
16
  import { NotificationHub } from './notifications/index.js';
19
17
  import { registerAllTools } from './tools/index.js';
20
18
 
19
+ // Threat Intelligence imports
20
+ import { threatIntel } from './threat-intel-manager.js';
21
+ import {
22
+ threatIntelTools,
23
+ createThreatIntelToolHandlers,
24
+ UpdateThreatIntelSchema,
25
+ ListIntelSourcesSchema,
26
+ IntelStatusSchema,
27
+ AddIntelSourceSchema,
28
+ RemoveIntelSourceSchema,
29
+ ThreatScanSchema,
30
+ ListPatternsSchema,
31
+ TogglePatternSchema,
32
+ } from './threat-intel-tools.js';
33
+
21
34
  // ============================================================================
22
35
  // Configuration Loading
23
36
  // ============================================================================
@@ -80,6 +93,59 @@ function loadConfig(): MundConfig {
80
93
  return config;
81
94
  }
82
95
 
96
+ // ============================================================================
97
+ // Threat Intelligence Tool Registration
98
+ // ============================================================================
99
+
100
+ function registerThreatIntelTools(server: McpServer): void {
101
+ const handlers = createThreatIntelToolHandlers(threatIntel);
102
+
103
+ // Map tool names to schemas
104
+ const schemaMap: Record<string, Record<string, any>> = {
105
+ 'mund_update_threat_intel': UpdateThreatIntelSchema,
106
+ 'mund_list_intel_sources': ListIntelSourcesSchema,
107
+ 'mund_intel_status': IntelStatusSchema,
108
+ 'mund_add_intel_source': AddIntelSourceSchema,
109
+ 'mund_remove_intel_source': RemoveIntelSourceSchema,
110
+ 'mund_threat_scan': ThreatScanSchema,
111
+ 'mund_list_patterns': ListPatternsSchema,
112
+ 'mund_toggle_pattern': TogglePatternSchema,
113
+ };
114
+
115
+ // Register each threat intel tool with Zod schema
116
+ for (const tool of threatIntelTools) {
117
+ const schema = schemaMap[tool.name];
118
+ if (!schema) continue;
119
+
120
+ server.tool(
121
+ tool.name,
122
+ tool.description,
123
+ schema,
124
+ async (args: any) => {
125
+ const handler = handlers[tool.name as keyof typeof handlers];
126
+ if (!handler) {
127
+ return {
128
+ content: [{ type: 'text' as const, text: JSON.stringify({ error: `Unknown tool: ${tool.name}` }) }]
129
+ };
130
+ }
131
+
132
+ try {
133
+ const result = await handler(args);
134
+ return {
135
+ content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }]
136
+ };
137
+ } catch (error) {
138
+ return {
139
+ content: [{ type: 'text' as const, text: JSON.stringify({
140
+ error: error instanceof Error ? error.message : String(error)
141
+ }) }]
142
+ };
143
+ }
144
+ }
145
+ );
146
+ }
147
+ }
148
+
83
149
  // ============================================================================
84
150
  // Server Initialization
85
151
  // ============================================================================
@@ -88,7 +154,7 @@ async function createMundServer(config: MundConfig): Promise<McpServer> {
88
154
  // Create MCP server
89
155
  const server = new McpServer({
90
156
  name: 'mund-mcp-server',
91
- version: '0.1.0'
157
+ version: '0.2.0'
92
158
  });
93
159
 
94
160
  // Initialize storage
@@ -111,15 +177,22 @@ async function createMundServer(config: MundConfig): Promise<McpServer> {
111
177
  }
112
178
  }
113
179
 
114
- // Register all tools
180
+ // Register all core tools
115
181
  registerAllTools(server, storage, rules, analyzer, notificationHub, config.block_mode);
116
182
 
183
+ // Register threat intelligence tools
184
+ registerThreatIntelTools(server);
185
+
186
+ // Get threat intel status for logging
187
+ const intelStatus = threatIntel.getStatus();
188
+
117
189
  // Log startup info
118
- console.error(`Mund Guardian Protocol v0.1.0`);
190
+ console.error(`Mund Guardian Protocol v0.2.0`);
119
191
  console.error(`- Transport: ${config.transport}`);
120
192
  console.error(`- Storage: ${config.storage_type}`);
121
193
  console.error(`- Block Mode: ${config.block_mode ? 'enabled' : 'disabled'}`);
122
194
  console.error(`- Rules Loaded: ${rules.filter(r => r.enabled).length}`);
195
+ console.error(`- Threat Intel: ${intelStatus.patterns.total} patterns from ${intelStatus.sources.enabled} sources`);
123
196
  console.error(`- Notifiers: ${notificationHub.getNotifierNames().join(', ') || 'none'}`);
124
197
 
125
198
  return server;
@@ -145,7 +218,12 @@ async function runHTTP(config: MundConfig): Promise<void> {
145
218
 
146
219
  // Health check endpoint
147
220
  app.get('/health', (_req, res) => {
148
- res.json({ status: 'ok', version: '0.1.0' });
221
+ res.json({ status: 'ok', version: '0.2.0' });
222
+ });
223
+
224
+ // Threat intel status endpoint
225
+ app.get('/intel/status', (_req, res) => {
226
+ res.json(threatIntel.getStatus());
149
227
  });
150
228
 
151
229
  // MCP endpoint
@@ -211,6 +289,11 @@ Environment Variables:
211
289
  MUND_WEBHOOK_URL Generic webhook URL
212
290
  MUND_WEBHOOK_HEADERS JSON string of webhook headers
213
291
 
292
+ Threat Intelligence:
293
+ Built-in threat patterns with MITRE ATT&CK mapping.
294
+ Use mund_intel_status to check coverage.
295
+ Use mund_update_threat_intel to pull latest patterns.
296
+
214
297
  Examples:
215
298
  # Run as stdio server (for MCP clients)
216
299
  mund-mcp
@@ -224,7 +307,7 @@ Examples:
224
307
  # Run in block mode
225
308
  mund-mcp --block
226
309
 
227
- For more information, visit: https://github.com/your-org/mund-mcp
310
+ For more information, visit: https://github.com/Tyox-all/Weave_Protocol
228
311
  `);
229
312
  }
230
313
 
@@ -238,7 +321,7 @@ async function main(): Promise<void> {
238
321
  }
239
322
 
240
323
  if (args.includes('--version') || args.includes('-v')) {
241
- console.log('0.1.0');
324
+ console.log('0.2.0');
242
325
  process.exit(0);
243
326
  }
244
327
 
@@ -283,3 +366,11 @@ main().catch(error => {
283
366
  console.error('Fatal error:', error);
284
367
  process.exit(1);
285
368
  });
369
+
370
+ // ============================================================================
371
+ // Exports for programmatic use
372
+ // ============================================================================
373
+
374
+ export { ThreatIntelManager, threatIntel } from './threat-intel-manager.js';
375
+ export { threatIntelTools, createThreatIntelToolHandlers } from './threat-intel-tools.js';
376
+ export * from './threat-intel-types.js';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Threat Intelligence Module
3
+ * @weave_protocol/mund
4
+ */
5
+
6
+ // Types
7
+ export * from './threat-intel-types.js';
8
+
9
+ // Manager
10
+ export { ThreatIntelManager, threatIntel } from './threat-intel-manager.js';
11
+
12
+ // MCP Tools
13
+ export { threatIntelTools, createThreatIntelToolHandlers } from './threat-intel-tools.js';