Skip to main content

trace-mcp

A Python MCP server for controlling Android system tracing via a native traceserver binary, supporting device selection and custom port forwarding. Designed for use with the uv/uvx toolchain.

Prerequisites

  • Python 3.12+
  • uv (for dependency management and running scripts)
  • Android Debug Bridge (adb) in your PATH
  • Android device (API 21+), with USB debugging enabled
  • Prebuilt traceserver binaries in the bin/ directory for all supported ABIs

Installation

uv pip install -e .

Usage

Start the MCP server (with uvx)

uvx trace-mcp --port 12345
  • --port (optional): Specify the port for traceserver and forwarding (default: 12345)

MCP Tool Functions

All tool functions accept an optional sn (device serial number) and port argument.

1. begin_trace

Begin a trace section on the device.

  • Arguments:
    • trace_tag (str): Trace tag name
    • sn (str, optional): Device serial number
    • port (int, optional): Port (default: 8080)

2. end_trace

End a trace section on the device.

  • Arguments:
    • trace_tag (str): Trace tag name
    • sn (str, optional): Device serial number
    • port (int, optional): Port (default: 8080)

3. trace_test_mode

Start traceserver in test mode on the device.

  • Arguments:
    • sn (str, optional): Device serial number
    • port (int, optional): Port (default: 8080)

4. stop_traceserver

Stop the traceserver process and remove port forwarding.

  • Arguments:
    • sn (str, optional): Device serial number
    • port (int, optional): Port (default: 8080)

Example

uvx trace-mcp --port 9000

Then, use your MCP client to call the tool functions with the appropriate arguments.

Project Structure

  • main.py: MCP server and tool function implementations
  • bin/: Prebuilt traceserver binaries for each ABI
  • pyproject.toml: Project configuration for uv/uvx

License

MIT

Metadata

Release files for trace-mcp 1.0.1

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

Source distribution (sdist)

Source distribution for trace-mcp 1.0.1
File Size Uploaded
trace_mcp-1.0.1.tar.gz 33.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for trace-mcp 1.0.1
File Interpreter ABI Platform
trace_mcp-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 74.3 kB

Release files / trace_mcp-1.0.1.tar.gz

Download URL trace_mcp-1.0.1.tar.gz
Size 33.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7aa37cffb2c1db0d5b80d206d5da725fc0099bfe5465258ff1744305528cf245
BLAKE2b-256 checksum
How to use checksums
1ce76b2d21d3b9f5734e724d0e584efac8069410b6520d027c5df9024f7c3303
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.17

Release files / trace_mcp-1.0.1-py3-none-any.whl

Download URL trace_mcp-1.0.1-py3-none-any.whl
Size 40.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
918a2b2dea36fc8c764d8bc0122480801fe912ae8376a0a3f21a20f0b6868c0e
BLAKE2b-256 checksum
How to use checksums
5ba992bfeac2e7a6d296a420215d87a51c6bfc3edb351e15c792113aac77b8e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.17

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.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