What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
An MCP–LSP bridge is an adapter: it launches or connects to a Language Server Protocol (LSP) server, exposes a carefully chosen set of language features as Model Context Protocol (MCP) tools, translates each tool call into an LSP request, and returns a compact, predictable result to an AI host. Build the smallest useful tool set first—such as hover, symbol lookup, and diagnostics—then add workspace routing, cancellation, authorization, and remote transport.
Understand what the bridge connects
LSP is the language-intelligence side
LSP standardizes messages between an editor and a language server. The server supplies features such as completion, go-to-definition, references, hover text, and diagnostics; the editor supplies document contents, positions, and workspace context. The published LSP specification is version 3.18.
MCP is the AI-facing side
MCP is a client–server protocol whose JSON-RPC data layer can expose tools, resources, and prompts. Its transport is separate from the data format, so the same messages can travel over local stdio or remote Streamable HTTP.
The adapter is your product boundary
Neither standard mandates a universal mapping. Your bridge decides which LSP capabilities become MCP tools, what arguments they accept, how files and positions are represented, and how errors are explained. Prefer task-oriented tools with explicit schemas over a raw pass-through of every LSP method.
#1 Best Overall
Choose a narrow first version
Write down one language, one workspace model, and a small set of read-only operations. A practical first release might contain:
- hover: return the symbol information at a file, line, and character.
- definition: return one or more target locations.
- diagnostics: return current errors and warnings for a document.
- symbols: return document or workspace symbols.
For every tool, document the LSP method used, required capabilities, position encoding, result shape, and behavior when the language server does not advertise support. A missing capability should produce a clear, non-success response—not an empty result that looks authoritative.
Design the bridge lifecycle
Start and monitor the language server
Launch the selected language-server executable or connect to an existing process. Send the LSP initialize request with the workspace root, client capabilities, and position encodings you support; then send initialized. Keep the process’s standard input and output connected to an LSP JSON-RPC framing layer. Detect an early exit, malformed frame, and startup timeout, and surface those conditions to MCP callers.
Keep documents and workspace context correct
Before requesting hover or diagnostics, ensure the server has the document version and text it expects. Implement textDocument/didOpen, didChange, and didClose as needed. If your bridge accepts unsaved text, make that text explicit in the request and maintain a version number. For multiple projects, route each call using an explicit workspace identifier rather than assuming that one process or connection represents one conversation.
Recommended Free Tools
Plan for concurrency
Serialize writes to a language-server process, correlate JSON-RPC IDs, and allow independent reads to complete out of order when the server supports it. Add cancellation and a deadline for every request. On timeout, cancel the LSP request when possible and return a retryable MCP error; do not leave a promise waiting forever.
Rank #2
Implement an MCP server in TypeScript
The official MCP TypeScript SDK v2 documents McpServer, serveStdio, and schema-validated tool registration. The following skeleton shows the boundary; replace the lsp calls with your process manager and JSON-RPC client.
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { serveStdio } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
const server = new McpServer({
name: "lsp-bridge",
version: "0.1.0"
});
const HoverArgs = z.object({
workspace: z.string().min(1),
file: z.string().min(1),
line: z.number().int().nonnegative(),
character: z.number().int().nonnegative()
});
server.tool("hover", HoverArgs.shape, async (args) => {
const capability = await lsp.capabilities(args.workspace);
if (!capability.hoverProvider) {
return { content: [{ type: "text", text: "This language server does not support hover." }] };
}
const uri = await toDocumentUri(args.workspace, args.file);
const result = await lsp.request(
args.workspace,
"textDocument/hover",
{ textDocument: { uri }, position: {
line: args.line, character: args.character
}},
{ timeoutMs: 10_000 }
);
return {
content: [{ type: "text", text: formatHover(result) }]
};
});
await serveStdio(server);
In production, validate that the file belongs to the authorized workspace, normalize path separators, convert the host’s character indexing to the server’s negotiated encoding, and cap response size. Return stable text or structured JSON so an AI host can reliably consume the result. Keep credentials, environment secrets, and internal process output out of tool results.
Translate the important LSP operations
Hover and definition
Map a validated relative path and zero-based position to textDocument/hover or textDocument/definition. LSP definitions can be a single location or an array; normalize both to one documented MCP shape containing URI, range, and an optional display label.
Diagnostics
Diagnostics are commonly published asynchronously through textDocument/publishDiagnostics. Cache them by explicit workspace, URI, and document version, then have the MCP tool return the latest version and severity. If no publication has arrived, say that diagnostics are not yet available instead of claiming the file is clean.
Unsupported and malformed responses
Check the server’s advertised capabilities before invoking an operation. Convert an LSP error, invalid JSON-RPC response, or unexpected result type into a typed MCP error with an actionable message. Log the raw failure on the server side with a request ID, but redact source text and secrets.
Select the MCP transport
| Transport | Best fit | Engineering consequences |
|---|---|---|
| stdio | Local AI host launching your bridge | No network hop and simple process ownership; the host must be able to start the bridge and language server. |
| Streamable HTTP | Remote or shared deployment | HTTP POST carries MCP messages, with optional server-sent events; provide HTTPS, authentication, request limits, observability, and reachability. |
The JSON-RPC message format remains the same across these transports. Do not confuse a remote MCP transport with a remote LSP process: either side may be local or remote, but each hop needs its own timeout and failure handling.
Apply MCP’s statelessness and security rules
The MCP basic specification states: “The Model Context Protocol (MCP) is a stateless protocol: all the information needed to process a request is contained in the request itself.” Do not infer workspace, document version, or authorization from a prior message, connection identity, or stdio process. Pass an explicit workspace or project identifier and validate it on every call. If you maintain caches, treat them as an optimization keyed by that explicit context, not as hidden conversation state.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsFor HTTP deployments, follow MCP’s authorization framework and enforce authorization on every request. Scope credentials to the requested workspace and operation. Read-only inspection can have narrower permissions; edit-capable tools need stronger authorization, accurate safety annotations, and a reviewable audit trail. An annotation never replaces authorization.
Validate with MCP Inspector and bridge tests
- Start the bridge and confirm initialization completes for a known workspace.
- Inspect the advertised instructions, tool names, descriptions, input schemas, and annotations.
- Call each tool with a representative valid file, position, and workspace.
- Call it with a missing file, an out-of-range position, an unknown workspace, and malformed arguments.
- Stop the language server during a request and verify a bounded, useful error.
- Test an unavailable capability, delayed diagnostics, cancellation, and a malformed LSP response.
- For HTTP, test missing, expired, and insufficient credentials, plus an unreachable upstream.
- Check that logs contain correlation IDs but no tokens, cookies, or source content.
MCP Inspector is useful for initialization, schemas, results, errors, annotations, and authorization checks. Add automated contract tests around your LSP adapter so a language-server upgrade cannot silently change the MCP result shape.
Common failures and fixes
The server exits immediately
Verify the executable path, working directory, runtime version, and startup arguments. Capture stderr separately from the LSP stdout stream; writing diagnostics to stdout corrupts JSON-RPC framing.
Rank #4
Every position is wrong
Check zero-based line and character indexes and the position encoding negotiated during initialization. Convert UTF-16, UTF-8, or UTF-32 offsets deliberately rather than assuming JavaScript string indexes match the server.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Hover is always empty
Confirm the document was opened or changed before the request, the URI uses the server’s expected scheme, the position is inside a symbol, and hoverProvider is advertised. Wait for initialization and indexing before declaring no result.
Diagnostics are stale
Track document versions and publish timestamps. Return the version alongside diagnostics, invalidate cache entries on change, and distinguish “no diagnostics received” from an empty diagnostic list.
Remote calls time out
Measure MCP transport time, bridge queue time, language-server time, and startup time separately. Use bounded deadlines, cancellation, and health checks. For remote hosting, plan stable HTTPS, streaming behavior, secrets management, logs, tracing, rollback, and service reachability.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
If your workflow also needs reliable website captures for documentation, test fixtures, or agent context, ScreenshotNeo provides a one-request screenshot API and MCP server. It accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status.
cURL (see the ScreenshotNeo documentation):
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
Its MCP server includes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.
Best Value
Frequently Asked Questions
Should the bridge expose every LSP method?
No. Start with a small, task-oriented contract and add methods only when you can define their schemas, capability checks, authorization, and stable result format.
Can one bridge serve several languages?
Yes, but route each request to an explicitly selected workspace and language server, and account for different capabilities, position encodings, startup costs, and failure modes.
Are MCP tool annotations a security boundary?
No. They describe actual behavior for clients; authorization and input validation must still be enforced by the server.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchThe Bottom Line
Build the bridge as a deliberate translation layer: explicit context in every request, strict schemas, capability-aware LSP calls, bounded lifecycle management, and tests that cover both protocols and their failure modes.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




