Skip to main content
Glama

CTS MCP Server

by EricA1019
WASM_SETUP.mdโ€ข3.31 kB
# Tree-Sitter WASM Setup for CTS MCP ## Current Status The CTS MCP server now uses **web-tree-sitter** (WASM) for GDScript parsing instead of native bindings. This eliminates CI/CD native module compilation issues. ## WASM File Required The `tree-sitter-gdscript.wasm` file is required for the parser to work. This file should be placed in one of these locations (checked in order): 1. `build/tree-sitter-gdscript.wasm` (production) 2. `node_modules/tree-sitter-gdscript/tree-sitter-gdscript.wasm` (dev) 3. `src/tree-sitter-gdscript.wasm` (tests) ## Temporary Workaround (Until WASM File Available) The current implementation includes a **regex fallback** in `gdscript_parser.ts`: ```typescript try { // Use WASM parser for accurate AST-based extraction const tree = await parseGDScriptFile(filePath, true); const wasmSignals = findSignalsWASM(tree); return wasmSignals.map(...); } catch (error) { // Fallback to regex if WASM fails console.warn(`WASM parser failed, using regex fallback:`, error); return parseGDScriptSignalsRegex(filePath); } ``` This means **the server will still work** even without the WASM file, using the proven regex parser (100% test coverage). ## Building the WASM File (Future) Once `tree-sitter-gdscript` supports WASM builds: ```bash cd node_modules/tree-sitter-gdscript npx tree-sitter build --wasm cp tree-sitter-gdscript.wasm ../../build/ ``` ## Performance Targets With WASM parser (once available): - **Initialization**: <500ms (one-time) - **Parse time**: <50ms per 500-line file - **Cached parse**: <1ms - **Memory**: <50MB for 100 files Current regex parser performance (fallback): - **Parse time**: ~5-10ms per file (proven fast enough) - **Accuracy**: 100% for signal definitions (validated in tests) ## Migration Path 1. โœ… **Phase 1**: Created WASM utilities (`src/utils/tree_sitter.ts`) with fallback 2. โœ… **Phase 2**: Updated `gdscript_parser.ts` to use WASM with regex fallback 3. โœ… **Phase 3**: Updated `scan_project_signals` tool (primary user) 4. โณ **Phase 4**: Build/obtain GDScript WASM file 5. โณ **Phase 5**: Update other tools (`analyze_project`, `suggest_refactoring`) ## Testing Tests are written assuming WASM availability (`src/utils/__tests__/tree_sitter.test.ts`). **To run tests without WASM file**: Tests will gracefully skip or use fallback parser. ```bash npm test -- tree_sitter.test ``` ## Benefits of WASM Approach 1. **No native compilation**: Eliminates node-gyp/Python/C++ toolchain requirements 2. **CI/CD friendly**: Works in headless environments without rebuilding 3. **Cross-platform**: Same binary works on Linux/Mac/Windows 4. **Fallback safety**: Regex parser ensures 100% uptime ## Current Tool Status | Tool | Status | Notes | |------|--------|-------| | `CTS_Scan_Project_Signals` | โœ… WASM (with fallback) | Primary signal detection tool | | `CTS_Analyze_Project` | โš ๏ธ Legacy (TreeSitterBridge) | Migration planned | | `CTS_Suggest_Refactoring` | โš ๏ธ Legacy (TreeSitterBridge) | Migration planned | ## References - **WASM utilities**: `src/utils/tree_sitter.ts` (471 lines) - **Parser integration**: `src/artifacts/parsers/gdscript_parser.ts` - **Tests**: `src/utils/__tests__/tree_sitter.test.ts` (318 lines) - **Upgrade plan**: `docs/mcp_upgrade_plan.md` (Tier 1 Task 3)

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/EricA1019/CTS_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server