@pipeworx/mcp-malwarebazaar 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pipeworx
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # mcp-malwarebazaar
2
+
3
+ MalwareBazaar MCP — abuse.ch malware sample database (free, key required)
4
+
5
+ Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 250+ live data sources.
6
+
7
+ ## Tools
8
+
9
+ | Tool | Description |
10
+ |------|-------------|
11
+ | `search_tag` | Find samples tagged with a string (e.g., "emotet", "macro", "exe"). |
12
+ | `search_family` | Find samples for a malware family name. |
13
+ | `search_signature` | Find samples matching a YARA / threat-intel signature. |
14
+ | `recent_samples` | Most recent samples in MalwareBazaar. Use the selector to pick a chunk size. |
15
+
16
+ ## Quick Start
17
+
18
+ Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
19
+
20
+ ```json
21
+ {
22
+ "mcpServers": {
23
+ "malwarebazaar": {
24
+ "url": "https://gateway.pipeworx.io/malwarebazaar/mcp"
25
+ }
26
+ }
27
+ }
28
+ ```
29
+
30
+ Or connect to the full Pipeworx gateway for access to all 250+ data sources:
31
+
32
+ ```json
33
+ {
34
+ "mcpServers": {
35
+ "pipeworx": {
36
+ "url": "https://gateway.pipeworx.io/mcp"
37
+ }
38
+ }
39
+ }
40
+ ```
41
+
42
+ ## Using with ask_pipeworx
43
+
44
+ Instead of calling tools directly, you can ask questions in plain English:
45
+
46
+ ```
47
+ ask_pipeworx({ question: "your question about Malwarebazaar data" })
48
+ ```
49
+
50
+ The gateway picks the right tool and fills the arguments automatically.
51
+
52
+ ## More
53
+
54
+ - [All tools and guides](https://github.com/pipeworx-io/examples)
55
+ - [pipeworx.io](https://pipeworx.io)
56
+
57
+ ## License
58
+
59
+ MIT
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@pipeworx/mcp-malwarebazaar",
3
+ "version": "0.1.0",
4
+ "description": "MalwareBazaar MCP — abuse.ch malware sample database (free, key required)",
5
+ "type": "module",
6
+ "main": "src/index.ts",
7
+ "types": "src/index.ts",
8
+ "keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "malwarebazaar"],
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/pipeworx-io/mcp-malwarebazaar"
13
+ },
14
+ "scripts": {
15
+ "typecheck": "tsc --noEmit"
16
+ },
17
+ "devDependencies": {
18
+ "typescript": "^5.7.0"
19
+ }
20
+ }
package/server.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.pipeworx-io/malwarebazaar",
4
+ "title": "Malwarebazaar",
5
+ "description": "MalwareBazaar MCP — abuse.ch malware sample database (free, key required)",
6
+ "version": "0.1.0",
7
+ "websiteUrl": "https://pipeworx.io/packs/malwarebazaar",
8
+ "repository": {
9
+ "url": "https://github.com/pipeworx-io/mcp-malwarebazaar",
10
+ "source": "github"
11
+ },
12
+ "remotes": [
13
+ {
14
+ "type": "streamable-http",
15
+ "url": "https://gateway.pipeworx.io/malwarebazaar/mcp"
16
+ }
17
+ ]
18
+ }
package/src/index.ts ADDED
@@ -0,0 +1,185 @@
1
+ interface McpToolDefinition {
2
+ name: string;
3
+ description: string;
4
+ inputSchema: {
5
+ type: 'object';
6
+ properties: Record<string, unknown>;
7
+ required?: string[];
8
+ };
9
+ }
10
+
11
+ interface McpToolExport {
12
+ tools: McpToolDefinition[];
13
+ callTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
14
+ meter?: { credits: number };
15
+ cost?: Record<string, unknown>;
16
+ provider?: string;
17
+ }
18
+
19
+ /**
20
+ * MalwareBazaar MCP — abuse.ch malware sample database (free, key required)
21
+ *
22
+ * Search by hash / family / tag / signature. Pairs with `virustotal` (per-
23
+ * sample verdict aggregation), `threatfox` (related IOCs), and `alienvault-otx`
24
+ * (campaign context).
25
+ *
26
+ * API: https://bazaar.abuse.ch/api/
27
+ * Auth: header `Auth-Key`. Free, shares the same key as ThreatFox at
28
+ * auth.abuse.ch.
29
+ *
30
+ * Tools:
31
+ * - get_sample_info: metadata for a specific sample by hash
32
+ * - search_tag: samples tagged with X (e.g., "emotet", "ransomware")
33
+ * - search_family: samples by malware family name
34
+ * - search_signature: samples matching a YARA/Rapid7 signature
35
+ * - recent_samples: most recent N samples added to the corpus
36
+ */
37
+
38
+
39
+ const ENDPOINT = 'https://mb-api.abuse.ch/api/v1/';
40
+
41
+ const tools: McpToolExport['tools'] = [
42
+ {
43
+ name: 'get_sample_info',
44
+ description:
45
+ 'Metadata for a malware sample by hash (md5/sha1/sha256). Returns file type, signature, file_name, first/last seen, tags, family, intel sources.',
46
+ inputSchema: {
47
+ type: 'object',
48
+ properties: {
49
+ hash: { type: 'string', description: 'md5 / sha1 / sha256' },
50
+ },
51
+ required: ['hash'],
52
+ },
53
+ },
54
+ {
55
+ name: 'search_tag',
56
+ description: 'Find samples tagged with a string (e.g., "emotet", "macro", "exe").',
57
+ inputSchema: {
58
+ type: 'object',
59
+ properties: {
60
+ tag: { type: 'string', description: 'Tag string' },
61
+ limit: { type: 'number', description: 'Max results (default 100)' },
62
+ },
63
+ required: ['tag'],
64
+ },
65
+ },
66
+ {
67
+ name: 'search_family',
68
+ description: 'Find samples for a malware family name.',
69
+ inputSchema: {
70
+ type: 'object',
71
+ properties: {
72
+ family: { type: 'string', description: 'Family name (signature)' },
73
+ limit: { type: 'number', description: 'Max results (default 100)' },
74
+ },
75
+ required: ['family'],
76
+ },
77
+ },
78
+ {
79
+ name: 'search_signature',
80
+ description: 'Find samples matching a YARA / threat-intel signature.',
81
+ inputSchema: {
82
+ type: 'object',
83
+ properties: {
84
+ signature: { type: 'string', description: 'Signature name (e.g., "Cobalt Strike")' },
85
+ limit: { type: 'number', description: 'Max results (default 100)' },
86
+ },
87
+ required: ['signature'],
88
+ },
89
+ },
90
+ {
91
+ name: 'recent_samples',
92
+ description: 'Most recent samples in MalwareBazaar. Use the selector to pick a chunk size.',
93
+ inputSchema: {
94
+ type: 'object',
95
+ properties: {
96
+ selector: {
97
+ type: 'string',
98
+ description: '"time" (1h window) or "100" (last 100 samples). Default "100".',
99
+ enum: ['time', '100'],
100
+ },
101
+ },
102
+ required: [],
103
+ },
104
+ },
105
+ ];
106
+
107
+ async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
108
+ const apiKey = (args._apiKey as string | undefined)?.trim();
109
+ if (!apiKey) {
110
+ throw new Error(
111
+ 'MalwareBazaar requires an API key. Contact the operator about platform credentials (PLATFORM_ABUSECH_KEY), or BYO via ?_apiKey=<key> after registering at https://auth.abuse.ch.',
112
+ );
113
+ }
114
+ switch (name) {
115
+ case 'get_sample_info':
116
+ return mbPost(apiKey, { query: 'get_info', hash: reqStr(args, 'hash', '"<sha256>"') });
117
+ case 'search_tag':
118
+ return mbPost(apiKey, {
119
+ query: 'get_taginfo',
120
+ tag: reqStr(args, 'tag', '"emotet"'),
121
+ limit: (args.limit as number) ?? 100,
122
+ });
123
+ case 'search_family':
124
+ return mbPost(apiKey, {
125
+ query: 'get_siginfo',
126
+ signature: reqStr(args, 'family', '"Cobalt Strike"'),
127
+ limit: (args.limit as number) ?? 100,
128
+ });
129
+ case 'search_signature':
130
+ return mbPost(apiKey, {
131
+ query: 'get_yara',
132
+ yara_rule: reqStr(args, 'signature', '"<yara_rule_name>"'),
133
+ limit: (args.limit as number) ?? 100,
134
+ });
135
+ case 'recent_samples':
136
+ return mbPost(apiKey, { query: 'get_recent', selector: (args.selector as string) ?? '100' });
137
+ default:
138
+ throw new Error(`Unknown tool: ${name}`);
139
+ }
140
+ }
141
+
142
+ function reqStr(args: Record<string, unknown>, key: string, example: string): string {
143
+ const v = args[key];
144
+ if (typeof v !== 'string' || !v.trim()) {
145
+ throw new Error(`Required argument "${key}" is missing or empty. Pass a string like ${example}.`);
146
+ }
147
+ return v;
148
+ }
149
+
150
+ async function mbPost(apiKey: string, body: Record<string, unknown>) {
151
+ const form = new URLSearchParams();
152
+ for (const [k, v] of Object.entries(body)) form.set(k, String(v));
153
+
154
+ const res = await fetch(ENDPOINT, {
155
+ method: 'POST',
156
+ headers: {
157
+ 'Auth-Key': apiKey,
158
+ 'Content-Type': 'application/x-www-form-urlencoded',
159
+ Accept: 'application/json',
160
+ },
161
+ body: form.toString(),
162
+ });
163
+ if (res.status === 401 || res.status === 403) throw new Error('MalwareBazaar: unauthorized — check the API key');
164
+ if (res.status === 429) throw new Error('MalwareBazaar: rate-limit (HTTP 429)');
165
+ if (!res.ok) {
166
+ const text = await res.text();
167
+ throw new Error(`MalwareBazaar error: ${res.status} ${text.slice(0, 200)}`);
168
+ }
169
+ const data = (await res.json()) as {
170
+ query_status?: string;
171
+ data?: unknown[];
172
+ };
173
+
174
+ if (data.query_status && data.query_status !== 'ok' && data.query_status !== 'no_results') {
175
+ throw new Error(`MalwareBazaar: ${data.query_status}`);
176
+ }
177
+ return {
178
+ query: body.query,
179
+ status: data.query_status ?? null,
180
+ count: Array.isArray(data.data) ? data.data.length : 0,
181
+ samples: Array.isArray(data.data) ? data.data : [],
182
+ };
183
+ }
184
+
185
+ export default { tools, callTool, meter: { credits: 1 } } satisfies McpToolExport;
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "outDir": "dist",
10
+ "rootDir": "src",
11
+ "declaration": true
12
+ },
13
+ "include": ["src"]
14
+ }