Skip to main content
Glama
syntax-map-mcp

syntax-map-mcp

by kht6163

syntax-map-mcp

Tree-sitter 기반 코드 분석 MCP 서버입니다. 지정한 workspaceRoot 아래의 JavaScript, TypeScript, TSX, Python, Rust 소스 파일을 읽고 심볼, 정의, 참조, 요약, tree-sitter query, 컨텍스트 markdown을 제공합니다.

설치와 빌드

npm install
npm run build

개발 중 검증:

npm test
npm run typecheck

Related MCP server: Code Declaration Lookup MCP Server

실행

npx -y syntax-map-mcp --workspace-root /path/to/workspace

workspaceRoot 결정 순서:

  1. --workspace-root 인자

  2. WORKSPACE_ROOT 환경 변수

  3. 현재 작업 디렉터리

제공 도구

  • list_symbols: 파일 하나의 top-level 심볼 목록 반환

  • find_definition: 여러 파일에서 이름과 선택적 kind로 정의 검색

  • find_references: 여러 파일에서 식별자 참조 검색

  • summarize_file: 파일 언어, 라인 수, AST 기반 imports, exports, symbols 요약

  • run_query: 파일 하나에 tree-sitter query 실행

  • get_ast_tree: 파일 하나의 tree-sitter AST를 depth 제한 JSON 트리로 반환

  • lsp_document_symbols: 파일 하나의 심볼을 LSP DocumentSymbol 형태로 반환

  • lsp_diagnostics: 파일 하나의 tree-sitter parse error를 LSP Diagnostic 형태로 반환

  • lsp_definition: 파일의 LSP 위치에 있는 식별자의 정의 위치를 반환

  • lsp_references: 파일의 LSP 위치에 있는 식별자의 참조 위치를 반환

  • lsp_hover: 파일의 LSP 위치에 있는 식별자의 hover markdown을 반환

  • lsp_workspace_symbols: workspace 전체에서 LSP WorkspaceSymbol 형태의 심볼 검색 결과 반환

  • lsp_completion: 파일의 LSP 위치 앞 prefix에 맞는 workspace 심볼 completion item 반환

  • lsp_signature_help: 파일의 LSP 위치에서 활성 함수 호출 signature와 parameter 반환

  • build_context: 여러 파일 요약을 markdown 컨텍스트로 구성

  • index_workspace: 지원 소스 파일을 파싱해 SQLite 심볼/참조 인덱스 생성 또는 갱신

  • search_symbols: SQLite 인덱스에서 심볼 이름 검색 및 snippet 반환

  • find_indexed_definition: SQLite 인덱스에서 정확한 심볼 정의 검색 및 snippet 반환

  • find_indexed_references: SQLite 인덱스에서 식별자 참조 검색 및 snippet 반환

  • get_index_status: 인덱스 경로, 인덱싱된 파일 수, 심볼 수, 참조 수, stale 파일 수 반환

  • clear_index: SQLite 인덱스 파일 삭제

lsp_definition, lsp_references, lsp_hover, lsp_workspace_symbols, lsp_completion, lsp_signature_help의 paths 입력은 선택 사항입니다. 생략하면 workspaceRoot 아래의 지원 소스 파일 전체를 대상으로 조회합니다.

SQLite 인덱스

index_workspace는 workspaceRoot 아래의 .syntax-map-mcp/index.sqlite에 인덱스를 저장합니다. 인덱싱 대상은 .js, .jsx, .ts, .tsx, .py, .rs 파일이며, .git, .syntax-map-mcp, dist, node_modules 디렉터리와 workspaceRoot 아래의 .gitignore 패턴에 매칭되는 파일은 제외합니다. 하위 디렉터리의 .gitignore는 해당 디렉터리 기준으로 적용합니다.

파일 변경 여부는 mtimeMs와 size로 판단합니다. 다시 index_workspace를 호출하면 변경된 파일만 재파싱하고, 삭제된 파일은 인덱스에서 제거합니다. MCP 서버를 실행하면 지원 소스 파일 변경을 감지하는 watcher가 함께 시작되어 SQLite 인덱스를 자동 갱신합니다. .syntax-map-mcp, .git, dist, node_modules와 지원하지 않는 확장자 변경은 watcher refresh 대상에서 제외합니다. get_index_status는 기본적으로 stale 파일 개수만 반환하고, 상세 목록이 필요하면 includeStaleReasons: true를 전달합니다. search_symbols, find_indexed_definition, find_indexed_references는 isStale, staleFiles, refreshed를 반환해 검색 결과가 최신 인덱스 기반인지 알려줍니다. 세 도구에 refreshIfStale: true를 전달하면 stale 파일이 있을 때 먼저 인덱스를 갱신한 뒤 검색합니다. 인덱스 검색 도구는 인덱스에 저장된 위치를 조회한 뒤 현재 파일에서 해당 줄 snippet을 읽어 반환합니다. contextBefore, contextAfter를 0-10 사이 정수로 전달하면 snippet 주변 라인도 함께 반환합니다. includePreview: true를 전달하면 path:line 헤더와 코드블록으로 구성된 previewMarkdown도 함께 반환합니다.

summarize_file은 sources 필드로 symbols, imports, exports가 어떤 방식으로 추출되었는지 반환합니다.

Python은 JavaScript/TypeScript처럼 명시적인 export 문법이 없으므로, top-level __all__에 선언된 문자열 이름을 exports로 반환합니다. __all__이 없으면 exports는 빈 배열입니다.

도구 레퍼런스

도구별 입력과 응답 예시는 docs/tools.md를 참고하세요.

변경 이력

버전별 변경 내용은 CHANGELOG.md를 참고하세요.

MCP 설정 예시

{
  "mcpServers": {
    "syntax-map-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "syntax-map-mcp",
        "--workspace-root",
        "/path/to/workspace"
      ]
    }
  }
}

보안 경계

서버는 workspaceRoot 내부 파일만 읽습니다. 지원 확장자는 .js, .jsx, .ts, .tsx, .py, .rs뿐이며, workspace 밖으로 나가는 경로나 지원하지 않는 확장자는 오류로 처리합니다.

Available Tools

21 tools
build_contextBuild contextC

Build markdown context for supported source files.

Inputs: detail (required), paths, maxFiles, indexedSearch.

clear_indexClear indexB

Delete the SQLite workspace index file.

Inputs: no named parameters.

find_definitionFind definitionC

Find symbol definitions by name across supported source files.

Inputs: name (required), paths (required), kinds.

find_indexed_definitionFind indexed definitionC

Find exact symbol definitions from the SQLite workspace index with snippets.

Inputs: name (required), kinds, limit, contextAfter, +3 more.

find_indexed_referencesFind indexed referencesC

Find identifier references from the SQLite workspace index with snippets.

Inputs: name (required), limit, contextAfter, contextBefore, +2 more.

find_referencesFind referencesC

Find identifier references by name across supported source files.

Inputs: name (required), paths (required).

get_ast_treeGet AST treeC

Return a depth-limited tree-sitter AST for one supported source file.

Inputs: path (required), maxDepth, includeText.

get_index_statusGet index statusB

Return SQLite index path, indexed file count, symbol count, and stale file count.

Inputs: includeStaleReasons.

index_workspaceIndex workspaceB

Build or refresh the SQLite symbol index for all supported source files.

Inputs: no named parameters.

list_symbolsList symbolsC

List top-level symbols in one supported source file.

Inputs: path (required).

lsp_completionLSP completionC

Return workspace symbol completion items for the prefix before a zero-based LSP position.

Inputs: line (required), path (required), character (required), kinds, +2 more.

lsp_definitionLSP definitionC

Return definition locations for the identifier at a zero-based LSP position.

Inputs: line (required), path (required), character (required), paths.

lsp_diagnosticsLSP diagnosticsC

Return lightweight syntax diagnostics from tree-sitter parse errors.

Inputs: path (required).

lsp_document_symbolsLSP document symbolsC

Return tree-sitter symbols converted to LSP DocumentSymbol ranges and kinds.

Inputs: path (required).

lsp_hoverLSP hoverB

Return markdown hover contents for the identifier at a zero-based LSP position.

Inputs: line (required), path (required), character (required), paths.

lsp_referencesLSP referencesC

Return reference locations for the identifier at a zero-based LSP position.

Inputs: line (required), path (required), character (required), paths.

lsp_signature_helpLSP signature helpC

Return signature help for the active call at a zero-based LSP position.

Inputs: line (required), path (required), character (required), paths.

lsp_workspace_symbolsLSP workspace symbolsC

Return workspace symbols matching a case-insensitive query.

Inputs: query (required), kinds, paths.

run_queryRun tree-sitter queryC

Run a tree-sitter query against one supported source file.

Inputs: path (required), query (required).

search_symbolsSearch indexed symbolsC

Search symbols from the SQLite workspace index.

Inputs: query (required), kinds, limit, contextAfter, +3 more.

summarize_fileSummarize fileC

Summarize language, line count, imports, exports, and symbols for one file.

Inputs: path (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.7/5.0

    Scored across 21 tools

    Disambiguation3/5

    There are several overlapping triads: lsp_definition vs find_definition vs find_indexed_definition, lsp_references vs find_references vs find_indexed_references, and list_symbols vs lsp_document_symbols, plus search_symbols vs lsp_workspace_symbols. Descriptions distinguish the source and input style (LSP position, name, or SQLite index), but an agent can still easily misselect among them.

    Naming Consistency4/5

    All names use snake_case and are generally readable, with consistent verb_noun patterns for most non-LSP tools. The lsp_* tools use a noun-phrase convention rather than an action verb, and a few names are longer but still predictable.

    Tool Count3/5

    At 21 tools, the server is in the heavy borderline range, and the overlapping LSP/name/index variants inflate the surface. The count is defensible for a code-intelligence server covering tree-sitter, LSP-like actions, and SQLite indexing, but it would benefit from consolidation.

    Completeness3/5

    Core syntax, symbol, definition, reference, hover, completion, signature-help, diagnostics, and index lifecycle tools are present. However, common LSP/code-intelligence operations such as type definition, implementation, rename, code actions, document highlights, and workspace-wide diagnostics are missing, leaving notable gaps.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Provides code context and analysis for AI assistants by extracting directory structures and code symbols using WebAssembly Tree-sitter parsers with zero native dependencies.
      1
      43 npm
      20
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables full-text search for code declarations across multiple languages using SQLite FTS5 and universal ctags, allowing users to search for functions, classes, and other code elements.
      4
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides a semantic understanding of your codebase by parsing with tree-sitter and building a graph of symbols and dependencies. Enables AI assistants to navigate code, analyze changes, and discover architecture using 18 tools with minimal context overhead.
      18 npm
      1
      MIT
    • F
      license
      A
      quality
      C
      maintenance
      Enables token-efficient structural code exploration using tree-sitter AST parsing, with tools for symbol search, outlines, source unfolding, call graphs, and related-file discovery.
      1
      -