jsc-typescript-ast-mcp 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +85 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # TypeScript AST MCP Server
2
+
3
+ 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.
4
+
5
+ ## Features
6
+
7
+ - **MCP Server**: Implements the Model Context Protocol for integration with AI assistants
8
+ - **TypeScript Analysis**: Uses ts-morph for powerful TypeScript AST parsing and analysis
9
+ - **Reference Finding**: Find all references to a given class method in your codebase
10
+ - **Dependency Finding**: Use the `find_dependency` tool to list all files that import a specified library.
11
+ - **Component Tree Analysis**: Use the `component_tree` tool to analyze React component structures in your codebase.
12
+ - The tools are part of the MCP server and can be invoked via Claude Code or other MCP clients.
13
+
14
+ ## Prerequisites
15
+
16
+ - Node.js (version compatible with the project)
17
+ - Yarn package manager
18
+
19
+ ## Setup
20
+
21
+ 1. Create `.env` with your project's tsconfig path:
22
+ ```bash
23
+ PROJECT_TSCONFIG_PATH=/path/to/your/project/tsconfig.json
24
+ ```
25
+
26
+ ## How to Run
27
+
28
+ Add this package as dependency and run
29
+
30
+ ```
31
+ node node_modules/jsc-typescript-ast-mcp/index.js
32
+ ```
33
+
34
+ This will start the MCP server that can be connected to by MCP-compatible clients.
35
+
36
+ ## Installing in Claude Code
37
+
38
+ To use this MCP server in Claude Code:
39
+
40
+ 1. **Configure Claude Code**:
41
+
42
+ - Copy the `.mcp.example.json` to `.mcp.json` (or update your existing one with the content of the MCP configuration)
43
+ - Edit your `.claude/settings.local.json` and add the MCP section (or the subset needed if you already have some MCPs configured)
44
+
45
+ ```
46
+ “enableAllProjectMcpServers”: true,
47
+ “enabledMcpjsonServers”: [
48
+ “typescript-ast”
49
+ ]
50
+ ```
51
+
52
+ - Start Claude Code
53
+ - Type the `/mcp` command and check the MCP is connected
54
+
55
+ ## Tool Descriptions
56
+
57
+ The server provides three tools:
58
+
59
+ ### 1. `find_reference`
60
+ Find all references to a given class method in your codebase.
61
+
62
+ - **Input**:
63
+ - `filePath`: Path to the file
64
+ - `className`: Name of the class
65
+ - `methodName`: Name of the method
66
+ - **Output**: List of file paths with line numbers where the method is referenced
67
+
68
+ ### 2. `find_dependency`
69
+ List all files that import a specified library.
70
+
71
+ - **Input**:
72
+ - `dependencyName`: Name of the dependency to search for
73
+ - **Output**: List of file paths that import the specified dependency
74
+
75
+ ### 3. `component_tree`
76
+ Analyze React component structures in your codebase.
77
+
78
+ - **Input**:
79
+ - `entryFilePath`: Path to the entry file
80
+ - `maxDepth`: Maximum depth of the component tree (default: 3)
81
+ - **Output**: JSON representation of the component tree structure
82
+
83
+ ## License
84
+
85
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsc-typescript-ast-mcp",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A Model Context Protocol (MCP) server that provides an abstract syntax tree (AST) representation of TypeScript code using the ts-morph library.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {