Skip to main content

MCP server for Strayl log search with semantic and exact search capabilities

Project description

Strayl MCP Server

MCP server for semantic and exact log search powered by Strayl.

Features

  • Semantic Search: AI-powered search across your logs using vector embeddings
  • Exact Text Search: Traditional text matching with case-sensitive options
  • Documentation Search: AI-powered semantic search across indexed documentation
  • Time Filtering: Search logs by time periods (5m, 1h, today, yesterday, 7d, etc.)
  • Log Level Filtering: Filter by log levels (info, warn, error, debug)
  • Easy Integration: Works with Claude Desktop, Cline, and other MCP clients

Installation

Install via pipx (recommended):

pipx install strayl-mcp-server

Or via pip:

pip install strayl-mcp-server

Configuration

Get Your API Key

  1. Visit https://strayl.dev
  2. Generate an API key
  3. Copy your API key (starts with st_)

Claude Desktop Configuration

Add to your Claude Desktop config file:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "strayl": {
      "command": "pipx",
      "args": ["run", "--no-cache", "strayl-mcp-server"],
      "env": {
        "STRAYL_API_KEY": "your_api_key_here"
      }
    }
  }
}

Cline/Other MCP Clients

Add to your MCP settings file:

{
  "mcpServers": {
    "strayl": {
      "command": "pipx",
      "args": ["run", "--no-cache", "strayl-mcp-server"],
      "env": {
        "STRAYL_API_KEY": "your_api_key_here"
      }
    }
  }
}

Available Tools

1. search_logs_semantic

Semantic (AI-powered) search across your logs.

Parameters:

  • query (required): Search query in natural language
  • time_period (optional): Time filter (e.g., "5m", "1h", "today", "7d")
  • match_threshold (optional): Similarity threshold (0.0-1.0, default 0.5)
  • match_count (optional): Max results (default 50)

Example:

Search for database connection errors in the last hour

2. search_logs_exact

Exact text matching search across your logs.

Parameters:

  • query (required): Exact text to search for
  • time_period (optional): Time filter
  • level (optional): Log level filter ("info", "warn", "error", "debug")
  • case_sensitive (optional): Case-sensitive search (default false)
  • limit (optional): Max results (default 50)

Example:

Search for exact text "timeout" in error logs from today

3. search_documentation

Semantic (AI-powered) search across indexed documentation.

Parameters:

  • query (required): Search query in natural language
  • source_id (optional): Specific documentation source ID to search within
  • limit (optional): Max results (default 5)
  • use_ai (optional): Use AI to structure the answer (default True)

Example:

Search documentation for "how to authenticate users"

4. list_time_periods

List all supported time period formats.

Time Period Formats

Minutes

  • 5m, 5_minutes, 5_mins - Last 5 minutes
  • 10m, 15m, 30m - Last 10, 15, 30 minutes

Hours

  • 1h, 2h, 6h, 12h - Last 1, 2, 6, 12 hours
  • 24h, last_24_hours - Last 24 hours

Days

  • today - Today from 00:00 UTC
  • yesterday - Full yesterday
  • 7d, last_7_days - Last 7 days
  • 30d, last_30_days - Last 30 days

Usage Examples

With Claude Desktop

Simply ask Claude:

"Search my logs for authentication errors in the last hour"

"Find all database connection issues from today"

"Show me exact text 'null pointer' in error logs"

"Search documentation for how to implement user authentication"

Development/Testing

Run the server directly:

export STRAYL_API_KEY="your_api_key_here"
strayl-mcp-server

Logging Your Application

To send logs to Strayl, use the Strayl Log API:

import httpx

api_key = "st_your_api_key"
api_url = "https://ougtygyvcgdnytkswier.supabase.co/functions/v1"

async def log_message(message: str, level: str = "info", context: dict = None):
    async with httpx.AsyncClient() as client:
        await client.post(
            f"{api_url}/log",
            json={
                "message": message,
                "level": level,
                "context": context or {}
            },
            headers={"Authorization": f"Bearer {api_key}"}
        )

# Usage
await log_message("User logged in", "info", {"user_id": "123"})
await log_message("Database connection failed", "error", {"db": "postgres"})

Troubleshooting

API Key Issues

If you get authentication errors:

  1. Verify your API key starts with st_
  2. Check the API key is correctly set in your MCP config
  3. Ensure there are no extra spaces or quotes around the key

Connection Issues

If the server fails to connect:

  1. Check your internet connection
  2. Verify the Strayl API is accessible
  3. Check for any firewall or proxy issues

No Results

If searches return no results:

  1. Verify you've sent logs to Strayl
  2. Check the time period filter isn't too restrictive
  3. For semantic search, wait a few seconds for embeddings to generate

Support

License

MIT License

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

strayl_mcp_server-0.2.1.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

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

strayl_mcp_server-0.2.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file strayl_mcp_server-0.2.1.tar.gz.

File metadata

  • Download URL: strayl_mcp_server-0.2.1.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.4

File hashes

Hashes for strayl_mcp_server-0.2.1.tar.gz
Algorithm Hash digest
SHA256 dcb1860a72e35361385d2a657a495de8c817252f27dfe2283b832fa1cf609c5d
MD5 d66e45883536defebcf3a11fcac67a64
BLAKE2b-256 d9cdbf43493c4a78e82c7e1fddd8ed89c11cccaf2333e18b95d52d4a8e4f2291

See more details on using hashes here.

File details

Details for the file strayl_mcp_server-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for strayl_mcp_server-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b6b1a0676a155108b16356286321a164eaf7213b69a8bff85358cc7c143b0176
MD5 ddf633f4084dca349a8b2fa94c8ed52a
BLAKE2b-256 88fe5403a22ce01f3ac0cdc7eee1a1dccb4e3a84abf5cd03f8035825949643b6

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