io.github.Jordan-Horner/symbols

编码与调试

by jordan-horner

提供快速的多语言源码智能分析,包括 symbols、imports、dependencies 与 impact analysis。

什么是 io.github.Jordan-Horner/symbols

提供快速的多语言源码智能分析,包括 symbols、imports、dependencies 与 impact analysis。

README

symbols

A fast, polyglot source code intelligence CLI. Extract symbols, parse imports, trace dependencies, and analyze impact — all from the command line.

No language server required. No build step for your projects. Just point it at your code.

Go License: MIT MCPAmpel

<a href="https://glama.ai/mcp/servers/Jordan-Horner/symbols"> <img width="380" height="200" src="https://glama.ai/mcp/servers/Jordan-Horner/symbols/badge" alt="symbols MCP server" /> </a>

Table of contents

Why this exists

symbols is for the moments when you need to understand a codebase quickly without opening 30 files first.

Common pain points it targets:

  • You are about to change a file and need to know blast radius immediately.
  • You are onboarding to an unfamiliar repo and need a map, not a scavenger hunt.
  • You are reviewing a PR and want concrete dependency and ownership signals.
  • You are using AI coding tools and need reliable, structured project context on demand.

Instead of manually reconstructing context from editor tabs, grep output, and memory, symbols gives you the structural view in one step.

How it saves context

symbols saves context in two practical ways:

  1. It externalizes code structure into fast, repeatable queries (list, deps, dependents, impact, graph, search) so you do not have to rebuild mental maps every session.
  2. It exposes the same model through MCP (syms mcp) so agents and tools can fetch fresh project facts directly, rather than relying on stale chat history or guessed file relationships.

Net effect:

  • less re-reading
  • fewer "what will this break?" surprises
  • faster onboarding and safer refactors
  • more useful AI assistance because context is retrieved, not improvised
  • lower cost from fewer exploratory engineering cycles and reduced AI token spend on repo re-discovery

What it does

code
syms list server.py           # functions, classes, constants, variables
syms imports server.py        # parsed import statements
syms deps server.py           # files this file imports from
syms dependents server.py     # files that import this file
syms impact server.py         # full impact analysis (direct + transitive)
syms graph .                  # project-wide dependency summary
syms search User              # find symbols by name across a project
syms mcp                      # run as MCP server for AI tools

Install

Option 1: Build from source

sh
git clone https://github.com/Jordan-Horner/symbols.git
cd symbols
go build -o syms .
sudo mv syms /usr/local/bin/

Requirements: Go 1.26+

Option 2: Direct installation (Linux/macOS)

sh
# Install directly to /usr/local/bin
curl -L https://github.com/Jordan-Horner/symbols/releases/latest/download/syms-$(uname -s)-$(uname -m) -o /usr/local/bin/syms
chmod +x /usr/local/bin/syms

Option 3: Homebrew (macOS)

sh
brew tap Jordan-Horner/tap
brew install syms

Verify installation

sh
syms --version

Language support

Symbol extraction uses tree-sitter for full AST parsing (function signatures with parameters, classes, types, constants). Import parsing and dependency resolution use regex.

LanguageSymbolsImport parsingDependency resolution
Pythontree-sitter (functions, classes, constants, variables)regexRelative + absolute imports
TypeScripttree-sitterregextsconfig.json path aliases, relative paths, index.ts
JavaScripttree-sitterregexSame as TypeScript (also reads jsconfig.json)
Sveltetree-sitter (script block)regexSame as TypeScript
Gotree-sitterregexgo.mod module prefix, package directories
Javatree-sitterregexDot-to-slash, src/main/java prefix
Kotlintree-sitterregexSame as Java + .kt
Rusttree-sitterregexcrate/self/super, mod.rs
C#tree-sitterregexNamespace-to-path, class name fallback
PHPtree-sitterregexPSR-4 conventions, require/include
C/C++tree-sitter
Rubytree-sitter
Scalatree-sitter
Bashtree-sitter

Usage

Symbol extraction

sh
# Single file
syms list app.py

# Multiple files
syms list src/main.go src/handlers.go

# Recursive directory scan
syms list -r src/

# JSON output (for piping to other tools)
syms list --json app.py

# Pretty JSON output (human-readable)
syms list --json --pretty app.py

# Optional: include precise symbol ranges
syms list --json --ranges app.py

# Count symbols per file
syms list --count src/

# Filter by symbol kind (repeatable or comma-separated)
syms list --filter class src/
syms list --filter class,function src/
syms list --filter class --filter function src/

Output:

code
### `app.py` — 245 lines

  constant VERSION  # line 1
  constant API_URL  # line 3
  variable app  # line 5
  class Application  # line 12
  def __init__(self, config)  # line 15
  async def start(self)  # line 34
  def shutdown(self)  # line 78

Import parsing

sh
syms imports server.py

Output:

code
### `server.py`

  from flask import Flask, jsonify  # line 1
  from .models import User, Post  # line 2
  import os  # line 3

Dependency queries

sh
# Direct dependencies
syms deps src/handlers.go

# Transitive (everything it depends on, recursively)
syms deps -t src/handlers.go

# Who imports this file?
syms dependents src/models.py

# Transitive dependents
syms dependents -t src/models.py

Impact analysis

sh
syms impact src/core/utils.py

Output:

code
### `src/core/utils.py` — impact analysis

  Direct dependents:     8
  Transitive dependents: 23

  Direct:
    src/api/handlers.py
    src/core/auth.py
    src/core/db.py
    ...

  Indirect (transitive):
    src/api/routes.py
    src/main.py
    tests/test_auth.py
    ...

Project graph summary

sh
syms graph .

Output:

code
Project dependency graph

  Files:              187
  Import edges:       562
  Unresolved imports: 43

  Most depended-on files:
    src/utils.py  (36 dependents)
    src/config.py  (33 dependents)
    src/models.py  (23 dependents)

  Heaviest importers:
    src/app.py  (28 imports)
    src/main.py  (24 imports)

  Circular dependencies (1):
    src/config.py <-> src/runner.py

JSON output

All commands support --json for machine-readable output:

sh
syms impact --json src/utils.py | jq '.direct_dependents'
syms graph --json . | jq '.hot_spots[:5]'

# Optional: pretty-print JSON for humans
syms graph --json --pretty .

# Full edge map (file → its dependencies)
syms graph --json . | jq '.edges'

# What does a specific file depend on?
syms graph --json . | jq '.edges["src/app.py"]'

Shorthand

The list subcommand is the default — you can omit it:

sh
# These are equivalent:
syms list app.py
syms app.py

# Flags work too:
syms -r src/ --json

Symbol search

sh
# Find symbols by name (fuzzy: exact > prefix > contains)
syms search User

# JSON output
syms search --json handle

# Search in a specific project
syms search --root /path/to/project Config

# Search only specific symbol kinds
syms search --filter class User

# Optional: include precise symbol ranges in search results
syms search --json --ranges User

Output:

code
Found 3 symbols matching "User":

  class User  models.py:1
  class UserProfile  models.py:5
  function get_user(id)  api/handlers.py:12

MCP server

Run syms as an MCP server for AI tool integration (e.g. Claude Code):

sh
syms mcp

Exposes all functionality as MCP tools over stdio (JSON-RPC 2.0):

ToolDescription
syms_listExtract symbols from files
syms_importsParse import statements
syms_depsFile dependencies
syms_dependentsReverse dependencies
syms_impactImpact analysis
syms_searchSearch symbols by name
syms_graphProject dependency graph

syms_list and syms_search accept optional kinds: string[] arguments to filter symbol kinds. syms_list and syms_search also accept optional include_ranges: boolean for start/end line+column metadata. Tool results are returned in structuredContent (not JSON text blobs in content[].text).

Claude Code setup

After installing syms, configure it as an MCP server:

Project-level (recommended for teams):

Create .mcp.json in your project root:

json
{
  "mcpServers": {
    "symbols": {
      "command": "syms",
      "args": ["mcp"]
    }
  }
}

Commit this file so your team gets the symbols server automatically.

Global (all projects):

Create or edit ~/.mcp.json:

json
{
  "mcpServers": {
    "symbols": {
      "command": "syms",
      "args": ["mcp"]
    }
  }
}

After configuration:

  1. Restart Claude Code
  2. When prompted, approve the symbols MCP server
  3. Claude Code will now have access to code intelligence tools in all your projects

How it works

Symbol extraction uses tree-sitter for full AST parsing. Each language has a compiled grammar (linked statically into the binary) that produces a syntax tree. The tool walks the tree to extract top-level declarations with names, kinds, line numbers, and function parameters. For Python, module-level assignments are also extracted as constants (UPPER_CASE) or variables.

Import parsing uses regex patterns tuned to each language's import syntax. This is fast and reliable for standard import forms without needing AST parsing.

Dependency resolution maps import specifiers to actual files on disk using language-specific conventions:

  • Python: module dot-path to file path, relative import resolution
  • Go: go.mod module name stripping, package-to-directory mapping
  • Java/Kotlin: dot-to-slash convention, standard source root prefixes (src/main/java/)
  • Rust: crate/self/super path resolution, mod.rs convention
  • C#: namespace-to-path with progressive prefix stripping
  • PHP: PSR-4 backslash-to-slash mapping, require/include path resolution

Directory scanning uses early pruning of .git, node_modules, dist, build, vendor, target, and other common non-source directories.

Project root detection

For deps, dependents, impact, and graph, the tool auto-detects the project root by walking up the directory tree looking for .git, package.json, or pyproject.toml. Override with --root:

sh
syms deps src/app.py --root /path/to/project

Limitations

  • Convention-based resolution — dependency resolution uses file path conventions, not compiler/build system integration. TypeScript/JavaScript paths from tsconfig.json/jsconfig.json are supported (including extends), but webpack/vite aliases defined outside tsconfig are not.
  • File-level granularity — dependencies are traced at the file level (import graph), not at the function or symbol level. There is no call graph.
  • C/C++ includes#include parsing and header resolution are not yet implemented. Symbol extraction works, but dependency tracing does not.
  • Ruby/Scala/Bash — symbol extraction works via tree-sitter, but import parsing and dependency resolution are not implemented.
  • Dynamic imports — Python's importlib.import_module(), JavaScript's computed require(), and similar dynamic patterns are not detected.
  • Monorepo boundaries — the tool resolves imports within a single project root. Cross-package imports in monorepos may not resolve correctly.

License

MIT

常见问题

io.github.Jordan-Horner/symbols 是什么?

提供快速的多语言源码智能分析,包括 symbols、imports、dependencies 与 impact analysis。

相关 Skills

网页构建器

by anthropics

Universal
热门

面向复杂 claude.ai HTML artifact 开发,快速初始化 React + Tailwind CSS + shadcn/ui 项目并打包为单文件 HTML,适合需要状态管理、路由或多组件交互的页面。

在 claude.ai 里做复杂网页 Artifact 很省心,多组件、状态和路由都能顺手搭起来,React、Tailwind 与 shadcn/ui 组合效率高、成品也更精致。

编码与调试
未扫描114.1k

前端设计

by anthropics

Universal
热门

面向组件、页面、海报和 Web 应用开发,按鲜明视觉方向生成可直接落地的前端代码与高质感 UI,适合做 landing page、Dashboard 或美化现有界面,避开千篇一律的 AI 审美。

想把页面做得既能上线又有设计感,就用前端设计:组件到整站都能产出,难得的是能避开千篇一律的 AI 味。

编码与调试
未扫描114.1k

网页应用测试

by anthropics

Universal
热门

用 Playwright 为本地 Web 应用编写自动化测试,支持启动开发服务器、校验前端交互、排查 UI 异常、抓取截图与浏览器日志,适合调试动态页面和回归验证。

借助 Playwright 一站式验证本地 Web 应用前端功能,调 UI 时还能同步查看日志和截图,定位问题更快。

编码与调试
未扫描114.1k

相关 MCP Server

GitHub

编辑精选

by GitHub

热门

GitHub 是 MCP 官方参考服务器,让 Claude 直接读写你的代码仓库和 Issues。

这个参考服务器解决了开发者想让 AI 安全访问 GitHub 数据的问题,适合需要自动化代码审查或 Issue 管理的团队。但注意它只是参考实现,生产环境得自己加固安全。

编码与调试
83.4k

by Context7

热门

Context7 是实时拉取最新文档和代码示例的智能助手,让你告别过时资料。

它能解决开发者查找文档时信息滞后的问题,特别适合快速上手新库或跟进更新。不过,依赖外部源可能导致偶尔的数据延迟,建议结合官方文档使用。

编码与调试
52.2k

by tldraw

热门

tldraw 是让 AI 助手直接在无限画布上绘图和协作的 MCP 服务器。

这解决了 AI 只能输出文本、无法视觉化协作的痛点——想象让 Claude 帮你画流程图或白板讨论。最适合需要快速原型设计或头脑风暴的开发者。不过,目前它只是个基础连接器,你得自己搭建画布应用才能发挥全部潜力。

编码与调试
46.3k

评论