Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Connect the TypeScript language server to an LSP client, then expose selected LSP operations as tools on an MCP server. The AI host calls those tools; your bridge translates each call into an LSP request and returns the language server’s result. MCP does not replace LSP, and the language server is not itself an MCP server.

What the bridge does

The Language Server Protocol (LSP) carries language features between an editor or IDE and a language server. Microsoft’s LSP documentation gives completion, go-to-definition, find-all-references, and hover documentation as examples, and lists version 3.18 as the latest specification version shown there (accessed September 29, 2026).

The Model Context Protocol (MCP) connects AI applications to tools, resources, and prompts. Its TypeScript SDK supports Node.js, Bun, and Deno. The practical connection between the two protocols is an adapter process: it accepts MCP tool calls, sends corresponding requests to a TypeScript language server over LSP, then translates the responses into MCP results.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a useful first version, make one TypeScript process own both connections: the LSP client connection to the language server and the MCP server connection to the AI host. Keep the protocol boundary explicit. MCP inputs should be validated before they become LSP requests, and the returned data should preserve useful details such as locations, ranges, symbol names, diagnostic severity, and source text.

Choose a scope and transport

Decide where the bridge runs and how much authority it receives before registering tools. Local/editor use usually favors stdio; a remotely hosted bridge uses Streamable HTTP. The MCP server guide documents both stateful and stateless Streamable HTTP. Statefulness is a design choice based on whether session tracking and resumability matter for the service.

Design question Practical starting point Trade-off to consider
Local or remote? Run locally for an AI client or editor on the developer’s machine; choose Streamable HTTP for a remotely hosted bridge. Remote hosting requires you to define how workspaces are selected and isolated. The protocol choice alone does not decide access control.
stdio or HTTP? Use MCP stdio for a locally spawned process. The official guide documents StdioServerTransport for servers and StdioClientTransport for clients that spawn a local process. For remote servers, use Streamable HTTP. HTTP+SSE is documented as a backwards-compatibility transport, not the preferred choice for new implementations.
Read-only or edit-capable? Start with navigation and diagnostics tools. Editing expands the consequences of bad or ambiguous inputs. Add it only after defining authorization, validation, and review behavior.
One or many workspaces? Start with one explicitly approved workspace per bridge process or session. Multi-workspace operation needs an unambiguous workspace identifier and checks that every requested file remains within the selected root.
Stateful or stateless HTTP? Choose based on whether the bridge needs session tracking or resumability. The MCP server guide documents both options; neither is universally correct.

Build the bridge in stages

  1. Choose your runtime and packages. The current MCP TypeScript SDK v2 package is @modelcontextprotocol/server; its documented installation command is npm install @modelcontextprotocol/server. The v2 README describes it as the stable line implementing the 2026-07-28 MCP specification. The TypeScript SDK supports Node.js, Bun, and Deno.
  2. Start an LSP client connection. Configure the bridge to communicate with the TypeScript language server for the intended workspace. The exact server command, startup arguments, and LSP client library depend on your project and chosen server; the protocol architecture does not prescribe a universal launch command.
  3. Create the MCP server. Follow the SDK server guide’s sequence: create an McpServer, register tools, resources, or prompts, choose a transport, and connect the server to that transport. Use stdio for the local child-process pattern or Streamable HTTP for a remote service.
  4. Register bounded, read-only tools. Begin with hover, definition, typeDefinition, references, documentSymbol, workspaceSymbol, and diagnostics. Give each tool a narrow input schema, such as workspace root, file URI, line, and character where relevant. Map those fields to the corresponding LSP operation.
  5. Translate results deliberately. Return predictable structured data rather than an opaque text dump. Preserve source locations and ranges for navigation results, symbol names for symbol queries, and severity and source information for diagnostics when available.
  6. Apply workspace and size limits. Restrict file access to approved roots, reject path traversal, cap result sizes, and do not expose arbitrary shell execution through tool handlers. Validate file URIs and coordinates before forwarding requests.
  7. Connect and test with the AI host. Confirm that the host can launch or reach the MCP server over the chosen transport, that each tool receives valid inputs, and that the bridge returns the expected structured result for a file in the approved workspace.

Design the first tools

Keep a tool’s name and description close to the task the model should perform. A narrow contract makes it easier for an AI host to select the right operation and for the bridge to enforce limits.

MCP tool Typical input Useful output to preserve
hover Workspace, file URI, line, character Language-server hover contents and the location queried
definition Workspace, file URI, line, character One or more target URIs and ranges
typeDefinition Workspace, file URI, line, character Type-definition target locations
references Workspace, file URI, line, character Reference locations, subject to a result cap
documentSymbol Workspace and file URI Document symbols and their ranges or hierarchy
workspaceSymbol Workspace and symbol query Matching symbols and locations, subject to a result cap
Diagnostics Workspace and file URI, or a defined workspace scope Diagnostic message, range, severity, and source when available

Diagnostics need special handling in the bridge design: do not assume they behave like a simple on-demand query. Define how the bridge obtains and associates diagnostic results with the relevant workspace and file, and how it reports a result when no diagnostics are available. The exact mechanism depends on the LSP client and server implementation you select.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
TypeScript Programming Language - Software Engineer & Coder T-Shirt
  • TypeScript implements a superset of syntax for strictly typed development, facilitating deep static analysis and enhanced development environment integration. The compiler translates source into standard script formats, ensuring parity across any runtime.
  • TypeScript is ideal for front-end developers, full-stack engineers, and software architects who build large-scale web applications. It serves those looking to improve code excellence, reduce bugs through static checking, and maintain complex projects more.
  • Lightweight, Classic fit, Double-needle sleeve and bottom hem

Keep the connection and tool boundaries clear

The LSP client connection and MCP server connection have different jobs. Use the LSP connection for TypeScript language intelligence. Use the MCP connection to make selected capabilities available to the AI host. If your bridge also needs to call tools on another MCP server, the separate @modelcontextprotocol/client package documents client modules for stdio and Streamable HTTP; it is not the LSP client.

When adapting older SDK examples, check whether they import the v1 monolithic @modelcontextprotocol/sdk package. The current v2 package is @modelcontextprotocol/server, so update imports and transport code deliberately rather than assuming older examples are drop-in replacements. Consult the SDK’s current guide and API reference for the exact version-specific method signatures; those implementation details are not interchangeable across package generations.

Security and reliability checks

  • Contain file access. Resolve requested paths against approved workspace roots and reject paths that escape them, including traversal through relative path components.
  • Bound work. Set limits on result counts and response sizes so large workspaces or broad references queries do not overwhelm the host.
  • Keep execution narrow. Do not let tool input become arbitrary shell commands. A language-intelligence bridge should expose defined operations rather than a general-purpose command runner.
  • Make failures legible. Distinguish invalid tool arguments, inaccessible files, unavailable language-server results, and transport failures in the bridge’s response behavior. Do not turn an error into a plausible-looking empty result.
  • Use read-only defaults. Add edit-capable operations only after establishing clear bounds and confirmation or review behavior appropriate to the AI host.
  • Test scope boundaries. Try an approved file, a nonexistent file, malformed coordinates, and a path outside the workspace. Verify that invalid or unauthorized requests do not reach the language server as valid work.

Common problems and fixes

The AI host cannot start or reach the MCP server

Check that the host and bridge agree on the transport. A locally spawned server should use the stdio pattern; a remotely hosted bridge should use Streamable HTTP. Also confirm the runtime and package imports match the SDK version installed.

The tool returns no definition or hover result

Verify that the file URI belongs to the intended workspace and that the line and character identify the symbol you meant to query. Check the LSP response before converting it to MCP output so that a missing result is not confused with a bridge translation failure.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Diagnostics appear stale or missing

Check how your selected LSP client and language server provide diagnostics, and confirm that the bridge associates them with the correct workspace and file. Define a clear result for the case where no diagnostic data is available instead of claiming the file has no issues.

Large queries produce unwieldy responses

Cap references and workspace-symbol results, and return locations and ranges in a stable structure. If a cap is reached, communicate that limitation rather than implying the returned set is complete.

An older example fails against the installed SDK

Inspect its imports and transport setup. Examples using the v1 monolithic @modelcontextprotocol/sdk may need a deliberate migration to the v2 @modelcontextprotocol/server package and its current API.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup (for screenshots only)

ScreenshotNeo is a website screenshot API, not a TypeScript language server or an MCP-to-LSP bridge. It cannot provide go-to-definition or diagnostics. If your project also needs website screenshots, its one-request API can capture a URL without setting up a browser yourself. See the ScreenshotNeo API documentation for options.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

It accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing status. An MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents using Claude, Cursor, or another MCP client. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

Further reading

For protocol and SDK details, use Microsoft’s official LSP documentation and the Model Context Protocol’s TypeScript SDK and server and client guides. The LSP specification version noted above is the latest version shown on Microsoft’s page as accessed September 29, 2026; check the official documentation for updates and the SDK reference for version-specific API signatures.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Does exposing LSP through MCP require changing the TypeScript language server?

The described architecture adds a bridge between an LSP client and the AI host; it does not require MCP to replace LSP. Whether a particular language server needs configuration depends on how you launch and connect it.

Can the bridge offer code editing as well as navigation?

It can be designed to expose additional capabilities, but the recommended starting scope is read-only. Editing needs separate validation and authorization decisions.

Is HTTP+SSE the recommended transport for a new remote bridge?

No. The MCP server guide describes Streamable HTTP for remote servers and HTTP+SSE as a backwards-compatibility transport.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.