npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tng-sh/mcp-server

v1.0.6

Published

MCP server for TNG test generation and code auditing

Readme

TNG MCP Server

Model Context Protocol server for TNG - Bring AI-powered test generation and code auditing to any AI assistant

This MCP server exposes TNG's test generation and code auditing capabilities to AI assistants like Claude Desktop, Cursor, Antigravity, and any other MCP-compatible tool.

What is MCP?

The Model Context Protocol allows AI assistants to interact with external tools and services. With this MCP server, you can ask your AI assistant questions like:

  • "Audit the process_payment method in app/services/payment_processor.rb"
  • "Generate comprehensive tests for the UserController#create method"
  • "What can TNG do here?"

And the AI will use TNG automatically to provide detailed, actionable results.

Features

  • Method Auditing - Deep analysis for bugs, security issues, and performance problems
  • Test Generation - Automatic test creation for Ruby, Python, and JavaScript
  • Symbolic Trace - Execution path analysis for debugging and understanding code flow
  • Clone Detection - Find duplicate code with token-based, structural, and fuzzy matching
  • Dead Code Detection - Identify unused imports, variables, functions, and unreachable code
  • Capabilities Listing - List available TNG MCP tools and when to use them
  • Multi-Language Support - Works with Ruby, Python, JavaScript/TypeScript
  • Universal Integration - Works with any MCP-compatible AI assistant

Prerequisites

IMPORTANT: The TNG MCP server works just like the VSCode extension - it assumes you already have TNG installed and configured in your project.

Step 1: Install TNG in Your Project

Choose based on your project type:

For Ruby Projects

  1. Add to your Gemfile:
    gem 'tng'
  2. Run: bundle install
  3. Get API key from tng.sh
  4. Configure: rails generate tng:install or set TNG_API_KEY environment variable

####For Python Projects

  1. Install TNG:
    • pip: pip install tng-python
    • uv: uv add tng-python
    • Poetry: poetry add tng-python
  2. Get API key from tng.sh
  3. Configure: Run tng init or set TNG_API_KEY environment variable

For Node.js Projects

  1. Install TNG: npm install tng-js
  2. Get API key from tng.sh
  3. Configure: Set TNG_API_KEY in your .env file

Step 2: Install MCP Server

After TNG is working in your project:

Option 1: Install from npm (when published)

npm install -g @tng-sh/mcp-server

Option 2: Install from source (for development)

cd /path/to/tng-mcp
npm install
npm run build
npm link

Configuration

For Claude Desktop

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

{
  "mcpServers": {
    "tng": {
      "command": "tng-mcp"
    }
  }
}

For Cursor

Add to your project's .cursor/mcp_config.json:

{
  "mcpServers": {
    "tng": {
      "command": "npx",
      "args": ["-y", "@tng-sh/mcp-server"]
    }
  }
}

For Other MCP Clients

The server runs on stdio, so configure it as:

Command: tng-mcp

Environment Configuration (Ruby/Python/JS + Version Managers)

If you use version managers like mise, asdf, rbenv, pyenv, or uv, the MCP server might not find the correct language environment by default. You can fix this by adding environment variables to your MCP config.

The most reliable setup is to specify the TNG command per language, so mixed Ruby + JS + Python repos work correctly:

{
  "mcpServers": {
    "tng": {
      "command": "tng-mcp",
      "env": {
        "TNG_COMMAND_RUBY": "bundle",
        "TNG_COMMAND_RUBY_ARGS": "exec,tng",
        "TNG_COMMAND_PYTHON": "uv",
        "TNG_COMMAND_PYTHON_ARGS": "run,tng",
        "TNG_COMMAND_JS": "npx",
        "TNG_COMMAND_JS_ARGS": "-p,@tng-sh/js,tng",
        "PATH": "/Users/USERNAME/.local/share/mise/shims:/usr/local/bin:/usr/bin:/bin"
      }
    }
  }
}

If you only use a single language, you can also set a global command:

{
  "mcpServers": {
    "tng": {
      "command": "tng-mcp",
      "env": {
        "TNG_COMMAND": "bundle",
        "TNG_COMMAND_ARGS": "exec,tng",
        "PATH": "/usr/local/bin:/usr/bin:/bin"
      }
    }
  }
}

If you do not set any TNG_COMMAND* variables, the server will auto-detect based on file extension.

{
  "mcpServers": {
    "tng": {
      "command": "tng-mcp",
      "env": {
        "PATH": "/Users/USERNAME/.local/share/mise/shims:/usr/local/bin:/usr/bin:/bin",
        "GEM_HOME": "/Users/USERNAME/.local/share/mise/installs/ruby/3.4.1/lib/ruby/gems/3.4.0",
        "GEM_PATH": "/Users/USERNAME/.local/share/mise/installs/ruby/3.4.1/lib/ruby/gems/3.4.0",
        "PYTHONPATH": "/path/to/your/python/libs"
      }
    }
  }
}

This ensures that bundle exec tng or uv run tng use the correct version and find all installed gems/packages.

Usage Examples

Once configured, interact naturally with your AI assistant:

Audit a Method

You: Audit the process_payment method in app/services/payment_processor.rb

AI: I'll audit that method for you.
    [*calls audit_method tool*]

    # Audit Results for PaymentProcessor#process_payment

    ## Issues Found (3)

    ### 1. Security - Severity: High
    **Description:** Potential SQL injection vulnerability
    **Location:** Line 52
    **Suggested Fix:** Use parameterized queries instead of string interpolation
    ...

One-Time Setup Helper

Generate a ready-to-paste MCP config by running:

npx @tng-sh/mcp-server init

This prints configuration blocks for Claude, Cursor, ChatGPT Desktop, Antigravity, and OpenCode. Copy the block for your client and paste it into your MCP config file.

Generate Tests

You: Generate tests for the User model's validate_email method

AI: I'll generate comprehensive tests for that method.
    [*calls generate_test tool*]

    ✅ Test Generated Successfully

    **Test File:** test/models/user_test.rb
    **Command to Run:** bundle exec rails test

    ## Generated Test Code
    ...

Trace Execution

You: Trace the execution path of calculate_discount

AI: I'll generate a symbolic trace for that method.
    [*calls trace_method tool*]

    # Symbolic Trace for PricingService#calculate_discount

    ### Step 1
    **Action:** Initialize base_price from params
    **Location:** Line 12
    **State:** base_price = 100.0
    ...

Detect Code Clones

You: Find duplicate code in app/services/report_generator.rb

AI: I'll check for code clones in that file.
    [*calls detect_clones tool*]

    # Clone Detection Results

    **Detection Level:** All Levels (Comprehensive detection)
    **Total Clone Groups Found:** 2

    ### Clone Group 1 (structural)
    **Similarity:** 95%
    **Instances (3):**
    1. **Location:** Lines 45-52
    2. **Location:** Lines 78-85
    3. **Location:** Lines 112-119

Find Dead Code

You: Check for unused code in src/utils/helpers.js

AI: I'll analyze that file for dead code.
    [*calls detect_deadcode tool*]

    # Dead Code Analysis for src/utils/helpers.js

    ## Summary
    - **Total Issues:** 5
    - **Unused Imports:** 2
    - **Unused Functions:** 3

    ### Unused Imports (2)
    1. **lodash**
       - Location: Line 3
       - Suggestion: Remove unused import

Available Tools

The MCP server exposes seven tools:

1. audit_method

Audit a method for issues and behaviors.

Parameters:

  • file_path (required) - Path to the source file
  • method_name (required) - Name of the method to audit
  • test_type (optional) - Component type for JS/Python (e.g., "react_component", "utility")

Returns:

  • Detailed issues with severity levels
  • Suggested fixes
  • Behavioral analysis

2. generate_test

Generate comprehensive tests for a method.

Parameters:

  • file_path (required) - Path to the source file
  • method_name (required) - Name of the method
  • test_type (optional) - Test framework or component type hint

Returns:

  • Generated test code
  • Test file path
  • Command to run tests

3. trace_method

Generate symbolic trace execution path for a method.

Parameters:

  • file_path (required) - Path to the source file
  • method_name (required) - Name of the method to trace

Returns:

  • Step-by-step execution path
  • Variable states at each step
  • Control flow analysis

4. detect_clones

Detect code duplication within a file.

Parameters:

  • file_path (required) - Path to the source file
  • level (optional) - Detection level: "1" (token), "2" (structural), "3" (fuzzy), or "all" (default)

Returns:

  • Clone groups with similarity scores
  • Locations of duplicated code
  • Refactoring recommendations

5. detect_deadcode

Detect dead code in a file or across the whole project.

Parameters:

  • file_path (optional) - Path to the source file (omit when using all=true)
  • all (optional) - Set to true for a project-wide scan (uses CLI flag --all)
  • project_root (required when all=true) - Project root to run the scan from

Returns:

  • Unused imports, variables, and functions
  • Unreachable code blocks
  • Cleanup recommendations

6. find_call_sites

Find in-repo call sites for a method/function.

Parameters:

  • file_path (required) - Path to the source file containing the method
  • method_name (required) - Method/function name
  • class_name (optional) - Class/module name to disambiguate methods with the same name
  • project_root (optional) - Project root to resolve relative paths

Returns:

  • Files and line numbers where the method is called
  • Snippet/context lines (when available)

Development

Building

npm install
npm run build

Development Mode (with watch)

npm run dev

Testing the Server

You can test the MCP server using the MCP Inspector:

npx @modelcontextprotocol/inspector tng-mcp

Or test individual tools manually using the mcp CLI.

Troubleshooting

"TNG CLI not found"

Make sure you have TNG installed:

# Check Ruby gem
gem list tng

# Check Python package
pip list | grep tng

# Check Node.js package
npm list -g | grep tng

"Authentication failed"

Ensure you have run tng init (or the equivalent for your language) in your project to set up your API key. The MCP server uses your local TNG configuration.

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License - see LICENSE file for details

Support


Made with ❤️ by Binary Dreams LLC