astexplore-mcp

v0.1.0
astexplore-mcp Checked 3 days ago Published 4 months ago

MCP 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.

ParameterTypeDescription
code *stringThe source code to parse.
hideEmptybooleanDrop keys whose value is null / "" / [] / {} (astexplorer's 'Hide empty keys'). Default true.
hideTypebooleanDrop the node-kind key (type / kind) (astexplorer's 'Hide type keys'). Default false — usually essential to read JSON output.
locationsbooleanInclude positional metadata (loc/start/end/range/pos). Default false — omitting it shrinks output ~75%. Turn on only when you need line/column info.
maxCharsintegerRefuse 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.
maxDepthintegerTruncate the tree below this depth (root = 0). Useful to peek at top-level structure without dumping the whole subtree.
optionsobjectParser-specific options merged over defaults. See list_parsers for per-parser hints.
parserstringWhich parser to use. One of: babel, acorn, espree, typescript, typescript-eslint.
prettybooleanPretty-print with indentation. Default false (compact single-line JSON) to save tokens. Turn on for human reading.