Skip to main content
Glama

TypeScript MCP

by mizchi

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
  • 🤖 AI-Optimized - Designed for LLMs with line and symbol-based interfaces

LSP Tools (Language Server Protocol)

These tools work with any language that has an LSP server:

  • get_hover - Get hover information (type signature, documentation) using LSP
  • find_references - Find all references to symbol across the codebase using LSP
  • get_definitions - Get the definition(s) of a symbol using LSP
  • get_diagnostics - Get diagnostics (errors, warnings) for a file using LSP
  • get_all_diagnostics - Get diagnostics (errors, warnings) for all files in the project
  • rename_symbol - Rename a symbol across the codebase using Language Server Protocol
  • delete_symbol - Delete a symbol and optionally all its references using LSP
  • get_document_symbols - Get all symbols (functions, classes, variables, etc.) in a document using LSP
  • get_workspace_symbols - Search for symbols across the entire workspace using LSP
  • get_completion - Get code completion suggestions at a specific position using LSP
  • get_signature_help - Get signature help (parameter hints) for function calls using LSP
  • get_code_actions - Get available code actions (quick fixes, refactorings, etc.) using LSP
  • format_document - Format an entire document using the language server's formatting provider

See examples/ for working examples of each supported language configuration.

Quick Start

lsmcp provides multi-language support through Language Server Protocol (LSP) integration. The basic workflow is:

  1. Install Language Server - Install the LSP server for your target language
  2. Add MCP Server - Configure using claude mcp add command or .mcp.json

Basic Usage

# Using presets for common languages claude mcp add typescript npx -- -y @mizchi/lsmcp -p typescript # Custom LSP server with --bin claude mcp add <server-name> npx -- -y @mizchi/lsmcp --bin="<lsp-command>"

Available Presets

lsmcp includes built-in presets for popular language servers:

  • typescript - TypeScript/JavaScript (typescript-language-server)
  • tsgo - TypeScript/JavaScript (tsgo - faster alternative)
  • deno - Deno TypeScript/JavaScript
  • pyright - Python (Microsoft Pyright)
  • ruff - Python (Ruff linter as LSP)
  • rust-analyzer - Rust
  • fsharp - F# (fsautocomplete)
  • moonbit - MoonBit
  • gopls - Go (Official Go language server)

For languages not in this list, or to customize LSP server settings, see Manual Setup.

Language-Specific Setup

TypeScript
# with typeScript-language-server (stable) npm add -D typescript typescript-language-server # Recommended: use tsgo for full functionality claude mcp add typescript npx -- -y @mizchi/lsmcp -p typescript --bin="npx tsgo --lsp --stdio" # with @typescript/native-preview (experimental, fast) npm add -D @typescript/native-preview claude mcp add typescript npx -- -y @mizchi/lsmcp -p typescript --bin="npx tsgo"

Manual Configuration (.mcp.json)

{ "mcpServers": { "typescript": { "command": "npx", "args": [ "-y", "@mizchi/lsmcp", "-p", "typescript", "--bin", "npx tsgo --lsp --stdio" ] } } }
Rust
rustup component add rust-analyzer claude mcp add rust npx -- -y @mizchi/lsmcp -p rust-analyzer

Manual Configuration (.mcp.json)

{ "mcpServers": { "rust": { "command": "npx", "args": ["-y", "@mizchi/lsmcp", "-p", "rust-analyzer"] } } }

See examples/rust-project/ for a complete example.

Go
# Install gopls (official Go language server) go install golang.org/x/tools/gopls@latest claude mcp add go npx -- -y @mizchi/lsmcp -p gopls

Manual Configuration (.mcp.json)

{ "mcpServers": { "go": { "command": "npx", "args": ["-y", "@mizchi/lsmcp", "-p", "gopls"] } } }

See examples/go/ for a complete example.

F#
dotnet tool install -g fsautocomplete claude mcp add fsharp npx -- -y @mizchi/lsmcp -p fsharp --bin="fsautocomplete --adaptive-lsp-server-enabled"

Manual Configuration (.mcp.json)

{ "mcpServers": { "fsharp": { "command": "npx", "args": [ "-y", "@mizchi/lsmcp", "-p", "fsharp", "--bin", "fsautocomplete" ] } } }

See examples/fsharp-project/ for a complete example.

Python
# Option 1: Using Pyright (recommended) npm install -g pyright claude mcp add python npx -- -y @mizchi/lsmcp -p pyright # Option 2: Using python-lsp-server pip install python-lsp-server claude mcp add python npx -- -y @mizchi/lsmcp --bin="pylsp"

Manual Configuration (.mcp.json)

{ "mcpServers": { "python": { "command": "npx", "args": ["-y", "@mizchi/lsmcp", "-p", "pyright"] } } }

See examples/python-project/ for a complete example.

Other Languages

lsmcp supports any language with an LSP server. Here are some common configurations:

# Go go install golang.org/x/tools/gopls@latest claude mcp add go npx -- -y @mizchi/lsmcp --bin="gopls" # C/C++ # Install clangd from your package manager or LLVM releases claude mcp add cpp npx -- -y @mizchi/lsmcp --bin="clangd" # Java # Install jdtls (Eclipse JDT Language Server) claude mcp add java npx -- -y @mizchi/lsmcp --bin="jdtls"

For more customization options, see Manual Setup.

Manual Setup

For advanced users who want more control over LSP server configuration, you can set up lsmcp manually with custom settings.

Minimal rust-analyzer Example

{ "mcpServers": { "rust-minimal": { "command": "npx", "args": [ "-y", "@mizchi/lsmcp", "--bin", "rust-analyzer" ], "env": { "RUST_ANALYZER_CONFIG": "{\"assist\":{\"importGranularity\":\"module\"},\"cargo\":{\"allFeatures\":true}}" } } } }

Custom Language Server Setup

You can configure any LSP server by providing the binary path and optional initialization options:

{ "mcpServers": { "custom-lsp": { "command": "npx", "args": [ "-y", "@mizchi/lsmcp", "--bin", "/path/to/your/lsp-server", "--initializationOptions", "{\"customOption\":\"value\"}" ] } } }

Using Configuration Files

For complex LSP server configurations, you can use the --config option to load settings from a JSON file:

  1. Create a configuration file (e.g., my-language.json):
{ "id": "my-language", "name": "My Custom Language", "bin": "my-language-server", "args": ["--stdio"], "initializationOptions": { "formatOnSave": true, "lintingEnabled": true, "customFeatures": { "autoImport": true } } }
  1. Use it with lsmcp:
# Using Claude CLI claude mcp add my-language npx -- -y @mizchi/lsmcp --config ./my-language.json # Or in .mcp.json { "mcpServers": { "my-language": { "command": "npx", "args": ["-y", "@mizchi/lsmcp", "--config", "./my-language.json"] } } }

This approach is useful when:

  • You have complex initialization options
  • You want to share configurations across projects
  • You need to version control your LSP settings

Environment Variables

Some LSP servers can be configured via environment variables:

{ "mcpServers": { "configured-lsp": { "command": "npx", "args": ["-y", "@mizchi/lsmcp", "--bin", "lsp-server"], "env": { "LSP_LOG_LEVEL": "debug", "LSP_WORKSPACE": "/path/to/workspace" } } } }

MCP Usage

Command Line Options

# Using language presets npx @mizchi/lsmcp -p <preset> --bin '...' npx @mizchi/lsmcp --preset <preset> --bin '...' # Custom LSP server npx @mizchi/lsmcp --bin '<lsp-command>'

Development

# Install dependencies pnpm install # Build pnpm build # Run tests pnpm test # Type check pnpm typecheck # Lint pnpm lint

See CLAUDE.md for development guidelines.

Troubleshooting

LSP Server Not Found

Error: LSP server for typescript not found

Solution: Install the language server:

npm add typescript typescript-language-server

Permission Denied

Error: Permission denied for tool 'rename_symbol'

Solution: Update .claude/settings.json to allow lsmcp tools.

Empty Diagnostics

If get_diagnostics returns empty results:

  1. Ensure the language server is running: ps aux | grep language-server
  2. Check for tsconfig.json or equivalent config file
  3. Try opening the file first with get_hover

License

MIT - See LICENSE file for details.

Related MCP Servers

  • A
    security
    F
    license
    A
    quality
    The 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 -
    4
    16
    Python
    • Apple
  • -
    security
    A
    license
    -
    quality
    A 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 -
    37
    Python
    MIT License
  • -
    security
    F
    license
    -
    quality
    A utility toolkit that enhances Claude's code interaction capabilities by providing seamless tools for Java code analysis, manipulation, and testing workflows.
    Last updated -
    2
    TypeScript
  • -
    security
    A
    license
    -
    quality
    A server that acts as a bridge between Claude and local Xcode projects, enabling AI-powered code assistance, project management, and automated development tasks without exposing your code to the internet.
    Last updated -
    JavaScript
    MIT License
    • Apple

View all related MCP servers

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/mizchi/typescript-mcp'

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