Skip to main content

CBT Query MCP Server

A simple Model Context Protocol (MCP) server for querying TensorRT test coverage and case mapping data.

Features

  • Query all test cases and files
  • Get coverage mapping by case name
  • Query cases by files and/or functions
  • Simple HTTP client with proper error handling
  • Minimal logging and clean code structure

Installation

Prerequisites

  • Python 3.10 or later
  • pip package manager

Installation

installed from pypi

pip install cbt_query

Configuration for Cursor

Add the following configuration to your ~/.cursor/mcp.json file:

# ~/.cursor/mcp.json
{
  "mcpServers": {
    "trt_query": {
      "command": "python",
      "args": [
        "-m",
        "cbt_query"
      ],
      "env": {
        "CBT_SERVER_URL": "http://your_server_name:12345/"
      }
    }
  }
}

Available Tools

The MCP server provides the following tools:

  • query_all_cases: Get all test cases from the server
  • query_all_files: Get all files from the server
  • query_by_case: Get coverage mapping by case name
  • query: Query cases by files and/or functions
  • query_test_similarity: Compare test coverage similarity between two test lists

API Examples

# Get all cases
await query_all_cases()

# Get all files
await query_all_files()

# Get coverage by case
await query_by_case("test_case_name")

# Query by file
await query(file_name="example.cpp")

# Query by function
await query(funcs="example_function")

# Query by file and function
await query(file_name="example.cpp", funcs="example_function")

# Compare test coverage similarity
await query_test_similarity("L0", "L1")
await query_test_similarity(["test1", "test2"], ["test3", "test4"])
await query_test_similarity("trt_mod_test", "infer_test", filter_test_list=True)
await query_test_similarity("turtle_test1", "turtle_test2", use_turtle_names=True)

Development

uv init new_project cd new_project

Create virtual environment and activate it

uv venv source .venv/bin/activate

Install dependencies

uv add "mcp[cli]" httpx requests pip

Environment Setup

Make sure to set the CBT_SERVER_URL environment variable:

export CBT_SERVER_URL="http://your-server:12345"

Debug Mode

To enable debug mode with detailed logging, set the CBT_DEBUG environment variable:

export CBT_DEBUG=1
# or
export CBT_DEBUG=true

Troubleshooting

Common Issues

  1. CBT_SERVER_URL not set: Make sure the environment variable is set
  2. Import errors: Verify all dependencies are installed in the active environment
  3. Connection errors: Check that the CBT server is running and accessible

Logging

The server logs to stderr with INFO level by default.

Metadata

Release files for cbt-query 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cbt-query 0.5.0
File Size Uploaded
cbt_query-0.5.0.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cbt-query 0.5.0
File Interpreter ABI Platform
cbt_query-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / cbt_query-0.5.0.tar.gz

Download URL cbt_query-0.5.0.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c3ad00717f333887cc0bc6213ede179d954ffa4bfd383c28eaf42f1f69f9a5b8
BLAKE2b-256 checksum
How to use checksums
ec0327d314985bc06b8d7ecde8ea4c4f1e8686edcc19a583b63e93882574c31f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / cbt_query-0.5.0-py3-none-any.whl

Download URL cbt_query-0.5.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f14e4521fedf64d0d4a4bd8cdad44aa53a672e5640e30179d5d69bb4db43576a
BLAKE2b-256 checksum
How to use checksums
1a02d99248217f9fe2a34562a6fba3cca6717adfb2cfd1533f7db6e4336db2e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page