mcpField
T
TSG Indexer

TSG Indexer

Local
github.com/entrepeneur4lyfDeveloper Tools16Updated 77w ago

About TSG Indexer

TSG Indexer is a Rust library for building code graphs from repositories with Tree-sitter Stack Graphs. It supports many programming languages and offers JSON or DOT output, with optional CLI and LSP features for developers and tool builders.

Key features

  1. 01Indexes many programming languages
  2. 02Traverses directories recursively
  3. 03Builds definition-reference graphs
  4. 04Exports JSON and DOT
  5. 05Optional CLI support
  6. 06Optional LSP support

Use cases

  1. 01Index a repository for code navigation
  2. 02Find relationships across file definitions and references
  3. 03Use graph data in an MCP server

MCP support

TSG Indexer is a library intended for integration into MCP servers; it supplies indexing and graph data for code navigation and reference finding. It is not described as an MCP server itself.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

TSG Indexer

A library for indexing code repositories using Tree-sitter Stack Graphs, designed to be used in MCP servers and other tools.

Overview

TSG Indexer is a Rust library that uses Tree-sitter Stack Graphs to analyze code repositories and build graph representations of code structure. It captures relationships between definitions and references across files, enabling powerful code navigation and analysis capabilities.

Key features:

TSG Indexer is a library that uses tree-sitter-stack-graphs to analyze code repositories and build a graph representation of the code structure. This graph captures the relationships between definitions and references across files, enabling powerful code navigation and analysis.

Support for 20+ programming languages including Rust, Python, JavaScript, TypeScript, Java, and more Recursive directory traversal for comprehensive codebase analysis Multiple output formats (JSON, DOT graph) Optional CLI and LSP support via feature flags Ability to generate TSG files for unsupported languages The library is designed to be integrated with Model Control Protocol (MCP) servers and other tools that need code indexing and navigation capabilities. It leverages the tree-sitter parsing system and stack-graphs technology from GitHub to create a comprehensive code analysis solution.

Features

  • Support for multiple languages:
    • Rust
    • Python
    • JavaScript
    • TypeScript
    • Java
    • Swift
    • Objective-C
    • CSS
    • Scala
    • Zig
    • YAML
    • Go
    • PHP
    • XML
    • JSDoc
    • Bash
    • JSON
    • HTML
    • C#
    • Ruby
    • Markdown
    • Lua
    • Dart
    • And more!
  • Recursive directory traversal
  • Multiple output formats:
    • JSON
    • DOT graph
  • Feature flags for optional functionality:
    • cli - Command-line interface support
    • lsp - Language Server Protocol support

Installation

Add to your Cargo.toml:

[dependencies]
tsg_indexer = { version = "0.1.0", features = ["cli", "lsp"] }

Or clone and build the repository:

# Clone the repository
git clone https://github.com/entrepeneur4lyf/tsg_indexer.git
cd tsg_indexer

# Build the project
cargo build --release

Library Usage

use tsg_indexer::{IndexerConfig, run_indexer};
use std::path::PathBuf;

fn main() -> anyhow::Result<()> {
    // Create configuration
    let config = IndexerConfig {
        path: PathBuf::from("src/"),
        format: "json".to_string(),
        output: Some(PathBuf::from("output.json")),
        verbose: true,
    };
    
    // Run the indexer
    run_indexer(config)
}

CLI Usage

When built with the cli feature:

# Index a single file
tsg_indexer_cli examples/test_rust.rs

# Index a directory recursively
tsg_indexer_cli src/

# Output in DOT format
tsg_indexer_cli --format dot src/

# Output to a file
tsg_indexer_cli --output graph.json src/

# Verbose mode
tsg_indexer_cli --verbose src/

Use with MCP Servers

This library is designed to be used in Model Control Protocol (MCP) servers for code indexing and navigation capabilities. It provides the core functionality needed for parsing and analyzing code repositories with tree-sitter and stack-graphs.

MCP Integration

To integrate with an MCP server:

  1. Add tsg_indexer as a dependency with appropriate features
  2. Use the library's API to index code and build stack graphs
  3. Leverage the graph data for code navigation, reference finding, and more

Example

# Index the examples directory (with CLI feature enabled)
tsg_indexer_cli examples/

# The output will show the graph structure in JSON format by default

Contributing

Contributions are welcome! Here are some ways you can contribute:

  • Report bugs
  • Add support for more languages
  • Improve error handling
  • Add more output formats
  • Optimize performance

License

MIT License & Apache 2.0 License - I am not 100% sure how to properly license this lol.

Acknowledgments

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.