TypeScript AST MCP Server
TypeScript AST MCP Server
一个提供 TypeScript AST(抽象语法树)分析能力的 Model Context Protocol (MCP) 服务器。该服务器允许你使用 ts-morph 库在 TypeScript 代码中查找类和方法的引用、分析组件树以及查找依赖。
功能
MCP 服务器:实现 Model Context Protocol,用于与 AI 助手集成
TypeScript 分析:使用 ts-morph 进行强大的 TypeScript AST 解析和分析
引用查找:在代码库中查找给定类方法的所有引用
依赖查找:使用
find_dependency工具列出所有导入指定库的文件。组件树分析:使用
component_tree工具分析代码库中的 React 组件结构。这些工具是 MCP 服务器的一部分,可以通过 Claude Code 或其他 MCP 客户端调用。
Related MCP server: agent-workspace-mcp
前提条件
Node.js(与项目兼容的版本)
Yarn 包管理器
设置
克隆仓库
安装依赖:
yarn install复制示例配置文件:
cp .env.example .env更新
.env中的项目 tsconfig 路径:PROJECT_TSCONFIG_PATH=/path/to/your/project/tsconfig.json
如何运行
构建项目:
yarn build测试 MCP 服务器:
yarn test:mcp这将启动 MCP 服务器,可由兼容 MCP 的客户端连接。
在 Claude Code 中安装
要在 Claude Code 中使用此 MCP 服务器:
构建服务器:
yarn build配置 Claude Code:
将
.mcp.example.json复制为.mcp.json(或使用 MCP 配置的内容更新现有的.mcp.json)编辑你的
.claude/settings.local.json并添加 MCP 部分(如果你已经配置了一些 MCP,则只需添加所需的部分)
“enableAllProjectMcpServers”: true,
“enabledMcpjsonServers”: [
“typescript-ast”
]启动 Claude Code
输入
/mcp命令并检查 MCP 是否已连接
开发
更新代码:
修改
src/中的 TypeScript 源文件构建项目:
yarn build测试更改:
yarn test:mcp
环境变量
服务器使用以下环境变量:
PROJECT_TSCONFIG_PATH:用于项目分析的 tsconfig.json 文件路径(默认为 'tsconfig.json')
示例配置文件
.env.example:示例环境变量文件.mcp.example.json:示例 MCP 配置文件(如果适用)
工具描述
服务器提供三个工具:
1. find_reference
在代码库中查找给定类方法的所有引用。
输入:
filePath:文件路径className:类名methodName:方法名
输出:引用该方法的所有文件路径及行号列表
2. find_dependency
列出所有导入指定库的文件。
输入:
dependencyName:要搜索的依赖名称
输出:导入指定依赖的所有文件路径列表
3. component_tree
分析代码库中的 React 组件结构。
输入:
entryFilePath:入口文件路径maxDepth:组件树的最大深度(默认:3)data-id(可选):要捕获到TreeNode.dataId中的属性名称(示例:data-attribute-id)
输出:组件树结构的 JSON 表示,包括可选的元素元数据,如
props、dataId和onClick
许可证
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityDmaintenanceTypeScript-based MCP server designed to enhance code editing experiences by providing features such as hover information, code completion, and diagnostics.31426MIT
- AlicenseAqualityDmaintenanceA TypeScript-aware MCP server that provides coding agents with repository discovery, code intelligence, and web project context for local codebases. It enables deep symbol navigation, diagnostic reporting, and structural analysis of monorepos without requiring full IDE integration.7181MIT
- AlicenseNot gradedqualityDmaintenanceAST-aware TypeScript/JavaScript codebase exploration for AI agents, providing high-precision symbol resolution, reference finding, and structural analysis via MCP tools.223MIT
- FlicenseBqualityDmaintenanceMCP server for TypeScript type resolution and dependency graph analysis using ts-morph and madge.81
Related MCP Connectors
A TypeScript MCP server for Home Assistant, enabling programmatic management of entities, automati…
Scan any public GitHub MCP-server repo for security issues. 37 MCP-specific L1 rules, 8 languages.
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/jscoobyced/jsc-typescript-ast-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server