W3 MCP LSP Server
Provides code intelligence (go to definition, hover, find references) for JavaScript files via the TypeScript Language Server.
Provides code intelligence (go to definition, hover, find references) for TypeScript files via the TypeScript Language Server.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@W3 MCP LSP Servershow definition ofaddin src/math.ts at line 10, column 5"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
W3 MCP LSP Server
Python MCP server wrapping TypeScript Language Server for JavaScript/TypeScript code intelligence.
Status: ✅ Working with real LSP protocol (not mock)
Features
lsp_goto_definition - Jump to symbol definition location
lsp_hover - Get type information and documentation
lsp_find_references - Find all references/usages of symbol
Supports JavaScript and TypeScript files via TypeScript Language Server.
Related MCP server: Codex LSP Bridge
Quick Start
1. Clean Setup (Important!)
cd /path/to/w3-mcp-server-lsp
# Remove old lockfile and venv
rm -rf uv.lock .venv venv
# Unset old environment variable
unset VIRTUAL_ENV2. Install Dependencies
# Install TypeScript Language Server
npm install -g typescript typescript-language-server
# Install Python dependencies (using uv)
uv sync
# Install MCP CLI dependencies
uv pip install 'mcp[cli]'3. Verify Installation
# Check typescript-language-server
which typescript-language-server
typescript-language-server --version
# Check Python env
uv run python -c "from mcp.server.fastmcp import FastMCP; print('✓ MCP ready')"4. Test with MCP Inspector
# Start MCP Inspector (interactive web UI)
uv run mcp dev server.pyOpens URL like:
http://localhost:6274/?MCP_PROXY_AUTH_TOKEN=...Features:
✅ Available tools listed in sidebar
✅ Test each tool interactively with JSON input
✅ Real-time request/response viewing
✅ Server logs and debugging
✅ No extra dependencies needed
Usage
Option A: MCP Inspector (Development)
Best way to test and debug:
cd /path/to/w3-mcp-server-lsp
# Start inspector
uv run mcp dev server.pyOpens web UI at http://localhost:5173:
See available tools
Test each tool with JSON input
View request/response in real-time
See server logs
Option B: Direct Python
# Run server (stdio mode)
uv run python server.pyOption C: Claude Code Integration
Method 1: From PyPI (Recommended)
Install from PyPI:
pip install w3-mcp-server-lsp
# or
uv pip install w3-mcp-server-lspEdit ~/.claude/claude_config.json or ~/.mcp.json:
{
"mcpServers": {
"w3-lsp": {
"type": "stdio",
"command": "uv",
"args": ["run", "--with", "w3-mcp-server-lsp", "w3-mcp-server-lsp"],
"env": {
"PROJECT_ROOT": "/path/to/your/project"
}
}
}
}Advantages:
✅ No need to clone the repo
✅ Easy version management
✅ Automatic dependency isolation
Method 2: From Local Source
Edit ~/.claude/claude_config.json:
{
"mcpServers": {
"w3-lsp": {
"type": "stdio",
"command": "uv",
"args": ["run", "server.py"],
"cwd": "/path/to/w3-mcp-server-lsp",
"env": {
"PROJECT_ROOT": "/path/to/your/project"
}
}
}
}Then restart Claude Code.
Tools Documentation
⚠️ IMPORTANT: 0-Indexed Line and Character Numbers
All tools use 0-indexed positioning (start from 0, not 1):
Editor Display | Tool Input | Formula |
Ln 5, Col 10 | line: 4 | lsp_value = editor_value - 1 |
Ln 1, Col 1 | line: 0 | character: 0 |
Ln 10, Col 5 | line: 9 | character: 4 |
Quick Reference:
Line 1 in editor =
line: 0in toolColumn 1 in editor =
character: 0in tool
How to Calculate Character Position:
Given this code line:
const greeting = "Hello";
0123456789...Position at
cinconst→character: 0Position at
oinconst→character: 1Position at
gingreeting→character: 6Position at
Hin"Hello"→character: 18
In VSCode:
Click on a character
Look at status bar:
Ln X, Col YUse:
line: X-1, character: Y-1
lsp_goto_definition
Jump to definition of symbol at specified position.
Input:
{
"file_path": "fixtures/sample.js",
"line": 4,
"character": 9
}Output:
/path/to/fixtures/sample.js:5:9lsp_hover
Get type information and documentation for symbol.
Input:
{
"file_path": "fixtures/sample.js",
"line": 5,
"character": 10
}Output:
(parameter) a: anylsp_find_references
Find all references/usages of symbol.
Input:
{
"file_path": "fixtures/sample.js",
"line": 4,
"character": 9
}Output:
Found 2 references:
/path/to/fixtures/sample.js:5:9
/path/to/fixtures/sample.js:14:22Configuration
PROJECT_ROOT
Specifies the root directory of your project. Files paths in tool calls are relative to this.
Set via:
Environment variable:
export PROJECT_ROOT="/path/to/your/project" uv run python server.pyCurrent directory (default):
cd /path/to/your/project uv run python /path/to/w3-mcp-server-lsp/server.pyIn .claude/settings.json:
"env": { "PROJECT_ROOT": "/path/to/your/project" }
Line and Character Numbers (0-indexed)
LSP uses 0-indexed positions:
VSCode shows:
Ln 5, Col 10LSP needs:
line: 4, character: 9
Formula: lsp_value = vscode_value - 1
Project Structure
w3-mcp-server-lsp/
├── server.py # MCP server entry point
├── lsp_client.py # LSP protocol implementation
├── pyproject.toml # Project config
├── fixtures/
│ └── sample.js # Sample file for testing
├── test_mcp_server.py # Integration test
├── test_lsp_debug.py # Debug test with logging
└── README.mdHow It Works
Architecture
MCP Client (Claude, IDE, etc.)
↓
MCP Server (server.py)
↓
LSP Client (lsp_client.py)
↓
TypeScript Language Server (subprocess)LSP Protocol Flow
Initialization
Send:
initializerequestReceive: server capabilities
Send:
initializednotification
Document Opening
Send:
textDocument/didOpennotificationContent provided inline
Queries
Send:
textDocument/definition,textDocument/hover, etc.Receive: results from language server
Details
Communication: JSON-RPC over stdin/stdout
Binary mode: Avoids text encoding issues
Notification handling: Skip server notifications, match message IDs
Testing
Interactive Testing (Recommended)
uv run mcp dev server.pyWeb UI opens at http://localhost:5173:
Test tools visually
See real-time results
View server logs
Direct Server
uv run python server.pyRuns in stdio mode, ready to connect from Claude Code or other MCP clients.
Troubleshooting
TypeScript Language Server not found
# Install
npm install -g typescript typescript-language-server
# Verify
which typescript-language-serverMCP module not found
# Install dependencies
pip install -e .
# Or manually
pip install mcp pydanticServer hangs on startup
Check if TypeScript Language Server is installed
Check terminal for error messages
Try:
typescript-language-server --stdiodirectly
Tool returns None or error
Verify file path is relative to PROJECT_ROOT
Check line/character numbers are 0-indexed
Check server logs output in terminal
Use MCP Inspector (
uv run mcp dev server.py) to see requests/responses
Future Enhancements
Go support (gopls language server)
Python support (pylsp/pyright)
Multiple language servers in single MCP server
Caching of responses
Batch operations
Development
Testing with MCP Inspector
uv run mcp dev server.pyWeb UI at http://localhost:5173 shows:
Available tools and schemas
Real-time request/response
Server logs
Interactive testing
Running Directly
uv run python server.pyFor debugging, check logs output in terminal.
References
License
MIT
Available Tools
3 toolslsp_find_referencesARead-onlyIdempotent
Find all usages/references of symbol at position.
🔴 CRITICAL: Line and character are STRICTLY 0-INDEXED (0, 1, 2...), NOT 1-indexed!
❌ WRONG (what editor displays):
Editor shows: "Ln 5, Col 10"
❌ DON'T use: {"line": 5, "character": 10}
✅ CORRECT (0-indexed):
✅ DO use: {"line": 4, "character": 9}
Formula: lsp_value = editor_value - 1
CHARACTER COUNTING (0-indexed from start of line):
Line: "const greeting = "Hello";"
Index: 0123456789...
• 'c' in const → character: 0
• 'o' in const → character: 1
• 'g' in greeting → character: 6
• 'H' in string → character: 18
Args:
params (LSPInput): Must provide line and character as 0-indexed values
Returns:
str: "Found N references:
file:line:column ..." or "No references found"
Example:
✅ {"file_path": "src/app.ts", "line": 4, "character": 9}
→ "Found 2 references:
/path/src/app.ts:5:9 /path/src/utils.ts:10:2"
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description goes well beyond annotations by emphasizing the strict 0-indexing requirement, providing a conversion formula, and detailing the exact return format with examples. This is critical behavioral information not covered by the readOnlyHint or idempotentHint annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections (CRITICAL, WRONG, CORRECT, Example), but it is somewhat lengthy and repeats examples also found in the nested schema. It remains front-loaded with the primary purpose and key constraint.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description is comprehensive for this tool: it covers input requirements, output format, and provides a worked example. Given the tool's complexity and the presence of an output schema, this description provides all necessary context for correct invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description explains each parameter (line, character, file_path) with concrete examples and the conversion formula from editor to LSP indexing. This adds significant meaning beyond the minimal top-level schema description, compensating for the 0% schema description coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with 'Find all usages/references of symbol at position,' which clearly states the tool's function with a specific verb and resource. This distinguishes it from sibling tools like lsp_goto_definition and lsp_hover by its focus on references.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage (finding references) but does not explicitly contrast this tool with alternatives like lsp_goto_definition or lsp_hover, nor does it state when not to use it. Thus, the usage is clear from context but lacks explicit guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
lsp_goto_definitionARead-onlyIdempotent
Jump to symbol definition location.
🔴 CRITICAL: Line and character are STRICTLY 0-INDEXED (0, 1, 2...), NOT 1-indexed!
❌ WRONG (what editor displays): Editor shows: "Ln 5, Col 10" ❌ DON'T use: {"line": 5, "character": 10}
✅ CORRECT (0-indexed): ✅ DO use: {"line": 4, "character": 9} Formula: lsp_value = editor_value - 1
CHARACTER COUNTING (0-indexed from start of line): Line: "const greeting = "Hello";" Index: 0123456789... • 'c' in const → character: 0 • 'o' in const → character: 1 • 'g' in greeting → character: 6 • 'H' in string → character: 18
Args: params (LSPInput): Must provide line and character as 0-indexed values
Returns: str: "file:line:column" or "Definition not found"
Example: ✅ {"file_path": "src/app.ts", "line": 4, "character": 9} → "/path/src/app.ts:15:5"
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, destructiveHint=false, and idempotentHint=true, covering the safety profile. The description adds valuable behavioral context: the strict 0-indexing requirement, the return format ('file:line:column' or 'Definition not found'), and an example. This goes beyond what annotations convey.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-organized with headers, a critical warning, examples, and a return type. It is longer than minimal but justified by the tricky 0-indexing nuance. Some redundancy exists (e.g., repeated indexing formulas), but the structure and front-loaded purpose keep it effective.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With annotations covering safety and an output schema presumably present, the description thoroughly covers purpose, parameters, return value, and a detailed example. It even explains edge-case conversion. It is complete for a tool of this complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Despite the schema having descriptive parameter entries, the context indicates 0% schema description coverage. The description fully compensates by explicitly stating the 0-indexing requirement, providing conversion formulas, and offering a concrete example with file_path. It clearly explains how to interpret and provide each parameter.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description starts with a clear and specific verb+resource phrase: 'Jump to symbol definition location.' This precisely distinguishes it from sibling tools like lsp_hover (show info) and lsp_find_references (find usages). The purpose is unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description clearly implies the use case (navigate to a symbol's definition) but does not explicitly state when to prefer this over alternatives or mention exclusions. Sibling tools exist but are not referenced, so the guidance is implied rather than explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
lsp_hoverARead-onlyIdempotent
Get type information and documentation for symbol at position.
🔴 CRITICAL: Line and character are STRICTLY 0-INDEXED (0, 1, 2...), NOT 1-indexed!
❌ WRONG (what editor displays): Editor shows: "Ln 5, Col 10" ❌ DON'T use: {"line": 5, "character": 10}
✅ CORRECT (0-indexed): ✅ DO use: {"line": 4, "character": 9} Formula: lsp_value = editor_value - 1
CHARACTER COUNTING (0-indexed from start of line): Line: "const greeting = "Hello";" Index: 0123456789... • 'c' in const → character: 0 • 'o' in const → character: 1 • 'g' in greeting → character: 6 • 'H' in string → character: 18
Args: params (LSPInput): Must provide line and character as 0-indexed values
Returns: str: Type signature like "(parameter) name: string" or "No info available"
Example: ✅ {"file_path": "src/app.ts", "line": 4, "character": 9} → "(parameter) greeting: string"
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description adds substantial behavioral context beyond the annotations: it emphasizes the critical 0-indexing requirement, shows the exact return format ('(parameter) name: string' or 'No info available'), and explains the formula for converting editor values. The annotations already state readOnly, idempotent, and non-destructive, so the description enriches rather than repeats them. No contradictions found.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with a critical warning at the top, clear do/don't examples, and a character indexing diagram. It is somewhat repetitive—the 0-indexing rule is repeated across the warning, character counting section, and schema—but the repetition reinforces a crucial point. It earns a 4 because while not maximally concise, it prioritizes the most important information and remains scannable.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description is highly complete: it covers the tool's purpose, input parameters with exhaustive indexing guidance, return value format, and a concrete usage example. The output schema is provided, so return value details do not need to be over-explained. Given the potential for off-by-one errors, this description fully equips an agent to invoke the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description goes far beyond the schema by providing detailed 0-indexing examples, a character-counting illustration, and the conversion formula (lsp_value = editor_value - 1). This adds substantial meaning to the 'line' and 'character' parameters beyond what the schema's descriptions offer. It also clarifies the file_path parameter as relative to the project root. The abundant examples make the parameter usage crystal clear.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb+resource: 'Get type information and documentation for symbol at position.' This clearly distinguishes it from sibling tools like lsp_goto_definition (jump to definition) and lsp_find_references (find references). The purpose is unambiguous and immediately understandable.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context for use by explaining how to convert editor 1-based positions to 0-based values and includes a concrete example. It does not explicitly state when not to use it or contrast with alternatives, but the purpose and critical indexing instructions implicitly guide usage. No exclusion criteria are mentioned, so it scores a 4 rather than a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
v0.1.5- First observed
lsp_find_references - First observed
lsp_goto_definition - First observed
lsp_hover
TDQS
Scored across 3 tools
Each tool targets a distinct LSP operation: definition lookup, hover information, and reference search. There is no overlap in their purposes, making selection unambiguous.
All tools share the 'lsp_' prefix and follow an action-oriented naming pattern. However, 'lsp_hover' lacks the object component found in 'lsp_goto_definition' and 'lsp_find_references', creating a minor structural inconsistency.
The three tools represent a focused, minimal set of LSP navigation features. Each earns its place without unnecessary bloat, and the count falls within the well-scoped range.
The core navigation operations (definition, hover, references) are covered, providing a usable foundation. However, other common LSP features such as document symbols, implementation, or code completion are missing, which could require workarounds for certain tasks.
Maintenance
Related MCP Connectors
The official Svelte MCP server providing docs and autofixing tools for Svelte development
Lean 4 MCP server: compile, prove theorems, and formalize math with Mathlib.
A TypeScript MCP server for Home Assistant, enabling programmatic management of entities, automati…
MCP Server for JFrog, providing tools for development and artifact management.
Related MCP Servers
- AlicenseBqualityDmaintenanceTypeScript-based MCP server designed to enhance code editing experiences by providing features such as hover information, code completion, and diagnostics.355 npm26MIT
- AlicenseNot gradedqualityDmaintenanceExposes Language Server Protocol (LSP) features as MCP tools, enabling IDE-grade semantic navigation including go-to-definition, find references, hover info, and symbols across multiple programming languages (Python, Rust, C/C++, TypeScript/JavaScript, React, HTML, CSS).3MIT
- AlicenseAqualityDmaintenanceA lightweight MCP server that provides 40 tools for TypeScript/JavaScript refactoring and code intelligence, directly mapping to TypeScript's tsserver protocol commands for accurate structural changes and workspace analysis.4020 npm3MIT
- AlicenseNot gradedqualityBmaintenanceSelf-contained MCP server providing type-aware code intelligence for TypeScript, JavaScript, and Vue files, exposing tools like hover, definition, references, and diagnostics to Claude Code without requiring global language server installations.MIT