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-packMCP 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-packCLI (see Installing the CLI below). - Hermes — for Hermes-based agents, install the runtime plugin with
pip install tree-sitter-language-pack-hermes-plugin.
Installing the CLI
Section titled “Installing the CLI”The ts-pack binary is published to every major registry. Install it with whichever fits your toolchain:
# Homebrewbrew 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-cliOnce ts-pack is on your PATH, any of the client configs below will work.
What is MCP?
Section titled “What is MCP?”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.
Starting the Server
Section titled “Starting the Server”Stdio Transport (Default)
Section titled “Stdio Transport (Default)”For local AI tools — Claude Desktop, Cursor, VS Code — use stdio transport:
ts-pack mcp --transport stdioStdio 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.
HTTP Transport
Section titled “HTTP Transport”For remote agents or team environments where stdio doesn’t work:
ts-pack mcp --transport http --host 127.0.0.1 --port 8011The server listens on http://127.0.0.1:8011 (default). Change --host to 0.0.0.0 for network-wide access (use with caution).
Custom Configuration
Section titled “Custom Configuration”Point the server at a language-pack.toml config file:
ts-pack mcp --config /path/to/language-pack.tomlThis sets default languages and download preferences for all tool calls.
Registering with AI Tools
Section titled “Registering with AI Tools”Claude Desktop / Claude Code
Section titled “Claude Desktop / Claude Code”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:
claude mcp add tree-sitter-language-pack -- ts-pack mcp --transport stdioRestart Claude. The tree-sitter-language-pack tools appear in the Tools panel.
Cursor
Section titled “Cursor”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.
VS Code / GitHub Copilot
Section titled “VS Code / GitHub Copilot”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.
Generic MCP Client
Section titled “Generic MCP Client”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 |
list_languages
Enumerate available, downloaded, or manifest languages.
| Parameter | Type | Description |
|---|---|---|
filter |
string | One of: available (default), downloaded, manifest |
query |
string | Filter by name or pattern (optional) |
info
Get status of a specific language (available, downloaded, extensions, aliases).
| Parameter | Type | Description |
|---|---|---|
name |
string | Language name (e.g., python) |
download
Fetch language parsers for offline use.
| Parameter | Type | Description |
|---|---|---|
languages |
array | List of language names — optional |
groups |
string | Download a group: web, systems, data, all — optional |
fresh |
boolean | Force fresh download (ignore cache) |
cache_dir
Retrieve the local cache directory where parsers are stored.
Returns: path to the cache (e.g., ~/.ts-pack-cache)
clean_cache
Delete cached parsers.
| Parameter | Type | Description |
|---|---|---|
all |
boolean | Delete all cached parsers (default: false) |
languages |
array | Delete parsers for specific languages — optional |
Resources
Section titled “Resources”The MCP server provides read-only resources for browsing the language catalog:
ts-pack://languages— list of all 371 available languages with extensions and aliasests-pack://languages/downloaded— list of user-downloaded languagests-pack://language/{name}— status of a specific language (template resource)
Prompt
Section titled “Prompt”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) |
Using the Plugin Instead
Section titled “Using the Plugin Instead”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.
Next Steps
Section titled “Next Steps”- CLI Guide — full CLI command reference
- Parsing Code — understanding syntax trees
- Code Intelligence — extract structure and symbols
- Installation — install ts-pack-cli