anastasis-mcp-server 1.0.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) 2025 0xazanul
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,208 @@
1
+ # Anastasis MCP Server
2
+
3
+ MCP server for JavaScript endpoint discovery and attack surface mapping. Gives Claude (and any MCP client) native tools to discover API endpoints from JavaScript files, probe API documentation, extract parameters, and reconstruct sourcemaps.
4
+
5
+ Powered by the [Anastasis](https://github.com/0xazanul/Anastasis) engine.
6
+
7
+ ## Install
8
+
9
+ ### Claude Code (recommended)
10
+
11
+ ```bash
12
+ claude mcp add anastasis -- npx -y anastasis-mcp-server
13
+ ```
14
+
15
+ ### Claude Desktop
16
+
17
+ Add to `claude_desktop_config.json`:
18
+
19
+ ```json
20
+ {
21
+ "mcpServers": {
22
+ "anastasis": {
23
+ "command": "npx",
24
+ "args": ["-y", "anastasis-mcp-server"]
25
+ }
26
+ }
27
+ }
28
+ ```
29
+
30
+ ### Any MCP Client
31
+
32
+ ```bash
33
+ npx -y anastasis-mcp-server
34
+ ```
35
+
36
+ Communicates over stdio using the [Model Context Protocol](https://modelcontextprotocol.io).
37
+
38
+ ## Tools
39
+
40
+ ### `scan_domain`
41
+
42
+ Full domain scan. Discovers JS files from 23+ passive sources, parses them for API endpoints, probes API documentation, extracts parameters.
43
+
44
+ ```
45
+ Input:
46
+ domain: "example.com"
47
+ mode: "quick" | "standard" | "deep" (default: standard)
48
+ concurrency: 1-50 (default: 10)
49
+ include_subdomains: true | false (default: false)
50
+
51
+ Output:
52
+ endpoints[], paramSpecs[], jsFiles, apiDocs, sources, stats, summary
53
+ ```
54
+
55
+ **Modes:**
56
+ - **quick** — API documentation probe only (~30s). Checks Swagger, GraphQL, WADL, WSDL.
57
+ - **standard** — JS discovery + AST parsing + API docs (~2-3 min). Default.
58
+ - **deep** — Full parameter extraction with nested body schemas (~3-5 min).
59
+
60
+ ### `discover_js_files`
61
+
62
+ Find all JavaScript files for a domain from 23+ passive sources (Wayback Machine, OTX, URLScan, GAU, CommonCrawl, VirusTotal, HTML parsing, and more).
63
+
64
+ ```
65
+ Input:
66
+ domain: "example.com"
67
+ concurrency: 1-50 (default: 10)
68
+
69
+ Output:
70
+ files[{url, source}], sourceSummary[], inlineScripts count
71
+ ```
72
+
73
+ ### `parse_js_file`
74
+
75
+ Parse a single JavaScript file for API endpoints. Provide a URL or raw content.
76
+
77
+ ```
78
+ Input:
79
+ url: "https://example.com/app.js" (or)
80
+ content: "fetch('/api/users')..."
81
+ extract_params: true | false (default: true)
82
+ build_schemas: true | false (default: false)
83
+
84
+ Output:
85
+ endpoints[], paramSpecs[], stats, discoveredChunks[]
86
+ ```
87
+
88
+ ### `parse_multiple_js`
89
+
90
+ Parse multiple JavaScript files in parallel.
91
+
92
+ ```
93
+ Input:
94
+ urls: ["https://example.com/a.js", "https://example.com/b.js"]
95
+ extract_params: true (default: true)
96
+ concurrency: 1-50 (default: 10)
97
+
98
+ Output:
99
+ endpoints[], paramSpecs[], stats
100
+ ```
101
+
102
+ ### `check_api_docs`
103
+
104
+ Probe a domain for API documentation — Swagger/OpenAPI, GraphQL introspection, WADL, WSDL, well-known endpoints, API version detection.
105
+
106
+ ```
107
+ Input:
108
+ domain: "example.com"
109
+ sources: ["swagger", "graphql", "wadl", "wsdl", "well-known", "api-probe", "sitemap"]
110
+ timeout: 60000 (ms)
111
+
112
+ Output:
113
+ endpoints[], jsFilesFromManifests[], sourceResults[]
114
+ ```
115
+
116
+ ### `extract_sourcemap`
117
+
118
+ Check a JavaScript file for sourcemaps and recover original source files.
119
+
120
+ ```
121
+ Input:
122
+ url: "https://example.com/app.js"
123
+
124
+ Output:
125
+ sourcemapFound, sourcemapUrl, sourceFiles[{path, language, size, preview}]
126
+ ```
127
+
128
+ ## How It Works
129
+
130
+ ```
131
+ Claude: "scan example.com"
132
+
133
+ ├── calls scan_domain("example.com", mode="standard")
134
+ │ │
135
+ │ ├── Phase 1: discover_js_files
136
+ │ │ └── 23+ passive sources (Wayback, OTX, URLScan, GAU, ...)
137
+ │ │
138
+ │ ├── Phase 2: Parse JS files
139
+ │ │ ├── Tree-Sitter AST parsing (primary)
140
+ │ │ ├── Acorn fallback (if tree-sitter unavailable)
141
+ │ │ ├── Regex extraction (supplementary)
142
+ │ │ ├── Sourcemap reconstruction
143
+ │ │ └── Webpack chunk following
144
+ │ │
145
+ │ └── Phase 3: API documentation probing
146
+ │ └── Swagger, GraphQL, WADL, WSDL, well-known
147
+
148
+ └── Claude analyzes results
149
+ ├── Categorizes endpoints by security relevance
150
+ ├── Identifies IDOR candidates, auth gaps, admin endpoints
151
+ ├── Suggests attack strategies per parameter type
152
+ └── Produces prioritized attack surface report
153
+ ```
154
+
155
+ The MCP server imports the [Anastasis engine](https://github.com/0xazanul/Anastasis) directly — no CLI wrapping, no stdout parsing. Claude gets structured JSON from native tool calls.
156
+
157
+ ## Requirements
158
+
159
+ - **Node.js 18-23** ([nodejs.org](https://nodejs.org))
160
+ - **Internet access** for passive source queries
161
+
162
+ Tree-sitter (C++ native AST parser) compiles automatically during install on most systems. If compilation fails, Anastasis falls back to acorn/acorn-loose with identical functionality.
163
+
164
+ ## Example Output
165
+
166
+ ```json
167
+ {
168
+ "summary": {
169
+ "totalEndpoints": 1569,
170
+ "totalJsFiles": 6309,
171
+ "totalApiDocEndpoints": 1067,
172
+ "endpointsWithParams": 227,
173
+ "duration": "195.1s",
174
+ "byMethod": { "GET": 1272, "POST": 53, "PATCH": 20, "DELETE": 24 },
175
+ "bySource": { "ast": 293, "regex": 208, "graphql": 3 }
176
+ }
177
+ }
178
+ ```
179
+
180
+ ## For Bug Bounty Hunters
181
+
182
+ After `scan_domain` returns, ask Claude:
183
+
184
+ - "Which endpoints are most likely to have IDOR?"
185
+ - "Show me admin endpoints without authentication"
186
+ - "Which parameters are SSRF candidates?"
187
+ - "Analyze the auth patterns for inconsistencies"
188
+ - "What standalone findings can I report right now?"
189
+
190
+ Claude combines Anastasis's raw data with security analysis to produce actionable results.
191
+
192
+ ## Development
193
+
194
+ ```bash
195
+ git clone https://github.com/0xazanul/anastasis-mcp-server.git
196
+ cd anastasis-mcp-server
197
+ npm install
198
+ npm run build
199
+ node dist/index.js # starts MCP server on stdio
200
+ ```
201
+
202
+ ## License
203
+
204
+ MIT
205
+
206
+ ## Credits
207
+
208
+ - [Anastasis Engine](https://github.com/0xazanul/Anastasis) by [@0xazanul](https://github.com/0xazanul)
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,411 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { z } from "zod";
5
+ // Import Anastasis core modules
6
+ import { discoverJsFiles } from "anastasis/dist/core/discovery-orchestrator.js";
7
+ import { discoverEndpoints } from "anastasis/dist/core/endpoint-discovery.js";
8
+ import { parseEndpoints, parseEndpointsFromUrl, parseEndpointsFromUrls, isTreeSitterAvailable, } from "anastasis/dist/parsers/index.js";
9
+ import { discoverAndReconstruct, } from "anastasis/dist/parsers/sourcemap-reconstructor.js";
10
+ const server = new McpServer({
11
+ name: "anastasis",
12
+ version: "1.0.0",
13
+ });
14
+ // ─── Tool 1: scan_domain ───────────────────────────────────────────────────────
15
+ // Full domain scan — the main use case. Combines JS discovery + parsing + API docs.
16
+ server.tool("scan_domain", {
17
+ domain: z.string().describe("Target domain to scan (e.g., example.com)"),
18
+ mode: z.enum(["quick", "standard", "deep"]).default("standard").describe("Scan depth: quick (API docs only), standard (JS + API), deep (full params + schemas)"),
19
+ concurrency: z.number().int().min(1).max(50).default(10).describe("Number of parallel requests"),
20
+ include_subdomains: z.boolean().default(false).describe("Include subdomains in JS discovery"),
21
+ }, async ({ domain, mode, concurrency, include_subdomains }) => {
22
+ const startTime = Date.now();
23
+ const results = {
24
+ domain,
25
+ mode,
26
+ treeSitterAvailable: isTreeSitterAvailable(),
27
+ jsFiles: { count: 0, urls: [] },
28
+ endpoints: [],
29
+ apiDocs: [],
30
+ paramSpecs: [],
31
+ sources: {},
32
+ stats: {},
33
+ };
34
+ try {
35
+ // Phase 1: Discover JS files (skip for quick mode)
36
+ if (mode !== "quick") {
37
+ const discovery = await discoverJsFiles({
38
+ domain,
39
+ concurrency,
40
+ includeSubdomains: include_subdomains,
41
+ });
42
+ results.jsFiles.count = discovery.totalUrls;
43
+ results.jsFiles.urls = discovery.urls.map((u) => u.url);
44
+ // Track sources
45
+ for (const src of discovery.sources) {
46
+ if (src.urls?.length > 0) {
47
+ results.sources[src.source] = src.urls.length;
48
+ }
49
+ }
50
+ // Phase 2: Parse JS files for endpoints
51
+ if (discovery.totalUrls > 0) {
52
+ const parseOpts = {
53
+ extractParams: mode === "deep" || mode === "standard",
54
+ buildSchemas: mode === "deep",
55
+ reconstructSourceMaps: true,
56
+ };
57
+ const parseResult = await parseEndpointsFromUrls(results.jsFiles.urls, parseOpts, undefined, concurrency);
58
+ results.endpoints.push(...parseResult.endpoints.map((ep) => ({
59
+ path: ep.path,
60
+ method: ep.method || "GET",
61
+ source: ep.source || "ast",
62
+ confidence: ep.confidence,
63
+ queryParams: ep.queryParams,
64
+ context: ep.context,
65
+ })));
66
+ // Collect param specs
67
+ if (parseResult.paramExtractionResult?.specs) {
68
+ results.paramSpecs = parseResult.paramExtractionResult.specs.map((spec) => ({
69
+ path: spec.path,
70
+ method: spec.method,
71
+ pathParams: spec.pathParams,
72
+ queryParams: spec.queryParams,
73
+ bodyParams: spec.bodyParams,
74
+ cookieParams: spec.cookieParams,
75
+ headers: spec.headers,
76
+ auth: spec.auth,
77
+ contentType: spec.contentType,
78
+ confidence: spec.confidence,
79
+ }));
80
+ }
81
+ results.stats = {
82
+ regexFound: parseResult.stats?.regexFound || 0,
83
+ astFound: parseResult.stats?.astFound || 0,
84
+ sourceMapFound: parseResult.stats?.sourceMapFound || 0,
85
+ totalParsed: parseResult.endpoints.length,
86
+ };
87
+ }
88
+ }
89
+ // Phase 3: Discover API documentation endpoints
90
+ const baseUrl = domain.startsWith("http") ? domain : `https://${domain}`;
91
+ const apiResult = await discoverEndpoints({
92
+ baseUrl,
93
+ concurrency: Math.min(concurrency, 20),
94
+ timeout: mode === "quick" ? 30000 : 60000,
95
+ });
96
+ results.apiDocs = apiResult.endpoints.map((ep) => ({
97
+ path: ep.path,
98
+ method: ep.method || "GET",
99
+ source: ep.source,
100
+ confidence: ep.confidence,
101
+ }));
102
+ // Merge API doc endpoints with JS-discovered endpoints (dedup by method:path)
103
+ const seen = new Set(results.endpoints.map((e) => `${e.method}:${e.path}`));
104
+ for (const ep of results.apiDocs) {
105
+ const key = `${ep.method}:${ep.path}`;
106
+ if (!seen.has(key)) {
107
+ results.endpoints.push(ep);
108
+ seen.add(key);
109
+ }
110
+ }
111
+ // Summary
112
+ results.summary = {
113
+ totalEndpoints: results.endpoints.length,
114
+ totalJsFiles: results.jsFiles.count,
115
+ totalApiDocEndpoints: results.apiDocs.length,
116
+ endpointsWithParams: results.paramSpecs.length,
117
+ duration: `${((Date.now() - startTime) / 1000).toFixed(1)}s`,
118
+ byMethod: results.endpoints.reduce((acc, ep) => {
119
+ acc[ep.method] = (acc[ep.method] || 0) + 1;
120
+ return acc;
121
+ }, {}),
122
+ bySource: results.endpoints.reduce((acc, ep) => {
123
+ acc[ep.source || "unknown"] = (acc[ep.source || "unknown"] || 0) + 1;
124
+ return acc;
125
+ }, {}),
126
+ };
127
+ return {
128
+ content: [{ type: "text", text: JSON.stringify(results, null, 2) }],
129
+ };
130
+ }
131
+ catch (error) {
132
+ return {
133
+ content: [{ type: "text", text: JSON.stringify({
134
+ error: error.message,
135
+ domain,
136
+ mode,
137
+ partial: results,
138
+ }, null, 2) }],
139
+ isError: true,
140
+ };
141
+ }
142
+ });
143
+ // ─── Tool 2: discover_js_files ─────────────────────────────────────────────────
144
+ // Just the discovery phase — find all JS files for a domain from 23+ passive sources.
145
+ server.tool("discover_js_files", {
146
+ domain: z.string().describe("Target domain (e.g., example.com)"),
147
+ concurrency: z.number().int().min(1).max(50).default(10).describe("Parallel request limit"),
148
+ include_subdomains: z.boolean().default(false).describe("Include subdomains"),
149
+ }, async ({ domain, concurrency, include_subdomains }) => {
150
+ try {
151
+ const result = await discoverJsFiles({
152
+ domain,
153
+ concurrency,
154
+ includeSubdomains: include_subdomains,
155
+ });
156
+ const output = {
157
+ domain,
158
+ totalFiles: result.totalUrls,
159
+ files: result.urls.map((u) => ({
160
+ url: u.url,
161
+ source: u.source,
162
+ })),
163
+ sourceSummary: result.sources
164
+ .filter((s) => s.urls?.length > 0)
165
+ .map((s) => ({
166
+ source: s.source,
167
+ found: s.urls.length,
168
+ duration: s.duration ? `${(s.duration / 1000).toFixed(1)}s` : undefined,
169
+ })),
170
+ inlineScripts: result.inlineScripts?.length || 0,
171
+ duration: `${(result.duration / 1000).toFixed(1)}s`,
172
+ };
173
+ return {
174
+ content: [{ type: "text", text: JSON.stringify(output, null, 2) }],
175
+ };
176
+ }
177
+ catch (error) {
178
+ return {
179
+ content: [{ type: "text", text: JSON.stringify({ error: error.message, domain }) }],
180
+ isError: true,
181
+ };
182
+ }
183
+ });
184
+ // ─── Tool 3: parse_js_file ─────────────────────────────────────────────────────
185
+ // Parse a single JS file URL or raw content for endpoints.
186
+ server.tool("parse_js_file", {
187
+ url: z.string().optional().describe("URL of the JavaScript file to parse"),
188
+ content: z.string().optional().describe("Raw JavaScript content to parse (instead of URL)"),
189
+ extract_params: z.boolean().default(true).describe("Extract parameter types and constraints"),
190
+ build_schemas: z.boolean().default(false).describe("Build nested body schemas"),
191
+ }, async ({ url, content, extract_params, build_schemas }) => {
192
+ if (!url && !content) {
193
+ return {
194
+ content: [{ type: "text", text: JSON.stringify({ error: "Provide either url or content" }) }],
195
+ isError: true,
196
+ };
197
+ }
198
+ try {
199
+ let result;
200
+ if (url) {
201
+ result = await parseEndpointsFromUrl(url, {
202
+ extractParams: extract_params,
203
+ buildSchemas: build_schemas,
204
+ reconstructSourceMaps: true,
205
+ });
206
+ }
207
+ else {
208
+ result = parseEndpoints(content, {
209
+ extractParams: extract_params,
210
+ buildSchemas: build_schemas,
211
+ });
212
+ }
213
+ const output = {
214
+ endpoints: result.endpoints.map((ep) => ({
215
+ path: ep.path,
216
+ method: ep.method || "GET",
217
+ source: ep.source || "ast",
218
+ confidence: ep.confidence,
219
+ queryParams: ep.queryParams,
220
+ context: ep.context,
221
+ })),
222
+ stats: {
223
+ total: result.endpoints.length,
224
+ regexFound: result.stats?.regexFound || 0,
225
+ astFound: result.stats?.astFound || 0,
226
+ sourceMapFound: result.stats?.sourceMapFound || 0,
227
+ treeSitterAvailable: isTreeSitterAvailable(),
228
+ },
229
+ };
230
+ if (result.paramExtractionResult?.specs) {
231
+ output.paramSpecs = result.paramExtractionResult.specs.map((spec) => ({
232
+ path: spec.path,
233
+ method: spec.method,
234
+ pathParams: spec.pathParams,
235
+ queryParams: spec.queryParams,
236
+ bodyParams: spec.bodyParams,
237
+ headers: spec.headers,
238
+ auth: spec.auth,
239
+ confidence: spec.confidence,
240
+ }));
241
+ }
242
+ if (result.discoveredChunks?.length) {
243
+ output.discoveredChunks = result.discoveredChunks;
244
+ }
245
+ return {
246
+ content: [{ type: "text", text: JSON.stringify(output, null, 2) }],
247
+ };
248
+ }
249
+ catch (error) {
250
+ return {
251
+ content: [{ type: "text", text: JSON.stringify({ error: error.message, url }) }],
252
+ isError: true,
253
+ };
254
+ }
255
+ });
256
+ // ─── Tool 4: check_api_docs ────────────────────────────────────────────────────
257
+ // Probe a domain for API documentation (Swagger, GraphQL, WADL, WSDL, etc.)
258
+ server.tool("check_api_docs", {
259
+ domain: z.string().describe("Target domain (e.g., example.com)"),
260
+ sources: z.array(z.string()).optional().describe("Specific sources to check: swagger, graphql, wadl, wsdl, well-known, api-probe, sitemap"),
261
+ timeout: z.number().int().default(60000).describe("Timeout in ms per source"),
262
+ }, async ({ domain, sources, timeout }) => {
263
+ try {
264
+ const baseUrl = domain.startsWith("http") ? domain : `https://${domain}`;
265
+ const result = await discoverEndpoints({
266
+ baseUrl,
267
+ sources: sources,
268
+ timeout,
269
+ concurrency: 20,
270
+ });
271
+ const output = {
272
+ domain,
273
+ totalEndpoints: result.endpoints.length,
274
+ endpoints: result.endpoints.map((ep) => ({
275
+ path: ep.path,
276
+ method: ep.method || "GET",
277
+ source: ep.source,
278
+ confidence: ep.confidence,
279
+ params: ep.params,
280
+ })),
281
+ jsFilesFromManifests: result.jsFiles?.map((f) => f.url) || [],
282
+ sourceResults: result.sources?.map((s) => ({
283
+ source: s.source,
284
+ count: s.count,
285
+ duration: s.duration ? `${(s.duration / 1000).toFixed(1)}s` : undefined,
286
+ error: s.error,
287
+ })) || [],
288
+ duration: `${(result.totalDuration / 1000).toFixed(1)}s`,
289
+ };
290
+ return {
291
+ content: [{ type: "text", text: JSON.stringify(output, null, 2) }],
292
+ };
293
+ }
294
+ catch (error) {
295
+ return {
296
+ content: [{ type: "text", text: JSON.stringify({ error: error.message, domain }) }],
297
+ isError: true,
298
+ };
299
+ }
300
+ });
301
+ // ─── Tool 5: extract_sourcemap ─────────────────────────────────────────────────
302
+ // Recover original source files from a JS file's sourcemap.
303
+ server.tool("extract_sourcemap", {
304
+ url: z.string().describe("URL of the JavaScript file to check for sourcemaps"),
305
+ }, async ({ url }) => {
306
+ try {
307
+ // Fetch the JS content first
308
+ const response = await fetch(url, {
309
+ headers: {
310
+ "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
311
+ Accept: "*/*",
312
+ },
313
+ signal: AbortSignal.timeout(15000),
314
+ });
315
+ if (!response.ok) {
316
+ throw new Error(`HTTP ${response.status} fetching ${url}`);
317
+ }
318
+ const content = await response.text();
319
+ const result = await discoverAndReconstruct(url, content);
320
+ if (!result) {
321
+ return {
322
+ content: [{ type: "text", text: JSON.stringify({
323
+ url,
324
+ sourcemapFound: false,
325
+ message: "No sourcemap found for this file",
326
+ }) }],
327
+ };
328
+ }
329
+ const output = {
330
+ url,
331
+ sourcemapFound: true,
332
+ sourcemapUrl: result.sourcemapUrl,
333
+ sourceFiles: result.sources?.map((s) => ({
334
+ path: s.path,
335
+ language: s.language,
336
+ size: s.content?.length || 0,
337
+ preview: s.content?.slice(0, 500),
338
+ })) || [],
339
+ totalFiles: result.sources?.length || 0,
340
+ };
341
+ return {
342
+ content: [{ type: "text", text: JSON.stringify(output, null, 2) }],
343
+ };
344
+ }
345
+ catch (error) {
346
+ return {
347
+ content: [{ type: "text", text: JSON.stringify({ error: error.message, url }) }],
348
+ isError: true,
349
+ };
350
+ }
351
+ });
352
+ // ─── Tool 6: parse_multiple_js ─────────────────────────────────────────────────
353
+ // Parse multiple JS file URLs in parallel.
354
+ server.tool("parse_multiple_js", {
355
+ urls: z.array(z.string()).describe("Array of JS file URLs to parse"),
356
+ extract_params: z.boolean().default(true).describe("Extract parameter types"),
357
+ concurrency: z.number().int().min(1).max(50).default(10).describe("Parallel request limit"),
358
+ }, async ({ urls, extract_params, concurrency }) => {
359
+ try {
360
+ const result = await parseEndpointsFromUrls(urls, {
361
+ extractParams: extract_params,
362
+ reconstructSourceMaps: true,
363
+ }, undefined, concurrency);
364
+ const output = {
365
+ filesProcessed: urls.length,
366
+ totalEndpoints: result.endpoints.length,
367
+ endpoints: result.endpoints.map((ep) => ({
368
+ path: ep.path,
369
+ method: ep.method || "GET",
370
+ source: ep.source || "ast",
371
+ confidence: ep.confidence,
372
+ })),
373
+ stats: {
374
+ regexFound: result.stats?.regexFound || 0,
375
+ astFound: result.stats?.astFound || 0,
376
+ sourceMapFound: result.stats?.sourceMapFound || 0,
377
+ byMethod: result.stats?.byMethod || {},
378
+ },
379
+ };
380
+ if (result.paramExtractionResult?.specs) {
381
+ output.paramSpecs = result.paramExtractionResult.specs.map((spec) => ({
382
+ path: spec.path,
383
+ method: spec.method,
384
+ pathParams: spec.pathParams,
385
+ queryParams: spec.queryParams,
386
+ bodyParams: spec.bodyParams,
387
+ headers: spec.headers,
388
+ auth: spec.auth,
389
+ }));
390
+ }
391
+ return {
392
+ content: [{ type: "text", text: JSON.stringify(output, null, 2) }],
393
+ };
394
+ }
395
+ catch (error) {
396
+ return {
397
+ content: [{ type: "text", text: JSON.stringify({ error: error.message }) }],
398
+ isError: true,
399
+ };
400
+ }
401
+ });
402
+ // ─── Start server ──────────────────────────────────────────────────────────────
403
+ async function main() {
404
+ const transport = new StdioServerTransport();
405
+ await server.connect(transport);
406
+ }
407
+ main().catch((error) => {
408
+ console.error("Fatal:", error);
409
+ process.exit(1);
410
+ });
411
+ //# sourceMappingURL=index.js.map
@@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,EAAE,EAAE,CAAC,CAAC;gBACzE,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,IAAI,EAAE,IAAI,CAAC,IAAI;aAChB,CAAC,CAAC,CAAC;QACN,CAAC;QAED,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;SACnE,CAAC;IACJ,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;YAC3E,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC,CACF,CAAC;AAEF,kFAAkF;AAElF,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC/B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "anastasis-mcp-server",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "description": "MCP server for JavaScript endpoint discovery and attack surface mapping. Discovers JS files from 23+ passive sources, extracts API endpoints via AST parsing, reconstructs sourcemaps, probes API documentation. Powered by the Anastasis engine.",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "anastasis-mcp-server": "./dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "start": "node dist/index.js",
18
+ "dev": "tsx src/index.ts",
19
+ "prepublishOnly": "npm run build"
20
+ },
21
+ "keywords": [
22
+ "mcp",
23
+ "modelcontextprotocol",
24
+ "security",
25
+ "bug-bounty",
26
+ "endpoint-discovery",
27
+ "javascript",
28
+ "recon",
29
+ "anastasis",
30
+ "attack-surface",
31
+ "api-discovery",
32
+ "sourcemap",
33
+ "pentesting"
34
+ ],
35
+ "author": "0xazanul",
36
+ "license": "MIT",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/0xazanul/anastasis-mcp-server.git"
40
+ },
41
+ "bugs": {
42
+ "url": "https://github.com/0xazanul/anastasis-mcp-server/issues"
43
+ },
44
+ "homepage": "https://github.com/0xazanul/anastasis-mcp-server#readme",
45
+ "engines": {
46
+ "node": ">=18 <24"
47
+ },
48
+ "dependencies": {
49
+ "@modelcontextprotocol/sdk": "^1.29.0",
50
+ "anastasis": "^1.2.0",
51
+ "zod": "^3.24.0"
52
+ },
53
+ "devDependencies": {
54
+ "@types/node": "^22.0.0",
55
+ "typescript": "^5.7.0"
56
+ }
57
+ }