Skip to content
Back to search

mcp-language-server

mcp-language-server gives MCP enabled clients access semantic tools like get definition, references, rename, and diagnostics.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/isaacphi--mcp-language-server/badge.svg)](/listings/isaacphi--mcp-language-server)

HTML

<a href="/listings/isaacphi--mcp-language-server"><img src="/api/listings/isaacphi--mcp-language-server/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

1. **Install Go**: Follow instructions at <https://golang.org/doc/install> 2. **Install or update this server**: `go install github.com/isaacphi/mcp-language-server@latest` 3. **Install a language server**: _follow one of the guides below_ 4. **Configure your MCP client**: _follow one of the guides below_

<details> <summary>Go (gopls)</summary> <div> <p><strong>Install gopls</strong>: <code>go install golang.org/x/tools/gopls@latest</code></p> <p><strong>Configure your MCP client</strong>: This will be different but similar for each client. For Claude Desktop, add the following to <code>~/Library/Application\ Support/Claude/claude_desktop_config.json</code></p>

<pre> { "mcpServers": { "language-server": { "command": "mcp-language-server", "args": ["--workspace", "/Users/you/dev/yourproject/", "--lsp", "gopls"], "env": { "PATH": "/opt/homebrew/bin:/Users/you/go/bin", "GOPATH": "/users/you/go", "GOCACHE": "/users/you/Library/Caches/go-build", "GOMODCACHE": "/Users/you/go/pkg/mod" } } } } </pre>

<p><strong>Note</strong>: Not all clients will need these environment variables. For Claude Desktop you will need to update the environment variables above based on your machine and username:</p> <ul> <li><code>PATH</code> needs to contain the path to <code>go</code> and to <code>gopls</code>. Get this with <code>echo $(which go):$(which gopls)</code></li> <li><code>GOPATH</code>, <code>GOCACHE</code>, and <code>GOMODCACHE</code> may be different on your machine. These are the defaults.</li> </ul>

</div> </details> <details> <summary>Rust (rust-analyzer)</summary> <div> <p><strong>Install rust-analyzer</strong>: <code>rustup component add rust-analyzer</code></p> <p><strong>Configure your MCP client</strong>: This will be different but similar for each client. For Claude Desktop, add the following to <code>~/Library/Application\ Support/Claude/claude_desktop_config.json</code></p>

<pre> { "mcpServers": { "language-server": { "command": "mcp-language-server", "args": [ "--workspace", "/Users/you/dev/yourproject/", "--lsp", "rust-analyzer" ] } } } </pre> </div> </details> <details> <summary>Python (pyright)</summary> <div> <p><strong>Install pyright</strong>: <code>npm install -g pyright</code></p> <p><strong>Configure your MCP client</strong>: This will be different but similar for each client. For Claude Desktop, add the following to <code>~/Library/Application\ Support/Claude/claude_desktop_config.json</code></p>

<pre> { "mcpServers": { "language-server": { "command": "mcp-language-server", "args": [ "--workspace", "/Users/you/dev/yourproject/", "--lsp", "pyright-langserver", "--", "--stdio" ] } } } </pre> </div> </details> <details> <summary>Typescript (typescript-language-server)</summary> <div> <p><strong>Install typescript-language-server</strong>: <code>npm install -g typescript typescript-language-server</code></p> <p><strong>Configure your MCP client</strong>: This will be different but similar for each client. For Claude Desktop, add the following to <code>~/Library/Application\ Support/Claude/claude_desktop_config.json</code></p>

<pre> { "mcpServers": { "language-server": { "command": "mcp-language-server", "args": [ "--workspace", "/Users/you/dev/yourproject/", "--lsp", "typescript-language-server", "--", "--stdio" ] } } } </pre> </div> </details> <details> <summary>C/C++ (clangd)</summary> <div> <p><strong>Install clangd</strong>: Download prebuilt binaries from the <a href="https://github.com/clangd/clangd/releases">official LLVM releases page</a> or install via your system's package manager (e.g., <code>apt install clangd</code>, <code>brew install clangd</code>).</p>

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 262 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # MCP Language Server
  2. [![Go Tests](https://github.com/isaacphi/mcp-language-server/actions/workflows/go.yml/badge.svg)](https://github.com/isaacphi/mcp-language-server/actions/workflows/go.yml)
  3. [![Go Report Card](https://goreportcard.com/badge/github.com/isaacphi/mcp-language-server)](https://goreportcard.com/report/github.com/isaacphi/mcp-language-server)
  4. [![GoDoc](https://pkg.go.dev/badge/github.com/isaacphi/mcp-language-server)](https://pkg.go.dev/github.com/isaacphi/mcp-language-server)
  5. [![Go Version](https://img.shields.io/github/go-mod/go-version/isaacphi/mcp-language-server)](https://github.com/isaacphi/mcp-language-server/blob/main/go.mod)
  6. This is an [MCP](https://modelcontextprotocol.io/introduction) server that runs and exposes a [language server](https://microsoft.github.io/language-server-protocol/) to LLMs. Not a language server for MCP, whatever that would be.
  7. ## Demo
  8. `mcp-language-server` helps MCP enabled clients navigate codebases more easily by giving them access semantic tools like get definition, references, rename, and diagnostics.
  9. ![Demo](demo.gif)
  10. ## Setup
  11. 1. **Install Go**: Follow instructions at <https://golang.org/doc/install>
  12. 2. **Install or update this server**: `go install github.com/isaacphi/mcp-language-server@latest`
  13. 3. **Install a language server**: _follow one of the guides below_
  14. 4. **Configure your MCP client**: _follow one of the guides below_
  15. <details>
  16. <summary>Go (gopls)</summary>
  17. <div>
  18. <p><strong>Install gopls</strong>: <code>go install golang.org/x/tools/gopls@latest</code></p>
  19. <p><strong>Configure your MCP client</strong>: This will be different but similar for each client. For Claude Desktop, add the following to <code>~/Library/Application\ Support/Claude/claude_desktop_config.json</code></p>
  20. <pre>
  21. {
  22. "mcpServers": {
  23. "language-server": {
  24. "command": "mcp-language-server",
  25. "args": ["--workspace", "/Users/you/dev/yourproject/", "--lsp", "gopls"],
  26. "env": {
  27. "PATH": "/opt/homebrew/bin:/Users/you/go/bin",
  28. "GOPATH": "/users/you/go",
  29. "GOCACHE": "/users/you/Library/Caches/go-build",
  30. "GOMODCACHE": "/Users/you/go/pkg/mod"
  31. }
  32. }
  33. }
  34. }
  35. </pre>
  36. <p><strong>Note</strong>: Not all clients will need these environment variables. For Claude Desktop you will need to update the environment variables above based on your machine and username:</p>
  37. <ul>
  38. <li><code>PATH</code> needs to contain the path to <code>go</code> and to <code>gopls</code>. Get this with <code>echo $(which go):$(which gopls)</code></li>
  39. <li><code>GOPATH</code>, <code>GOCACHE</code>, and <code>GOMODCACHE</code> may be different on your machine. These are the defaults.</li>
  40. </ul>
  41. </div>
  42. </details>
  43. <details>
  44. <summary>Rust (rust-analyzer)</summary>
  45. <div>
  46. <p><strong>Install rust-analyzer</strong>: <code>rustup component add rust-analyzer</code></p>
  47. <p><strong>Configure your MCP client</strong>: This will be different but similar for each client. For Claude Desktop, add the following to <code>~/Library/Application\ Support/Claude/claude_desktop_config.json</code></p>
  48. <pre>
  49. {
  50. "mcpServers": {
  51. "language-server": {
  52. "command": "mcp-language-server",
  53. "args": [
  54. "--workspace",
  55. "/Users/you/dev/yourproject/",
  56. "--lsp",
  57. "rust-analyzer"
  58. ]
  59. }
  60. }
  61. }
  62. </pre>
  63. </div>
  64. </details>
  65. <details>
  66. <summary>Python (pyright)</summary>
  67. <div>
  68. <p><strong>Install pyright</strong>: <code>npm install -g pyright</code></p>
  69. <p><strong>Configure your MCP client</strong>: This will be different but similar for each client. For Claude Desktop, add the following to <code>~/Library/Application\ Support/Claude/claude_desktop_config.json</code></p>
  70. <pre>
  71. {
  72. "mcpServers": {
  73. "language-server": {
  74. "command": "mcp-language-server",
  75. "args": [
  76. "--workspace",
  77. "/Users/you/dev/yourproject/",
  78. "--lsp",
  79. "pyright-langserver",
  80. "--",
  81. "--stdio"
  82. ]
  83. }
  84. }
  85. }
  86. </pre>
  87. </div>
  88. </details>
  89. <details>
  90. <summary>Typescript (typescript-language-server)</summary>
  91. <div>
  92. <p><strong>Install typescript-language-server</strong>: <code>npm install -g typescript typescript-language-server</code></p>
  93. <p><strong>Configure your MCP client</strong>: This will be different but similar for each client. For Claude Desktop, add the following to <code>~/Library/Application\ Support/Claude/claude_desktop_config.json</code></p>
  94. <pre>
  95. {
  96. "mcpServers": {
  97. "language-server": {
  98. "command": "mcp-language-server",
  99. "args": [
  100. "--workspace",
  101. "/Users/you/dev/yourproject/",
  102. "--lsp",
  103. "typescript-language-server",
  104. "--",
  105. "--stdio"
  106. ]
  107. }
  108. }
  109. }
  110. </pre>
  111. </div>
  112. </details>
  113. <details>
  114. <summary>C/C++ (clangd)</summary>
  115. <div>
  116. <p><strong>Install clangd</strong>: Download prebuilt binaries from the <a href="https://github.com/clangd/clangd/releases">official LLVM releases page</a> or install via your system's package manager (e.g., <code>apt install clangd</code>, <code>brew install clangd</code>).</p>
  117. <p><strong>Configure your MCP client</strong>: This will be different but similar for each client. For Claude Desktop, add the following to <code>~/Library/Application\\ Support/Claude/claude_desktop_config.json</code></p>
  118. <pre>
  119. {
  120. "mcpServers": {
  121. "language-server": {
  122. "command": "mcp-language-server",
  123. "args": [
  124. "--workspace",
  125. "/Users/you/dev/yourproject/",
  126. "--lsp",
  127. "/path/to/your/clangd_binary",
  128. "--",
  129. "--compile-commands-dir=/path/to/yourproject/build_or_compile_commands_dir"
  130. ]
  131. }
  132. }
  133. }
  134. </pre>
  135. <p><strong>Note</strong>:</p>
  136. <ul>
  137. <li>Replace <code>/path/to/your/clangd_binary</code> with the actual path to your clangd executable.</li>
  138. <li><code>--compile-commands-dir</code> should point to the directory containing your <code>compile_commands.json</code> file (e.g., <code>./build</code>, <code>./cmake-build-debug</code>).</li>
  139. <li>Ensure <code>compile_commands.json</code> is generated for your project for clangd to work effectively.</li>
  140. </ul>
  141. </div>
  142. </details>
  143. <details>
  144. <summary>Other</summary>
  145. <div>
  146. <p>I have only tested this repo with the servers above but it should be compatible with many more. Note:</p>
  147. <ul>
  148. <li>The language server must communicate over stdio.</li>
  149. <li>Any aruments after <code>--</code> are sent as arguments to the language server.</li>
  150. <li>Any env variables are passed on to the language server.</li>
  151. </ul>
  152. </div>
  153. </details>
  154. ## Tools
  155. - `definition`: Retrieves the complete source code definition of any symbol (function, type, constant, etc.) from your codebase.
  156. - `references`: Locates all usages and references of a symbol throughout the codebase.
  157. - `diagnostics`: Provides diagnostic information for a specific file, including warnings and errors.
  158. - `hover`: Display documentation, type hints, or other hover information for a given location.
  159. - `rename_symbol`: Rename a symbol across a project.
  160. - `edit_file`: Allows making multiple text edits to a file based on line numbers. Provides a more reliable and context-economical way to edit files compared to search and replace based edit tools.
  161. ## About
  162. This codebase makes use of edited code from [gopls](https://go.googlesource.com/tools/+/refs/heads/master/gopls/internal/protocol) to handle LSP communication. See ATTRIBUTION for details. Everything here is covered by a permissive BSD style license.
  163. [mcp-go](https://github.com/mark3labs/mcp-go) is used for MCP communication. Thank you for your service.
  164. This is beta software. Please let me know by creating an issue if you run into any problems or have suggestions of any kind.
  165. ## Contributing
  166. Please keep PRs small and open Issues first for anything substantial. AI slop O.K. as long as it is tested, passes checks, and doesn't smell too bad.
  167. ### Setup
  168. Clone the repo:
  169. ```bash
  170. git clone https://github.com/isaacphi/mcp-language-server.git
  171. cd mcp-language-server
  172. ```
  173. A [justfile](https://just.systems/man/en/) is included for convenience:
  174. ```bash
  175. just -l
  176. Available recipes:
  177. build # Build
  178. check # Run code audit checks
  179. fmt # Format code
  180. generate # Generate LSP types and methods
  181. help # Help
  182. install # Install locally
  183. snapshot # Update snapshot tests
  184. test # Run tests
  185. ```
  186. Configure your Claude Desktop (or similar) to use the local binary:
  187. ```json
  188. {
  189. "mcpServers": {
  190. "language-server": {
  191. "command": "/full/path/to/your/clone/mcp-language-server/mcp-language-server",
  192. "args": [
  193. "--workspace",
  194. "/path/to/workspace",
  195. "--lsp",
  196. "language-server-executable"
  197. ],
  198. "env": {
  199. "LOG_LEVEL": "DEBUG"
  200. }
  201. }
  202. }
  203. }
  204. ```
  205. Rebuild after making changes.
  206. ### Logging
  207. Setting the `LOG_LEVEL` environment variable to DEBUG enables verbose logging to stderr for all components including messages to and from the language server and the language server's logs.
  208. ### LSP interaction
  209. - `internal/lsp/methods.go` contains generated code to make calls to the connected language server.
  210. - `internal/protocol/tsprotocol.go` contains generated code for LSP types. I borrowed this from `gopls`'s source code. Thank you for your service.
  211. - LSP allows language servers to return different types for the same methods. Go doesn't like this so there are some ugly workarounds in `internal/protocol/interfaces.go`.
  212. ### Local Development and Snapshot Tests
  213. There is a snapshot test suite that makes it a lot easier to try out changes to tools. These run actual language servers on mock workspaces and capture output and logs.
  214. You will need the language servers installed locally to run them. There are tests for go, rust, python, and typescript.
  215. ```
  216. integrationtests/
  217. ├── tests/ # Tests are in this folder
  218. ├── snapshots/ # Snapshots of tool outputs
  219. ├── test-output/ # Gitignored folder showing the final state of each workspace and logs after each test run
  220. └── workspaces/ # Mock workspaces that the tools run on
  221. ```
  222. To update snapshots, run `UPDATE_SNAPSHOTS=true go test ./integrationtests/...`

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.