AST for TypeScript, supports creating JSON representations of React components
A Model Context Protocol (MCP) server that provides TypeScript AST (Abstract Syntax Tree) analysis capabilities. This server allows you to find references for classes and methods, analyze component trees, and find dependencies in TypeScript code using the ts-morph library.
find_dependency tool to list all files that import a specified library.component_tree tool to analyze React component structures in your codebase.Clone the repository
Install dependencies:
yarn install
Copy the example configuration files:
cp .env.example .env
Update .env with your project's tsconfig path:
PROJECT_TSCONFIG_PATH=/path/to/your/project/tsconfig.json
yarn build
yarn test:mcp
This will start the MCP server that can be connected to by MCP-compatible clients.
To use this MCP server in Claude Code:
yarn build
.mcp.example.json to .mcp.json (or update your existing one with the content of the MCP configuration).claude/settings.local.json and add the MCP section (or the subset needed if you already have some MCPs configured) “enableAllProjectMcpServers”: true,
“enabledMcpjsonServers”: [
“typescript-ast”
]
/mcp command and check the MCP is connectedsrc/yarn build
yarn test:mcp
The server uses the following environment variable:
PROJECT_TSCONFIG_PATH: Path to the tsconfig.json file to use for project analysis (defaults to 'tsconfig.json').env.example: Example environment variables file.mcp.example.json: Example MCP configuration file (if applicable)The server provides three tools:
find_referenceFind all references to a given class method in your codebase.
filePath: Path to the fileclassName: Name of the classmethodName: Name of the methodfind_dependencyList all files that import a specified library.
dependencyName: Name of the dependency to search forcomponent_treeAnalyze React component structures in your codebase.
entryFilePath: Path to the entry filemaxDepth: Maximum depth of the component tree (default: 3)data-id (optional): Attribute name to capture into TreeNode.dataId (example: data-attribute-id)props, dataId, and onClickMIT
Source-derived launch command. Check the maintainer’s required arguments and credentials before running:
npx -y jsc-typescript-ast-mcpMerge this template into ~/Library/Application Support/Claude/claude_desktop_config.json. Keep existing servers. Add any arguments, credentials, and permissions required by the maintainer; this template has not been install-tested.
{
"mcpServers": {
"io-github-jscoobyced-jsc-typescript-ast-mcp": {
"command": "npx",
"args": [
"-y",
"jsc-typescript-ast-mcp"
]
}
}
}Restart Claude Desktop completely for changes to take effect. Confirm the server appears connected in the client’s tool list, then try a read-only example from its documentation.
Claude Desktop setup referencejsc-typescript-ast-mcpnpmio.github.jscoobyced/jsc-typescript-ast-mcp works with any MCP-compatible client. Copy the config snippet from the Configuration section above and add it to the file shown for your client, then restart the application.
~/Library/Application Support/Claude/claude_desktop_config.jsonRestart Claude Desktop completely for changes to take effect.~/.cursor/mcp.jsonRestart Cursor for changes to take effect..vscode/mcp.jsonReload VS Code window for changes to take effect.~/.codeium/windsurf/mcp_config.jsonRestart Windsurf for changes to take effect..mcp.jsonSave at the project root, then start Claude Code in that project and review the MCP server approval prompt. Keep real credentials out of shared files.