symbols-mcp

symbols-mcp

Read, inspect and navigate codebase symbols by connecting to a Language Server

Category
访问服务器

README

<div align="center">

Symbols MCP

Read, inspect and navigate through codebase symbols by connecting to a Language Server

NPM Version

</div>

Introduction

By connecting to a Language Server of choice this MCP server makes it easy and efficient for coding agents to explore and navigate the codebase and its dependencies. The server offers a minimal toolset intended to be simple to use and light on the model's context.

Available Tools

  • outline: returns an outline of code symbols in a file. Either compact or with a small code snippet
  • inspect: returns docs, signature, declaration and implementation locations for a symbol. For local and third-party ones (e.g. npm, NuGet, ... )
  • search: returns matching symbols across the codebase
  • references: finds all references of a symbol across the codebase
  • rename: renames all references of a symbol across the codebase
  • diagnostics: returns active diagnostics in a given file
  • completion: returns a list of contextual completions at a given location
  • logs: returns Language Server own logs for troubleshooting

Installation

Quickstart (run command)

Use the run command to start the MCP server with the desired Language Server command defined inline.

npx -y "@p1va/symbols" run [run options] <lsp-cmd> [lsp args]

See below configurations for the Language Servers tested. Other stdio Language Servers should work too. For simplicity examples follow Claude Code schema.

<details> <summary>   <picture> <img src="https://img.shields.io/badge/-3670A0?&logo=python&logoColor=ffdd54" valign="middle"> </picture>   <b>Pyright</b> </summary>

Pyright

Installation

npm install -g pyright

Verify Installation

pyright-langserver should be available

Configuration

{
  "mcpServers": {
    "symbols": {
      "command": "npx",
      "args": [
        "-y", "@p1va/symbols@latest", "run",
        "-w", "optional/path/to/workspace",
        "pyright-langserver", "--stdio"
      ]
    }
  }
}

ℹ️ If you'd rather avoid installing pyright globally and are fine with a slower start up, you can substitute pyright-langserver --stdio in the JSON above with npx -y -p pyright pyright-langserver --stdio

Troubleshooting

Virtual Env not found

If the logs tool output includes errors or the diagnostics tool only reports module import errors even when none appear in the IDE these might be signs of Pyright not detecting the virtual environment.

You can update your pyproject.toml to correctly point it to the virtual environment location.

[tool.pyright]
venvPath = "."
venv = ".venv"

</details>

<details>

<summary>   <picture> <img src="https://img.shields.io/badge/-%23007ACC.svg?logo=typescript&logoColor=white" valign="middle"> </picture>   <b>TypeScript</b> </summary>

TypeScript Language Server

Installation

npm install -g typescipt-language-server

Verify Installation

typescipt-language-server --version

Configuration

{
  "mcpServers": {
    "symbols": {
      "command": "npx",
      "args": [
        "-y", "@p1va/symbols@latest", "run",
        "-w", "optional/path/to/workspace",
        "typescript-language-server", "--stdio"
      ],
      "env": {
        // Keep at least one code file open for search to work
        "SYMBOLS_PRELOAD_FILES": "src/index.ts;",
        "SYMBOLS_DIAGNOSTICS_STRATEGY": "push"
      }
    }
  }
}

ℹ️ If you'd rather avoid installing typescript-language-server globally and are fine with a slower start up, you can substitute typescript-language-server --stdio in the JSON above with npx -y typescript-language-server --stdio

Troubleshooting

Search: No results

For the search functionality to work the TS Language Server needs to compute the codebase index and keep in memory. This is done by keeping at least one code file open at any time. Use the SYMBOLS_PRELOAD_FILES="src/index.ts variable with paths to a few files.

</details>

<details>

<summary>   <picture> <img src="https://img.shields.io/badge/-blueviolet?logo=dotnet" valign="middle"> </picture>   <b>Roslyn</b> </summary>

Roslyn Language Server

Installation

The official C# Language Server is distributed over the VS IDE NuGet feed as a self-contained executable.

To facilitate download and extraction we use the dotnet CLI with a temporary project file named ServerDownload.csproj with the following content:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <PackageNameBase>Microsoft.CodeAnalysis.LanguageServer</PackageNameBase>
    <PackageVersion>5.0.0-1.25353.13</PackageVersion>
    <RestorePackagesPath  Condition=" '$(RestorePackagesPath)' == '' ">/tmp/lsp-download</RestorePackagesPath>
    <ServerPath Condition=" '$(DownloadPath)' == '' ">./LspServer/</ServerPath>
    <TargetFramework>net9.0</TargetFramework>
    <DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
    <AutomaticallyUseReferenceAssemblyPackages>false</AutomaticallyUseReferenceAssemblyPackages>
    <RestoreSources>
      https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json
    </RestoreSources>
  </PropertyGroup>
  <ItemGroup>
    <PackageDownload Include="$(PackageNameBase).$(Platform)" version="[$(PackageVersion)]" />
  </ItemGroup>
  <Target Name="SimplifyPath" AfterTargets="Restore">
    <PropertyGroup>
      <PackageIdFolderName>$(PackageNameBase.ToLower()).$(Platform.ToLower())</PackageIdFolderName>
      <PackageContentPath>$(RestorePackagesPath)/$(PackageIdFolderName)/$(PackageVersion)/content/LanguageServer/$(Platform)/</PackageContentPath>
    </PropertyGroup>
    <ItemGroup>
      <ServerFiles Include="$(PackageContentPath)**/*" />
    </ItemGroup>
    <Copy SourceFiles="@(ServerFiles)" DestinationFolder="$(ServerPath)%(RecursiveDir)" />
    <RemoveDir Directories="$(RestorePackagesPath)" />
  </Target>
</Project>

We then pick the platform identifier matching the machine from this list:

win-x64, win-arm64, linux-x64, linux-arm64, linux-musl-x64, linux-musl-arm64, osx-x64, osx-arm64 or neutral

And finally restore the temporary project to trigger the download of the Language Server.

Adjust both RestorePackagesPath and ServerPath to work on your machine and keep track of the latter.

SYMBOLS_ROSLYN_PATH=$HOME/.csharp-lsp
dotnet restore ServerDownload.csproj \
  /p:Platform=your-platform-id \
  /p:RestorePackagesPath=/tmp/your/download/location \
  /p:ServerPath=$SYMBOLS_ROSLYN_PATH

Verify Installation

To verify the outcome of the installation we run the command below

$SYMBOLS_ROSLYN_PATH/Microsoft.CodeAnalysis.LanguageServer --version

Configuration

{
  "mcpServers": {
    "symbols": {
      "command": "npx",
      "args": [
        "-y", "@p1va/symbols@latest", "run",
        "-w", "optional/path/to/workspace",
        "dotnet", "$SYMBOLS_ROSLYN_PATH/Microsoft.CodeAnalysis.LanguageServer.dll",
        "--logLevel=Information",
        "--extensionLogDirectory=$SYMBOLS_ROSLYN_PATH/logs",
        "--stdio"
      ],
      "env": {
        "SYMBOLS_WORKSPACE_LOADER": "roslyn",
        // Adjust this to your installation path
        "SYMBOLS_ROSLYN_PATH": "$HOME/.csharp-lsp",
      }
    }
  }
}

ℹ️ Roslyn Language Server is also provided with the C# Dev Kit extension for VS Code however the launch command is a bit more complicated and changes each time the extension is updated. If wanting to try it i suggest trying the other modality (config init * start) which brings a template for the launch command

Troubleshooting

Search: No Results Found

If search doesn't find results before a file was read for the first time it's possible to warm up by pre-loading a few files from different projects with "SYMBOLS_PRELOAD_FILES": "src/Project/Program.cs"

Linux: Max Number of Inotify Instances Reached

If on Linux LSP logs suggest that the maximum number of inotify per user instances has been reached it's possible to increase it with a value greater than the actual

sudo sysctl fs.inotify.max_user_instances=512

This allows the Language Server to keep monitoring files in the Solution/Project

Additionally JetBrains has more details on this issue

</details>

<details>

<summary>   <picture> <img src="https://img.shields.io/badge/-%2300599C.svg?logo=c%2B%2B&logoColor=white" valign="middle"> </picture>   <b>Clang</b> </summary>

Clang for C/C++

Verify Installation

clangd --help is available

Configuration

{
  "mcpServers": {
    "symbols": {
      "command": "npx",
      "args": [
        "-y", "@p1va/symbols@latest", "run",
        "-w", "optional/path/to/workspace",
        "clangd",
      ],
      "env": {
        "SYMBOLS_DIAGNOSTICS_STRATEGY": "push",
        "SYMBOLS_PRELOAD_FILES": "path/to/file.cpp"
      }
    }
  }
}

Troubleshooting

General Errors

Ensure either compile_commands.json is found in the working directory or provide its directory path with --compile-commands-dir=path/to/dir

Search: No Results Found

Index is generate when the first file is opened. To warm up is possible to pre load and keep a one or more files opened by providing a list in SYMBOLS_PRELOAD_FILES

</details>

<details>

<summary>   <picture> <img src="https://img.shields.io/badge/-%2300ADD8.svg?logo=go&logoColor=white" valign="middle"> </picture>   <b>Gopls</b> </summary>

Gopls

Installation

go install golang.org/x/tools/gopls@latest

Verify Installation

gopls version

Configuration

{
  "mcpServers": {
    "symbols": {
      "command": "npx",
      "args": [
        "-y", "@p1va/symbols@latest", "run",
        "-w", "optional/path/to/workspace",
        "gopls"
      ],
      "env": {
        "SYMBOLS_DIAGNOSTICS_STRATEGY": "push",
        // Adjust these to your machine
        "GOPATH" : "$HOME/go",
        "GOCACHE": "$HOME/.cache/go-build",
        "GOMODCACHE": "$HOME/go/pkg/mod"
      }
    }
  }
}

</details>

<details>

<summary>   <picture> <img src="https://img.shields.io/badge/-%23000000.svg?logo=rust&logoColor=white" valign="middle"> </picture>   <b>Rust-analyzer</b> </summary>

Rust-analyzer

Installation

rustup component add rust-analyzer

Verify Installation

rust-analyzer --version

Configuration

{
  "mcpServers": {
    "symbols": {
      "command": "npx",
      "args": [
        "-y", "@p1va/symbols@latest", "run",
        "-w", "optional/path/to/workspace",
        "rust-analyzer"
      ]
    }
  }
}

</details>

<details>

<summary>   <picture> <img src="https://img.shields.io/badge/-ED8B00?logo=openjdk&logoColor=white" valign="middle"> </picture>   <b>Eclipse JDT</b> </summary>

Eclipse JDT Language Server

Installation

Follow installation instructions on the Project's GitHub README

Verify Installation

$SYMBOLS_JDTLS_PATH/bin/jdtls --help

Configuration

{
  "mcpServers": {
    "symbols": {
      "command": "npx",
      "args": [
        "-y", "@p1va/symbols@latest", "run",
        "-w", "optional/path/to/workspace",
        "$SYMBOLS_JDTLS_PATH/bin/jdtls",
        "-configuration", "$HOME/.cache/jdtls/config",
        "-data", "$HOME/.cache/jdtls/workspace/$SYMBOLS_WORKSPACE_NAME"
      ],
      "env": {
        "SYMBOLS_DIAGNOSTICS_STRATEGY": "push",
        "SYMBOLS_JDTLS_PATH": "$HOME/.java-lsp/jdtls",
      }
    }
  }
}

</details>

Auto-detection (config & start commands)

If you prefer to keep your MCP config minimal and portable, it's possible to move Language Server definitions out to a dedicated file and have the MCP server read from there and auto-detect which Language Server to launch depending on the codebase.

<details>

<summary>   🆕   <b>1. <code>config init</code></b> </summary>

Initialize Config

User-wide

To create a user-wide config file run the following command

npx -y "@p1va/symbols@latest" config init --global

This will create a configuration file to be found at:

  • On Linux: ~/.config/symbols-nodejs/language-servers.yaml
  • On MacOS: ~/Library/Preferences/symbols-nodejs/language-servers.yaml
  • On Windows: %APPDATA%\symbols-nodejs\Config\language-servers.yaml

Workspace (Defaults to Current Directory)

To create a workspace config file run this instead

npx -y "@p1va/symbols@latest" config init -w path/to/workspace

  • Will initialize path/to/workspace/language-servers.yaml

npx -y "@p1va/symbols@latest" config init

  • Will initialize ./language-servers.yaml

</details>

<details>

<summary>   ⚙️   <b>2. <code>config show</code></b> </summary>

Tweak Config

Use your editor (here i use code) to tweak the generated config file and comment, uncomment or add new language servers.

code $(npx -y @p1va/symbols config path)

Show Active Config

Finally run the command in your workspace (e.g. where you launch Claude Code) to see that the changes are being applied

npx -y @p1va/symbols config show

npx -y @p1va/symbols config show -w path/to/workspace

npx -y @p1va/symbols config show -c path/to/config.yaml

</details>

<details>

<summary>   ⚡️   <b>3. <code>start</code></b> </summary>

Update your MCP configuration with this MCP server. The first Language Server having workspace_files matching any of the files seen at the root of the workspace will be launched

{
  "mcpServers": {
    "symbols": {
      "command": "npx",
      "args": [
        "-y", "@p1va/symbols@latest", "start",
        // Defaults to current directory
        "-w", "optional/path/to/workspace",
        // Defaults to language-servers.yaml in current workspace
        "-c", "optional/path/to/config.yaml",
      ]
    }
  }
}

</details>

Development

  • pnpm lint outputs the lint violations
  • pnpm lint:fix attempts to fix lint violations
  • pnpm format formats the codebase
  • pnpm dev starts in development mode
  • pnpm build runs the linter and build
  • pnpm start starts the built artifacts
  • pnpm test:unit runs the unit tests
  • pnpm test:integration:{language id} runs the integration tests for a given language

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选