Skip to content

MCP Server

The tree-sitter-language-pack CLI includes an MCP server that exposes parsing, code intelligence extraction, language detection, and cache management as standard tools for AI agents. Use it to add code analysis to Claude, Cursor, VS Code, or any MCP-compatible application.

There are three ways to run it:

  • Bundled with the plugin — the coding-agent plugin registers the tree-sitter-language-pack MCP server for you and resolves the CLI automatically. Nothing to install by hand.
  • Direct MCP client config — point any MCP client at the published ts-pack CLI (see Installing the CLI below).
  • Hermes — for Hermes-based agents, install the runtime plugin with pip install tree-sitter-language-pack-hermes-plugin.

The ts-pack binary is published to every major registry. Install it with whichever fits your toolchain:

Terminal window
# Homebrew
brew install xberg-io/tap/ts-pack
# npm (Node.js)
npm install -g @xberg-io/ts-pack-cli
# uv / uvx (Python)
uvx --from ts-pack-cli ts-pack --version
# Cargo (Rust)
cargo install ts-pack-cli

Once ts-pack is on your PATH, any of the client configs below will work.

The Model Context Protocol (MCP) is an open standard for connecting AI applications to tools and data. The tree-sitter-language-pack MCP server provides tools for parsing source code, analyzing structure and symbols, and managing language packs — all through a unified interface.

For local AI tools — Claude Desktop, Cursor, VS Code — use stdio transport:

Terminal window
ts-pack mcp --transport stdio

Stdio is the default, so ts-pack mcp is equivalent. The server runs as a subprocess and communicates over stdin/stdout with JSON-RPC messages. No network configuration needed.

For remote agents or team environments where stdio doesn’t work:

Terminal window
ts-pack mcp --transport http --host 127.0.0.1 --port 8011

The server listens on http://127.0.0.1:8011 (default). Change --host to 0.0.0.0 for network-wide access (use with caution).

Point the server at a language-pack.toml config file:

Terminal window
ts-pack mcp --config /path/to/language-pack.toml

This sets default languages and download preferences for all tool calls.

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
"mcpServers": {
"tree-sitter-language-pack": {
"command": "ts-pack",
"args": ["mcp", "--transport", "stdio"]
}
}
}

Or use the CLI to register automatically:

Terminal window
claude mcp add tree-sitter-language-pack -- ts-pack mcp --transport stdio

Restart Claude. The tree-sitter-language-pack tools appear in the Tools panel.

Edit .cursor/mcp.json in your project root (or global Cursor settings):

{
"mcpServers": {
"tree-sitter-language-pack": {
"command": "ts-pack",
"args": ["mcp", "--transport", "stdio"]
}
}
}

Reload Cursor. Tools are now available in the AI chat.

Edit .vscode/settings.json or your VS Code global settings:

{
"mcpServers": [
{
"name": "tree-sitter-language-pack",
"command": "ts-pack",
"args": ["mcp", "--transport", "stdio"]
}
]
}

Then reference tools in GitHub Copilot chat or use the Tools panel.

For a client that spawns the server over stdio, point it at the ts-pack binary:

{
"mcpServers": [
{
"name": "tree-sitter-language-pack",
"command": "ts-pack",
"args": ["mcp", "--transport", "stdio"]
}
]
}

For an HTTP client, start the server yourself (ts-pack mcp --transport http --port 8011) and connect to its URL:

{
"mcpServers": [
{
"name": "tree-sitter-language-pack",
"url": "http://127.0.0.1:8011"
}
]
}

The MCP server exposes 8 tools for parsing, analysis, and management:

parse

Render the syntax tree as S-expression or JSON.

Parameter Type Description
source string Source code to parse
language string Language name (e.g., python, rust)
format string Output format: sexp or json (default: sexp)

process

Extract code intelligence: structure, imports, exports, symbols, docstrings, comments, diagnostics, and optionally chunk for LLMs.

Parameter Type Description
source string Source code to analyze
language string Language name
all boolean Extract all intelligence fields (default: false)
chunk_size integer Split output into chunks for LLMs (optional)
chunk_overlap integer Overlap between chunks in tokens (optional)

detect_language

Identify language from file path or source code.

Parameter Type Description
path string File path (e.g., main.rs) — optional
source string Source code — optional, used if path unclear

The MCP server provides read-only resources for browsing the language catalog:

  • ts-pack://languages — list of all 371 available languages with extensions and aliases
  • ts-pack://languages/downloaded — list of user-downloaded languages
  • ts-pack://language/{name} — status of a specific language (template resource)

The MCP server includes a built-in prompt template:

analyze-code

Analyzes source code by detecting its language, extracting code intelligence, and formatting results for readability. Use this when you want the agent to understand code structure without manual language specification.

Parameter Type Description
source string Source code to analyze
focus string What to extract: all, structure, imports, exports, symbols (default: all)

For most users, installing the tree-sitter-language-pack plugin from the self-hosted xberg-io/tree-sitter-language-pack marketplace is simpler than manual MCP registration. The plugin ships a launcher script (scripts/mcp-launch.sh) that resolves the ts-pack CLI at runtime — via a cached binary, npx @xberg-io/ts-pack-cli, uvx --from ts-pack-cli ts-pack, Homebrew, or a prebuilt release download — and registers the tree-sitter-language-pack server for you.

See AI Coding Assistants for installation steps.