TypeScript LSP MCP
Exposes TypeScript LSP-like functionality including type inspection, definition lookup, references finding, hover documentation, diagnostics, and type testing capabilities for TypeScript projects.
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., "@TypeScript LSP MCP get the type at line 15 column 8 in src/user.ts"
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.
ts-lsp-mcp
MCP server exposing TypeScript LSP-like functionality to AI agents.
Gives AI agents the same "what's the type at this position?" powers that IDE users have.
Quick Start
Install into Claude Code
# Install to current project (recommended)
npx ts-lsp-mcp install cc
# Or install globally for all projects
npx ts-lsp-mcp install cc --globalThat's it! The MCP server is now available to Claude Code.
Uninstall
npx ts-lsp-mcp uninstall ccRelated MCP server: VSCode MCP
Manual Installation
Global npm install
npm install -g ts-lsp-mcp
ts-lsp-mcp install ccManual config
Add to your Claude Code MCP config (.mcp.json in project or ~/.claude/settings.json globally):
{
"mcpServers": {
"ts-lsp-mcp": {
"type": "stdio",
"command": "npx",
"args": ["-y", "ts-lsp-mcp", "serve", "--stdio"]
}
}
}HTTP/SSE Mode
For remote clients or debugging:
ts-lsp-mcp --http --port 3000Endpoints:
GET /sse- SSE connectionPOST /message- Send messagesGET /health- Health check
Available Tools
Tool | Description |
| Get the TypeScript type at a specific file:line:col |
| Go to definition |
| Find all references |
| Get hover documentation |
| Get autocomplete suggestions |
| Get type errors and warnings |
| Trace where a type comes from and how it's composed |
| Run type assertions from |
| Type-check inline TypeScript without creating files |
Type Test Assertions
Add type assertions to your code:
// @ts-lsp-mcp expect-type: string
const name = user.name;
// @ts-lsp-mcp expect-type: User
const user = createUser({ name: 'Alice' });
// @ts-lsp-mcp expect-error: 2322
const bad: number = "oops"; // Should have error 2322Run tests:
runTypeTests({ file: "src/types.ts" })
runTypeTests({ pattern: "**/*.type-test.ts" })Example Usage
Get type at position
Supports unified file:line:col format:
{
"tool": "getTypeAtPosition",
"arguments": {
"file": "src/user.ts:10:5"
}
}Or separate parameters:
{
"tool": "getTypeAtPosition",
"arguments": {
"file": "src/user.ts",
"line": 10,
"col": 5
}
}Response:
{
"type": "User",
"expanded": "{ id: number; name: string; email: string }",
"symbol": "user",
"kind": "variable"
}Check for type errors
{
"tool": "getDiagnostics",
"arguments": {
"file": "src/user.ts"
}
}Type-check inline code
{
"tool": "checkInlineCode",
"arguments": {
"code": "const x: number = 'bad';"
}
}Response:
{
"valid": false,
"diagnostics": [{
"line": 1,
"col": 7,
"code": 2322,
"message": "Type 'string' is not assignable to type 'number'."
}]
}Features
Multi-project support: Works with monorepos with multiple tsconfigs
Auto-discovery: Finds tsconfig.json automatically
Smart file resolution: Accepts absolute, relative, or unique filenames
Virtual files: Type-check unsaved code with the
contentparameterEfficient: Long-lived daemon caches TypeScript projects
CLI Options
ts-lsp-mcp [command] [options]
Commands:
serve Start the MCP server (default)
install <target> Install into an AI assistant (cc, claude-code, claude)
uninstall <target> Uninstall from an AI assistant
Serve options:
--stdio Use stdio transport (default)
--http Use HTTP/SSE transport
--port <port> HTTP server port (default: 3000)
--host <host> HTTP server host (default: 127.0.0.1)
--debug Enable debug logging
Install options:
--global Install globally (user scope) instead of project
--name <name> Custom name for the MCP server (default: ts-lsp-mcp)
General:
-V, --version Output version number
-h, --help Display helpLicense
MIT
Available Tools
9 toolscheckInlineCodeA
Type-check inline TypeScript code without creating a file
Inputs: code (required), fileName, tsconfig.
getCompletionsC
Get autocomplete suggestions at a position
Inputs: file (required), col, line, prefix, +3 more.
getDefinitionA
Get the definition location(s) for a symbol at a position (go-to-definition)
Inputs: file (required), col, line, content, +1 more.
getDiagnosticsB
Get TypeScript diagnostics (errors, warnings) for a file or project
Inputs: file, content, severity, projectRoot.
getHoverB
Get hover information (documentation, type signature) at a position
Inputs: file (required), col, line, content, +1 more.
getReferencesB
Find all references to a symbol at a position
Inputs: file (required), col, line, content, +3 more.
getTypeAtPositionC
Get the TypeScript type at a specific position in a file
Inputs: file (required), col, line, content, +2 more.
runTypeTestsB
Run type test assertions from files with @ts-lsp-mcp expect-type/expect-error comments
Inputs: file, pattern, projectRoot.
traceTypeC
Trace where a type comes from and how it is composed
Inputs: file (required), col, line, depth, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool targets a distinct LSP feature (type-checking, completions, definitions, diagnostics, hover, references, type queries, type tests, type tracing). There is no overlap or ambiguity between tools.
Most tools follow a 'get' + noun pattern (getCompletions, getDefinition, etc.), with two exceptions: 'checkInlineCode' uses 'check' and 'runTypeTests' uses 'run'. This minor inconsistency prevents a perfect score.
9 tools is an appropriate size for a TypeScript LSP server. It covers essential features without being bloated or too sparse.
The tools cover core LSP operations (diagnostics, hover, definition, references, completions, type queries) and even include niche features (type tracing, type tests). Missing common operations like code actions, rename, or formatting, but the set is largely complete for its apparent purpose.
Maintenance
Related MCP Connectors
Coding agents in multi-service codebases routinely rebuild existing helpers, trust stale type definitions, and modify API contracts without knowing who consumes them. Carrick solves this by indexing your entire TypeScript ecosystem across service and repository boundaries. By integrating deeply with the TypeScript compiler, Carrick traces every route, type, and cross-service call while recording function behaviour so agents search by intent rather than name. Delivered via MCP for AI agents and LSP for IDEs, Carrick ensures models see existing endpoints and utilities before generating new code. The scanner is source-available and runs from your CLI or CI pipeline.
Web scraping, Google SERP, Markdown and ChatGPT/Gemini answers as typed tools for AI agents.
Write, compile and share Typst documents (papers, slides, drawings) from any AI agent.
Search @imqueue docs and scaffold typed services & clients from your AI coding agent.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables AI coding agents to interact with TypeScript projects through compiler-level code intelligence, providing tools for navigation, type information, diagnostics, refactoring, and semantic search.29194 npm4Apache 2.0
- FlicenseNot gradedqualityAmaintenanceEnables AI coding agents to access real-time VSCode LSP diagnostics, type information, and code navigation without slow tsc/eslint checks, plus symbol renaming and file operations.-
- FlicenseNot gradedqualityAmaintenanceEnables AI coding agents to retrieve real-time LSP diagnostics, symbol and type information, and code references, and to perform workspace-aware file operations such as symbol renaming. This avoids waiting for slow tsc/eslint checks while improving code navigation and editing accuracy.-
- FlicenseNot gradedqualityAmaintenanceEnables AI coding agents to obtain real-time language-server diagnostics, type information, symbol definitions, references, and workspace-wide renames directly from open editor instances, avoiding slow external type and lint checks.-