{"id":25693998,"url":"https://github.com/jonrad/lsp-mcp","last_synced_at":"2025-11-17T23:04:18.845Z","repository":{"id":278984685,"uuid":"937401728","full_name":"jonrad/lsp-mcp","owner":"jonrad","description":"An Model Context Protocol (MCP) server that provides LLMs/AI Agents with the capabilities of a language server protocol (LSP) server. This gives the AI the ability to get language aware context from the codebase.","archived":false,"fork":false,"pushed_at":"2025-03-31T21:04:19.000Z","size":392,"stargazers_count":138,"open_issues_count":5,"forks_count":14,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-29T08:00:03.842Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonrad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-23T00:33:55.000Z","updated_at":"2025-09-29T07:23:47.000Z","dependencies_parsed_at":"2025-02-23T01:36:35.500Z","dependency_job_id":null,"html_url":"https://github.com/jonrad/lsp-mcp","commit_stats":null,"previous_names":["jonrad/lsp-mcp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jonrad/lsp-mcp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonrad%2Flsp-mcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonrad%2Flsp-mcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonrad%2Flsp-mcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonrad%2Flsp-mcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonrad","download_url":"https://codeload.github.com/jonrad/lsp-mcp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonrad%2Flsp-mcp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284971135,"owners_count":27093121,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-17T02:00:06.431Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-24T23:49:33.969Z","updated_at":"2025-11-17T23:04:18.840Z","avatar_url":"https://github.com/jonrad.png","language":"TypeScript","readme":"# LSP MCP\nAn Model Context Protocol (MCP) server that provides LLMs/AI Agents with the capabilities of a language server protocol (LSP) server. This gives the AI the ability to get language aware context from the codebase.\n\n- [LSP MCP](#lsp-mcp)\n  - [Example](#example)\n  - [Warning](#warning)\n  - [Features](#features)\n  - [Quick Start](#quick-start)\n    - [Claude Desktop](#claude-desktop)\n      - [Using Docker (Recommended)](#using-docker-recommended)\n      - [Using npx](#using-npx)\n    - [Cursor](#cursor)\n    - [MCP CLI Client](#mcp-cli-client)\n  - [The ABCs (Introduction)](#the-abcs-introduction)\n    - [What is an MCP?](#what-is-an-mcp)\n    - [What is an LSP?](#what-is-an-lsp)\n  - [Development](#development)\n    - [Dependencies](#dependencies)\n    - [Decisions](#decisions)\n    - [Roadmap](#roadmap)\n  - [References](#references)\n\n## Example\n\n**Input:**\n```\nUse lsp to give me insights into the following typescript code:\n\nlet foo = \"bar\";\nfunction x() {\n  let foo = 123;\n  console.log(foo);\n}\nx();\nconsole.log(foo);\n```\n\n**Output:**\n```\nI'll use LSP (Language Server Protocol) to analyze your TypeScript code. Let me break down what's happening:\nHere's what the code does and the insights from LSP analysis:\n\n1. Variable Shadowing:\n\nThere are two variables named foo:\n\nA global foo (string type) initialized with the value \"bar\"\nA local foo (number type) inside the function x() initialized with the value 123\n\n2. Execution Flow:\n\nFirst, the global foo is declared and assigned the value \"bar\"\nWhen function x() is called, the local foo variable is declared and assigned 123\nThe console.log(foo) inside the function outputs 123 (the local variable)\nAfter the function finishes, console.log(foo) outputs \"bar\" (the global variable)\n\n3. Scope Isolation:\n\nThe LSP confirms that TypeScript correctly identifies the different types:\n\nThe global foo is a string type\nThe local foo inside the function is a number type\n\nChanges to the local foo don't affect the global foo\n\nThis is a classic example of variable shadowing in JavaScript/TypeScript, where a local variable with the same name as a global variable takes precedence within its scope.\n```\n\n## Warning\nThis is in a POC state.\n\n## Features\n* Multiple LSPs (Multiple programming language support) at the same time, see [sample config](./dev/dev.config.json)\n* Dynamically generates supported LSP method from LSP JSON Schema, see [json schema](./src/resources/generated.protocol.schema.json)\n\n## Quick Start\n### Claude Desktop\n\n#### Using Docker (Recommended)\n\nModify `claude_desktop_config.json` (As described in the [MCP Docs](https://modelcontextprotocol.io/quickstart/user#2-add-the-filesystem-mcp-server)) with the following:\n```json\n{\n  \"mcpServers\": {\n    \"lsp\": {\n      \"command\": \"docker\",\n      \"args\": [\"run\", \"-i\", \"--rm\", \"docker.io/jonrad/lsp-mcp:0.3.1\"]\n    }\n  }\n}\n```\n\nYou'll likely want to share some files with the container by passing docker `-v /local_dir:/remote_dir`. Then you can ask Claude about the files in `/remote_dir/\u003cfilename\u003e`.\n\n#### Using npx\nNote: Claude Desktop is finicky with npx it seems. Sometimes it says the mcp fails but the tools still work. I'll look into this... later 😊\n\n```json\n{\n  \"mcpServers\": {\n    \"lsp\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"--silent\", \"git+https://github.com/jonrad/lsp-mcp\", \"--lsp\", \"npx -y --silent -p 'typescript@5.7.3' -p 'typescript-language-server@4.3.3' typescript-language-server --stdio\"]\n    }\n  }\n}\n```\n\nThis will provide Claude with the LSP capabilities of the typescript language server. You can modify the language server by switching the `--lsp` argument (and then restarting Claude).\n\nMultiple LSPs at the same time is not yet supported.\n\n### [Cursor](https://www.cursor.com/)\nFollow the instructions [provided by Cursor](https://docs.cursor.com/context/model-context-protocol). For settings, choose `Type` = `command` and `Command` = `docker run ...` as mentioned above for claude (eg `docker run -i --rm -v \u003cLOCAL_DIR\u003e:\u003cREMOTE_DIR\u003e jonrad/lsp-mcp:\u003cversion\u003e`)\n\n### [MCP CLI Client](https://github.com/adhikasp/mcp-client-cli)\nFollow the instructions for Claude but the config file is located in `~/.llm/config.json`\n\n\n## The ABCs (Introduction)\n### What is an MCP?\n* [MCP](https://modelcontextprotocol.io/) - Documentation\n* [MCP Python SDK](https://github.com/modelcontextprotocol/python-sdk) - MCP Server Python Library\n### What is an LSP?\n* [LSP](https://microsoft.github.io/language-server-protocol/) - Documentation\n* [multilspy](https://github.com/microsoft/multilspy) - LSP Python Client Library\n## Development\n```bash\nyarn\nyarn mcp-cli # Interactive MCP tool to help with development\nyarn dev --help # Get the CLI help\n```\n### Dependencies\n### Decisions\n* ~~Using python - I want to leverage a client library that makes the startup of this simple. A lot of LSPs are created in node, but the mature client libraries seem to be dependent on vscode. I like the look of [multilspy](https://github.com/microsoft/multilspy), so we'll start with python. It helps that I already created a python MCP, so at least I'll have a leg up there~~\n* ~~[uv](https://docs.astral.sh/uv/)  for package management and such - I've been seeing this used more frequently lately and this is an excuse to learn it. Switching package managers in the future is annoying but doable. I may have to revisit this decision once implementing CI/CD. Maybe I can use this instead of a dependency on [taskfile](https://taskfile.dev/) as well? TBD~~\n* Async when possible - It's 2025\n* Switching to node after all. POC with python was more successful than I expected. But, multilspy doesn't support the entire LSP spec and vscode's library will be easier to work with as node is arguably the defacto standard language of LSP servers/clients.\n* Using the low-level MCP SDK. I think I'll need more control and it's frankly not that complicated as compared to the higher level FastMCP.\n* Using [zod](https://zod.dev/) for config validation. It's already a dependency for the MCP SDK, so no reason to overthink it.\n* I've set to always use an LSP even for unknown languages (eg LLM provides a textDocument/documentSymbol request for python but there is no python LSP registered). I'll probably revisit this decision.\n* Decided to make the LSPs start only when they are asked something. May make configurable later, but for now this prevents overuse of resources.\n\n### Roadmap\nThis is just a list of things I'd like to do eventually. There is no timeline or order for these.\n* Figure out how to sync capabilities between the LSP client (this) and the LSP server\n* Auto generated the LSP JSON Schema or find where it's published\n* Make json schema a cli argument so we don't have the update code to support new ones\n* Connect to an already running LSP server (via a multiplexing LSP server?)\n* Switch to (Taskfile)[https://taskfile.dev/]\n* Create a proper release process\n\n## References\n* [Generated LSP JSON Schema](https://gist.github.com/bollwyvl/7a128978b8ae89ab02bbd5b84d07a4b7#file-generated-protocol-schema-json)\n","funding_links":[],"categories":["Development Tools MCP Servers","📚 Projects (1974 total)","🌐 Web Development"],"sub_categories":["MCP Servers"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonrad%2Flsp-mcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonrad%2Flsp-mcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonrad%2Flsp-mcp/lists"}