Jsc Typescript Ast Mcp

io.github.jscoobyced由 GitHub 账号 jscoobyced 发布v1.0.10更新于 Nov 3, 2026

AST for TypeScript, supports creating JSON representations of React components

已验证STDIO仅桌面开发者工具数据与分析

概览

AI 生成的概览

本地 MCP 服务器,用 ts-morph 解析 TypeScript 项目,让助手查找方法引用、库依赖和 React 组件树。

可以做什么
  • 查找某个类方法的全部引用,返回文件路径与行号
  • 列出导入了指定库依赖的文件
  • 从入口文件分析 React 组件结构,输出含 props、data-id 与 onClick 元数据的 JSON 树
适用场景
适合在 TypeScript 或 React 代码库中工作时使用:让助手追踪方法被哪些地方调用、查看哪些文件依赖某个库,或梳理组件层级,而不必手动搜索。
运行要求
以 npm 包形式通过 stdio 在本机运行,需要 Node.js 和 Yarn。必须设置环境变量 PROJECT_TSCONFIG_PATH 指向项目的 tsconfig.json(Vite 项目可能需要 tsconfig.app.json)。未声明任何认证。
安装前请注意
服务器会读取你所配置项目路径下的源码文件,请只指向可以交给助手查看的代码。它只做只读分析,未描述写入、发送或删除数据的工具。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Jsc Typescript Ast Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

TypeScript AST MCP Server

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. Great to represent JSON structure of your React components.

Features

  • MCP Server: Implements the Model Context Protocol for integration with AI assistants
  • TypeScript Analysis: Uses ts-morph for powerful TypeScript AST parsing and analysis
  • Reference Finding: Find all references to a given class method in your codebase
  • Dependency Finding: Use the find_dependency tool to list all files that import a specified library.
  • Component Tree Analysis: Use the component_tree tool to analyze React component structures in your codebase.
  • The tools are part of the MCP server and can be invoked via Claude Code or other MCP clients.

Prerequisites

  • Node.js (version compatible with the project)
  • Yarn package manager

Setup

  1. Create .env with your project's tsconfig path:
    bash
    PROJECT_TSCONFIG_PATH=/path/to/your/project/tsconfig.json

How to Run

Add this package as dependency and run

yarn typescript-ast

This will start the MCP server that can be connected to by MCP-compatible clients.

Installing in Claude Code

To use this MCP server in Claude Code:

  1. Configure Claude Code:
  • Copy a .mcp.json (or update your existing one with the content of the MCP configuration):
{  "mcpServers": {    "typescript-ast": {      "type": "stdio",      "command": "yarn",      "args": [        "typescript-ast"      ],      "env": {        "PROJECT_TSCONFIG_PATH": "PATH/TO/YOUR/TYPESCRIPT/PROJECT/tsconfig.json"      }    }  }}

For the project path, if you're using Vite you might want to use the tsconfig.app.json instead.

  • Edit your .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”  ]
  • Start Claude Code
  • Type the /mcp command and check the MCP is connected

Tool Descriptions

The server provides three tools:

1. find_reference

Find all references to a given class method in your codebase.

  • Input:
    • filePath: Path to the file
    • className: Name of the class
    • methodName: Name of the method
  • Output: List of file paths with line numbers where the method is referenced

2. find_dependency

List all files that import a specified library.

  • Input:
    • dependencyName: Name of the dependency to search for
  • Output: List of file paths that import the specified dependency

3. component_tree

Analyze React component structures in your codebase.

  • Input:
    • entryFilePath: Path to the entry file
    • maxDepth: Maximum depth of the component tree (default: 3)
    • data-id (optional): Attribute name to capture into TreeNode.dataId (example: data-attribute-id)
  • Output: JSON representation of the component tree structure, including optional element metadata such as props, dataId, and onClick

License

MIT

来源:code/README.md,提交 ad97145

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.10最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分