Documentation forLoggly

Loggly MCP server

The Loggly MCP server allows you to access and analyze Loggly logs through AI-assisted developer tools using natural-language prompts. Instead of writing Loggly queries or working directly in the Loggly interface, you can ask your AI assistant questions about your logs. The MCP server sends the request to Loggly, retrieves the relevant log data, and returns structured results that the AI assistant can interpret and analyze.

The MCP server is self-hostable and can run locally, in a customer environment, or on a staging server.

After you configure and connect the MCP server to an AI client, you can use natural-language prompts to perform tasks such as:

  • Show the last 20 errors from the payments service.

  • Find errors that occurred during the past hour.

  • Show all log events for a specific request ID.

  • Identify the most common values for a log field.

  • Search logs for a specific term, such as timeout.

  • Calculate statistics for a numeric log field.

The MCP server provides read-only access to Loggly. It does not modify or delete log data.

Prerequisites

Before you set up the Loggly MCP server, make sure you have:

  • A Loggly account with a valid reading API token.

  • Your Loggly product domain or subdomain.

  • Docker.

  • An MCP-compatible AI client, such as Claude, GitHub Copilot, Cursor, or ChatGPT.

Configure Loggly credentials

The MCP server uses two environment variables to authenticate with Loggly:

  • SERVER_TOKEN — Your Loggly reading API token.

  • PRODUCT_DOMAIN — Your Loggly product domain or subdomain.

Store these values as environment variables rather than entering API credentials directly into prompts, configuration files, or shared notes.

macOS

  1. Open ~/.zshrc in a text editor.

  2. Add the following environment variables:

  3. export SERVER_TOKEN=<your_loggly_reading_api_token>

  4. export PRODUCT_DOMAIN=<your_product_domain>

  5. Save the file.

  6. Reload the shell configuration:

  7. source ~/.zshrc

  8. Start your AI client or IDE after the variables are configured.

Linux

  1. Open the system environment file:

  2. sudo nano /etc/environment

  3. Add the following variables:

  4. SERVER_TOKEN=<your_loggly_reading_api_token>

  5. PRODUCT_DOMAIN=<your_product_domain>

  6. Save the file.

  7. Log out and log back in, or restart the system, to apply the changes.

Windows

  1. Open Command Prompt as an administrator.

  2. Run the following commands:

  3. setx SERVER_TOKEN "<your_loggly_reading_api_token>" /M

  4. setx PRODUCT_DOMAIN "<your_product_domain>" /M

  5. The /M option creates the variables at the system level.

  6. Close the Command Prompt window.

  7. Open a new terminal or restart your AI client so that the environment variables are available.

Never paste your Loggly API token into an AI prompt or shared configuration. Keep credentials outside the AI model's accessible context whenever possible.

Set up the MCP server

You can run the MCP server locally using Docker, which lets you have an isolated, containerized deployment. SeeConfigure an AI Client to use the Loggly MCP server for more information on configuring MCP.

Configure your MCP client

When running the server locally, the MCP endpoint is:

http://localhost:8000/mcp

Your client's mcp.json configuration must point to the appropriate MCP server URL.

See Configure an AI Client to use the Loggly MCP server for more information on configuring your server with a specific AI tool.

Verify the connection

After configuring the client and starting the MCP server, send an MCP request to confirm that the connection works.

For example, "Show me the last 10 log entries from my Loggly account", "Are there any errors in the logs from the past hour?", or "Search my logs for the term "timeout"."

A successful response confirms that:

  • The MCP client can reach the server.

  • The MCP server can authenticate with Loggly.

  • The request was sent to Loggly.

  • Loggly returned results.

  • The MCP server returned the results to the AI client.

If the connection fails, verify the following:

  • The MCP server is running and reachable at http://localhost:8000/mcp.

  • SERVER_TOKEN contains a valid Loggly reading API token.

  • PRODUCT_DOMAIN contains the correct Loggly product domain.

  • Your MCP client configuration points to the correct server URL.

  • You started a new terminal or application after setting the environment variables.

Safety guardrails

The MCP server applies limits at the server level to prevent excessive queries, unpredictable token usage, and unnecessary load.

Constraint Limit
Maximum events per search_logs request 200
Maximum query time range 7 days
Maximum error groups 25
Maximum get_field_values result 50
Pagination cursor lifetime

10 minutes

Request timeout

30 seconds

When a request exceeds a limit, the server returns a structured error and, where appropriate, suggests how to narrow the request.