Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Uptrace MCP Serverfind the most recent error spans for the payment-service"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Uptrace MCP Server
Model Context Protocol (MCP) server for Uptrace observability platform. Provides tools for querying traces, spans, and errors through Claude Desktop or other MCP clients.
Features
š Query error spans - Get detailed error information with traces and stack traces
š Query spans - Filter and search spans using Uptrace Query Language (UQL)
š Trace visualization - Get full trace trees with all related spans
š Aggregations - Group and aggregate spans by services, operations, etc.
š Query logs - Search and filter logs by severity, service, and custom UQL queries
š Query metrics - Query metrics using PromQL-compatible syntax
š·ļø Service discovery - List all services reporting telemetry data
š Query syntax documentation - Get comprehensive UQL syntax reference
Installation
Prerequisites
Python 3.10 or higher
Poetry (recommended) or pip
Uptrace instance (self-hosted or cloud)
Using Poetry (recommended)
Using pip
Configuration
Create a .env file in the project root or set environment variables:
Getting your Uptrace API token
Log in to your Uptrace instance
Go to your user profile
Navigate to "Auth Tokens" section
Create a new token with read access
Note: User auth tokens do not work with Single Sign-On (SSO). If using SSO, create a separate user account with API access.
Usage
As MCP Server
Cursor IDE
š Detailed setup guide: See CURSOR_SETUP.md for comprehensive instructions.
To add this MCP server to Cursor:
Open Cursor Settings (Cmd+, on macOS or Ctrl+, on Windows/Linux)
Search for "MCP" or navigate to Features ā Model Context Protocol
Click Edit Config or open the MCP configuration file directly
The configuration file location:
macOS:
~/Library/Application Support/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.jsonWindows:
%APPDATA%\Cursor\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.jsonLinux:
~/.config/Cursor/User/globalStorage/saoudrizwan.claude-dev\settings\cline_mcp_settings.json
Quick setup: You can use the example configuration file cursor-mcp-config.json.example as a template. Copy it to your Cursor MCP settings file and update the paths and credentials.
Important: The cwd parameter specifies the working directory where the command will be executed. This must be the root directory of your uptrace-mcp project (where pyproject.toml is located).
Add the following configuration (replace the paths with your actual project paths):
Configuration parameters:
command- Full path to the Poetry executable (or Python interpreter)args- Arguments passed to the command (["run", "uptrace-mcp"]for Poetry)cwd- Working directory - must be the project root directory (wherepyproject.tomlis located)env- Environment variables for the server
Note: If you're using Poetry, make sure to use the full path to the Poetry executable from your virtual environment (.venv/bin/poetry) or the system Poetry installation. Alternatively, you can use the Python interpreter directly:
After saving the configuration, restart Cursor. The Uptrace tools will be available in the MCP tools panel.
Claude Desktop
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
Restart Claude Desktop and the Uptrace tools will be available.
Running Directly
Available Tools
Spans & Traces
uptrace_search_spans
Search spans with custom filters using UQL. Use where _status_code = "error" to find error spans.
Parameters:
time_gte(required): Start time in ISO format (YYYY-MM-DDTHH:MM:SSZ)time_lt(required): End time in ISO format (YYYY-MM-DDTHH:MM:SSZ)query(optional): UQL query stringlimit(optional): Maximum spans to return (default: 100)
Examples:
uptrace_get_trace
Get all spans for a specific trace ID.
Parameters:
trace_id(required): Trace ID to retrieve
Example:
uptrace_search_groups
Search and aggregate spans by groups.
Parameters:
time_gte(required): Start time in ISO formattime_lt(required): End time in ISO formatquery(required): UQL query with groupinglimit(optional): Maximum groups to return (default: 100)
Example:
uptrace_search_services
Search for services that have reported spans.
Parameters:
hours(optional): Number of hours to look back (default: 24)
Example:
Logs
uptrace_search_logs
Search logs by text, severity, service name, or custom UQL query.
Parameters:
hours(optional): Number of hours to look back (default: 3)search_text(optional): Text to search for in log messages (case-insensitive)severity(optional): Filter by log severity (DEBUG, INFO, WARN, ERROR, FATAL)service_name(optional): Filter by service namequery(optional): Additional UQL query string for advanced filteringlimit(optional): Maximum number of logs to return (default: 100)
Examples:
Documentation
uptrace_get_query_syntax
Get UQL (Uptrace Query Language) syntax documentation. Returns operators, functions, examples, and common patterns for querying spans, logs, and metrics.
Parameters:
None
Example:
Logs
The client provides methods for querying logs (logs are represented as spans with _system = "log:all"):
query_logs()- Query logs with filters by severity, service name, and custom UQL queriesget_error_logs()- Get error logs (ERROR and FATAL severity levels)
Example usage:
Metrics
The client provides methods for querying metrics using PromQL-compatible syntax:
query_metrics()- Query metrics with PromQL-compatible formatquery_metrics_groups()- Query and aggregate metrics by groups
Example usage:
Additional Span Methods
The client also provides additional convenience methods for working with spans:
get_span_by_id()- Get a specific span by its IDget_spans_by_parent()- Get child spans by parent span IDget_spans_by_system()- Filter spans by system type (http, db, rpc, etc.)get_slow_spans()- Get spans exceeding a duration thresholdget_query_syntax()- Get comprehensive UQL syntax documentation
Example:
UQL Query Examples
Uptrace uses a SQL-like query language (UQL). You can get comprehensive syntax documentation using client.get_query_syntax(). Here are some examples:
Filter by status
Filter by service and time
HTTP errors
Group and aggregate
Complex query
Log queries
Metrics queries
Python Client API
The MCP server uses the UptraceClient class internally. You can also use it directly in your Python code:
See examples/query_errors.py for more examples.
Development
Running tests
Code formatting
Type checking
Architecture
Troubleshooting
MCP Server Not Found in Cursor
If you see "No server info found" error in Cursor:
Verify the configuration file path - Make sure you're editing the correct MCP settings file:
macOS:
~/Library/Application Support/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.jsonWindows:
%APPDATA%\Cursor\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.jsonLinux:
~/.config/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
Check the - This is critical! The
cwdmust point to the project root directory (wherepyproject.tomlis located):"cwd": "/full/path/to/uptrace-mcp"Common error:
Poetry could not find a pyproject.toml filemeanscwdis wrong.Check file permissions - Ensure the configuration file is valid JSON and readable
Verify Poetry/Python path - Test the command manually:
cd /path/to/uptrace-mcp .venv/bin/poetry run uptrace-mcp --helpCheck environment variables - Make sure all required variables are set in the
envsection:UPTRACE_URLUPTRACE_PROJECT_IDUPTRACE_API_TOKEN
Restart Cursor - After making changes, completely restart Cursor (not just reload)
Check Cursor logs - Look for error messages in Cursor's developer console or logs
Connection Issues
If you get connection errors:
Verify
UPTRACE_URLis correct and includes protocol (https://)Check that
UPTRACE_PROJECT_IDis a valid numberEnsure
UPTRACE_API_TOKENis valid and not expired
Permission Errors
If you get 403 Forbidden errors:
Verify the token has access to the specified project
Check if SSO is enabled (requires separate API user account)
No Data Returned
If queries return no data:
Check the time range is correct (use UTC timezone)
Verify spans exist in that time period via Uptrace UI
Try a broader query without filters first
Testing the Server Manually
Check configuration:
cd /path/to/uptrace-mcp python check_config.pyTest server startup:
export UPTRACE_URL="https://uptrace.xxx" export UPTRACE_PROJECT_ID="3" export UPTRACE_API_TOKEN="your_token" .venv/bin/poetry run uptrace-mcpThe server should start without errors. Press Ctrl+C to stop it.
Verify MCP protocol: The server communicates via stdio, so you won't see output when run directly. If it starts without errors, it's working correctly.
API Documentation
For more information about Uptrace API and UQL syntax, see:
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.