Skip to main content

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.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trace_mcp-1.0.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trace_mcp-1.0.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file trace_mcp-1.0.0.tar.gz.

File metadata

  • Download URL: trace_mcp-1.0.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.17

File hashes

Hashes for trace_mcp-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d9f6d4225703790f4f664be36b2363d07bc1fa4e5ffae7d61b4dc747ec56a352
MD5 3f42d705818583130cb1c1db40e7b2d1
BLAKE2b-256 1653cb31351fc4a9688fd173ee19fb39fdce4d189e8ec849303df0c3b6b8abee

See more details on using hashes here.

File details

Details for the file trace_mcp-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: trace_mcp-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.17

File hashes

Hashes for trace_mcp-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 835cfae4efa17a2f83be5e794c3c49854a97aae0e1f88654957a86a4bd7c14e6
MD5 f26f8d61335cb5b76b5a476463bc3a32
BLAKE2b-256 23a0be234e907c9f502bb1ebacddcf0901233c06509c00e0de5287f7e1efb78d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page