astexplore-mcp
v0.1.0MCP server that parses JS/TS source into an AST using a selectable parser (babel, acorn, typescript, espree, @typescript-eslint/parser) — astexplorer.net as…
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_parsers List AST parsers
List the available parsers and the options each one accepts. Call this first if unsure which parser to use.
parse_ast Parse source into an AST
Parse JavaScript/TypeScript/JSX source into an Abstract Syntax Tree using a selectable parser. Returns the AST as JSON. Like astexplorer.net, exposed as a tool.
| Parameter | Type | Description |
|---|---|---|
code * | string | The source code to parse. |
hideEmpty | boolean | Drop keys whose value is null / "" / [] / {} (astexplorer's 'Hide empty keys'). Default true. |
hideType | boolean | Drop the node-kind key (type / kind) (astexplorer's 'Hide type keys'). Default false — usually essential to read JSON output. |
locations | boolean | Include positional metadata (loc/start/end/range/pos). Default false — omitting it shrinks output ~75%. Turn on only when you need line/column info. |
maxChars | integer | Refuse to return output larger than this many characters (default 100000). Prevents huge files from flooding the context; raise it or use maxDepth for big inputs. |
maxDepth | integer | Truncate the tree below this depth (root = 0). Useful to peek at top-level structure without dumping the whole subtree. |
options | object | Parser-specific options merged over defaults. See list_parsers for per-parser hints. |
parser | string | Which parser to use. One of: babel, acorn, espree, typescript, typescript-eslint. |
pretty | boolean | Pretty-print with indentation. Default false (compact single-line JSON) to save tokens. Turn on for human reading. |