Command Palette

Search for a command to run...

Home / Servers

ts-ast-mcp

by gclluch

TypeScript AST MCP Server

A Model Context Protocol (MCP) server for deep structural analysis of TypeScript and JavaScript source code. Unlike text-based search, this server parses your code with the TypeScript Compiler API and walks the real AST - types, functions, call relationships, interface satisfaction, and more.

Most tools run on the syntactic tier (ts.createSourceFile, no type resolution) because it is fast and needs no build. find_implementations runs on the semantic tier - a full ts.Program and its type checker - because deciding whether a class satisfies an interface cannot be done from syntax alone. Each tool's tier is stated in the table below.

Companion to py-ast-mcp, the same idea applied to Python; a Go AST MCP server by another author served as prior art for this one.

Features

  • 20 analysis tools covering file-level, directory-level, and cross-file structural queries
  • Fast syntactic parsing - ts.createSourceFile() per file, under 5ms; cross-file tools re-parse in scope, so results always reflect the latest edit
  • Arrow function awareness - const foo = () => {} treated as first-class functions throughout
  • Signature extraction - parameters, class-qualified names, and return types as written. These come from the annotation, so an unannotated return reads as blank rather than as the inferred type
  • Call graph generation with Mermaid diagrams, forward and reverse traversal, file or package scope
  • Cyclomatic complexity computation per function
  • Interface implementation discovery - explicit implements plus structural matches decided by the type checker's own assignability rules, so member types and call signatures count, not just member names
  • Structural diffing between file versions (added/removed/modified symbols)
  • Cursor-position awareness for IDE integrations
  • JSX/TSX parsing - .tsx/.jsx files parse under the right ScriptKind, so every tool works on React source. There is no React-specific analysis: a component is a function like any other
  • TypeScript-specific quality checks - any casts, non-null assertions, floating promises, empty catches, double assertions
  • Dead code detection - unexported symbols never referenced within their own file. Unexported means file-local, so that is the whole search space. A same-named binding in another scope of the same file still reads as a use, which makes this under-report rather than over-report
  • JSDoc/TSDoc extraction for any symbol

Tools

Structural Queries

ToolDescriptionParameters
analyze_fileHigh-level summary of the file's own symbols: classes, interfaces, types, enums, namespaces, functions. Class members are left to list_methodspath
list_functionsList all functions/methods with full signatures and line ranges, including accessors (get/set), static members and class arrow propertiespath
get_function_bodyExtract a function/method body (supports Class.method syntax). Returns the implementation, not an overload signaturepath, name
list_methodsList all methods for a class or interfacepath, type
get_type_definitionExtract any type definition (interface, type alias, class, enum)path, name
list_declarationsList module-level const/let/var with typespath
list_exportsList all exported symbols with kind (function, class, type, namespace, re-export). An overloaded function is one symbolpath
list_importsList all import statements with bindings and module pathspath
find_usagesFind all occurrences of an identifier with source context, in one file or across a directorypath, identifier, scope*

Call Analysis

ToolDescriptionParameters
call_graphGenerate a Mermaid call graph diagrampath, `functio

Related servers

n8n

Updated today

by n8n-io

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

NOASSERTION199,059

mcp-server-fetch

OfficialUpdated today

by modelcontextprotocol

A Model Context Protocol server providing tools to fetch and convert web content for usage by LLMs

89,138

@modelcontextprotocol/server-filesystem

OfficialUpdated today

by modelcontextprotocol

MCP server for filesystem access

SEE LICENSE IN LICENSE89,138

@modelcontextprotocol/server-everything

OfficialUpdated today

by modelcontextprotocol

MCP server that exercises all the features of the MCP protocol

89,138