The TypeScript MCP server provides advanced code manipulation and analysis capabilities for TypeScript/JavaScript projects, similar to a Language Server Protocol (LSP). You can:
- Move files and directories: Automatically updates all imports and references
- Rename symbols: Change variables, functions, classes, etc. across the entire codebase
- Delete symbols: Remove symbols and optionally their references
- Find references: Locate all usages of a specific symbol
- Get definitions: Retrieve symbol definitions with context
- Get diagnostics: Fetch TypeScript errors and warnings
- Analyze modules: List exported symbols or get detailed type signatures
- Get type information: Retrieve types for symbols at specific locations
- List symbols in scope: See all visible symbols at a particular location
Provides advanced code manipulation and analysis capabilities for TypeScript projects, including refactoring (renaming symbols, moving files, deleting symbols), code navigation (jump to definition, find references), diagnostics, and module analysis.
lsmcp - Language Service MCP
LSP for headless AI Agents
⚠️ This project is under active development. APIs and features may change without notice.
A unified MCP (Model Context Protocol) server that provides advanced code manipulation and analysis capabilities for multiple programming languages through Language Server Protocol integration.
Features
- 🌍 Multi-Language Support - Built-in TypeScript/JavaScript, extensible to any language via LSP
- 🔍 Semantic Code Analysis - Go to definition, find references, type information
- ♻️ Intelligent Refactoring - Rename symbols, move files, with automatic import updates
- 🔧 Flexible Configuration - Use with any LSP server via
--bin
option - 🤖 AI-Optimized - Designed for LLMs with line and symbol-based interfaces
- ⚡ Fast Symbol Search - Project-wide symbol index with real-time file watching
- 🎯 Smart Import Suggestions - Find and suggest import candidates with relative paths
- 🐛 Debug Support - DAP integration for debugging with breakpoints, step execution, and variable inspection
See Language Support Matrix for detailed information about available tools for each language.
See Tool Categories for the difference between TypeScript-specific and LSP-based tools.
Motivation
While AI assistants like Claude can see errors in the IDE, they cannot perform semantic refactorings such as Go to Definition or Rename without proper tooling.
This project provides AI with functionality equivalent to Language Server Protocol (LSP) features. Since LLMs are not good at precise position tracking, we provide these features through line numbers and symbol names instead of character offsets.
Quick Start
1. Install Language Server
Language | Install Command | LSP Binary |
---|---|---|
TypeScript/JavaScript | npm add typescript typescript-language-server | typescript-language-server |
Rust | rustup component add rust-analyzer | rust-analyzer |
Python | pip install python-lsp-server | pylsp |
Go | Download from releases | gopls |
C/C++ | apt install clangd or brew install llvm | clangd |
Java | Download from eclipse.org | jdtls |
Ruby | gem install solargraph | solargraph |
2. Add MCP Server
3. Start Claude
Manual Configuration
For other languages, use the --bin
option:
Usage
Command Line Options
Batch Operations
Check diagnostics for multiple files:
Environment Variables
CRITICAL: Tool Usage Priority for Refactoring
When performing refactoring operations on TypeScript/JavaScript code, ALWAYS use lsmcp MCP tools instead of the default Edit/Write tools.
For example:
- ✅ Use
lsmcp_rename_symbol
for renaming - ❌ Don't use Edit/MultiEdit/Write for refactoring
- ✅ Use
lsmcp_move_file
for moving files - ❌ Don't use Bash(mv) or Write
These tools understand the semantic structure of your code and will update all references automatically.
Available Tools
TypeScript/JavaScript Enhanced Tools
When using --language typescript
, these TypeScript-specific tools are available:
- lsmcp_move_file - Move files and update all import statements
- lsmcp_move_directory - Move directories and update all imports
- lsmcp_delete_symbol - Delete symbols and all their references (using TypeScript Compiler API)
- lsmcp_rename_symbol - Rename across entire codebase (using TypeScript Compiler API)
- lsmcp_get_type_at_symbol - Get detailed type information
- lsmcp_get_module_symbols - List all exports from a module
- lsmcp_search_symbols - Fast project-wide symbol search
- lsmcp_find_import_candidates - Find and suggest imports
Standard LSP Tools
All languages support these LSP-based tools:
- lsp_get_hover - Get documentation and type info
- lsp_get_definitions - Go to definition
- lsp_find_references - Find all references
- lsp_get_diagnostics - Get errors and warnings
- lsp_get_document_symbols - List symbols in file
- lsp_get_workspace_symbols - Search project symbols
- lsp_rename_symbol - Rename (LSP-based)
- lsp_delete_symbol - Delete symbols (LSP-based)
- lsp_get_completion - Get code completions
- lsp_get_signature_help - Get function signatures
- lsp_format_document - Format code
- lsp_get_code_actions - Get available fixes
Note: When using --language typescript
, both LSP tools and TypeScript-specific tools are available.
See Tool Reference for detailed documentation.
AI Assistant Integration
For best results with AI assistants, include this context:
Development
See CLAUDE.md for development guidelines.
Troubleshooting
LSP Server Not Found
Solution: Install the language server:
Permission Denied
Solution: Update .claude/settings.json
to allow lsmcp tools.
Empty Diagnostics
If lsmcp_get_diagnostics
returns empty results:
- Ensure the language server is running:
ps aux | grep language-server
- Check for tsconfig.json or equivalent config file
- Try opening the file first with
lsmcp_get_hover
Debugging
Enable verbose logging:
Check language server output:
License
MIT - See LICENSE file for details.
Recent Updates
- v0.5.2 (2025-01-29) - Consolidated TypeScript tools, removed duplicates in favor of LSP implementations
- v0.5.1 - Added F# language support with dedicated initialization
- v0.5.0 - Unified lsmcp CLI for all languages
Changelog
See CHANGELOG.md for version history and updates.
Tools
A specialized server that provides advanced TypeScript code manipulation and analysis capabilities, enabling refactoring, navigation, diagnostics, and module analysis through Claude.
Related MCP Servers
- -securityAlicense-qualityThe Claude Dev Server enables direct interaction with the file system within a specified workspace, allowing users to perform file and directory operations and implement code artifacts in software development using natural language commands.Last updated -2PythonMIT License
- AsecurityFlicenseAqualityThe server facilitates natural language interactions for exploring and understanding codebases, providing insights into data models and system architecture using a cost-effective, simple setup with support for existing Claude Pro subscriptions.Last updated -47Python
- -securityAlicense-qualityA comprehensive code analysis and management tool that integrates with Claude Desktop to analyze code at project and file levels, helping adapt changes to projects intelligently.Last updated -29PythonMIT License
- -securityFlicense-qualityA utility toolkit that enhances Claude's code interaction capabilities by providing seamless tools for Java code analysis, manipulation, and testing workflows.Last updated -2TypeScript