loggly-mcp is a read-only Model Context Protocol (MCP) server targeting Loggly's /apiv2/* API, with integrated IP intelligence services (RDAP, GreyNoise, AbuseIPDB). It exposes Loggly search, analytics, and field tools, along with aggregation-first traffic tools and IP context tools, while blocking write endpoints.
Purpose This server is used to query Loggly logs in a read-only manner via MCP clients (such as Claude Code), and to perform aggregation analysis and IP intelligence correlation. It is suited for scenarios that require efficient log retrieval, reduced token consumption, and summarization, and is recommended to be used in conjunction with a skill.
Main capabilities
- Loggly read-only API wrapper: low-level tools such as connection_test, search_and_get_events, iterate_events_page, and iterate_events_next.
- Aggregation-first traffic tools: search_logs, traffic_by_ip, traffic_by_host, traffic_by_path, group_by_ip, group_by_path, group_by_user_agent, timeline, sample_events. These tools return summaries (totals, Top-N breakdowns, bucketed timelines, a small number of representative samples) rather than raw event dumps.
- Field discovery: for roles not explicitly overridden (host_field / path_field / status_field / user_agent_field / ip_field parameters, or the LOGGLY_FIELD_HOST / _PATH / _STATUS / _USER_AGENT / _IP environment variables), the tools inspect /apiv2/fields/ and match known role patterns. A unique match is used automatically; when multiple possible matches exist, it does not guess but reports them as ambiguous_fields and falls back to the configured defaults; when there is no match, it falls back to the defaults (host, path, status, user_agent, ip).
- IP intelligence: rdap_lookup (no API key required), ip_reputation (requires GREYNOISE_API_KEY / ABUSEIPDB_API_KEY; when missing, the corresponding source returns available: false), get_ip_context (combines Loggly traffic with IP intelligence, checks across all configured Loggly accounts, and flags cross_domain_correlation).
How to use
- Install from npm and configure the MCP client.
- Run from source: edit .env to fill in Loggly credentials, then run. After trusting the repository in Codex, the MCP server can also be started automatically via .codex/config.toml. The server loads .env from the working directory at startup.
- Environment variables: LOGGLY_SUBDOMAIN (Loggly account subdomain or full URL), LOGGLY_TOKEN (API token), LOGGLY_AUTH_MODE (bearer by default, or basic), LOGGLY_MAX_RETRIES (default 2), LOGGLY_REQUEST_TIMEOUT_MS (default 15000), LOGGLY_LOG_LEVEL (error, warn, info by default, debug).
- Remote HTTP server: edit .env to fill in Loggly credentials and MCP_BEARER_TOKEN (which can be generated with node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"), and start a stateless Streamable HTTP MCP server on port MCP_HTTP_PORT (default 8787). GET /healthz is an unauthenticated liveness check; POST /mcp is the MCP endpoint and requires Authorization: Bearer <MCP_BEARER_TOKEN>, otherwise it returns 401. Loggly credentials remain on the server side, and all connections share the same Loggly account access. MCP_BEARER_TOKEN is only used to control access to the MCP server itself, should be treated as a secret, and should be rotated if leaked. It should only be run behind an internal network/VPN, and not exposed directly to the public internet, because it uses a single sharedToken-based rather than per-user authentication.
- Connecting from Claude Code: each organization member adds the remote server once, replacing it with the deployed internal hostname/port and the assigned token.
- Docker run.
- Multi-account/domain: set LOGGLY_ACCOUNTS to a JSON object mapping account names to credentials. Once set, it replaces LOGGLY_SUBDOMAIN / LOGGLY_TOKEN / LOGGLY_AUTH_MODE. Each tool accepts an optional account parameter to select the account. When account is omitted, LOGGLY_DEFAULT_ACCOUNT is used (if set), otherwise "default", otherwise the only configured account. An unknown account value returns an error and lists the configured account names. iterate_events_next can also infer the account from the next_url host when account is omitted, as long as exactly one configured account matches that host. Existing single-account setups continue to work, treated as an account named "default".
Use cases
- Need to query Loggly logs in a read-only manner and perform aggregate analysis.
- Need to combine IP intelligence (RDAP, GreyNoise, AbuseIPDB) for bot traffic classification and investigation.
- Teams share Loggly access via a remote HTTP server.
- Unified querying across multiple Loggly accounts/domains.
Limitations
- Read-only: write endpoints are blocked.
- IP intelligence output should be used as one of multiple inputs, and identity/reputation data should be weighted lower than behavioral evidence from your own logs.
- The remote HTTP server should only run behind an internal network/VPN, using a single shared token.
- Logs are written to stderr to avoid interfering with MCP stdio traffic.
- Requests have timeout and retry mechanisms; aggregation tools fan out multiple requests via Promise.all, and LOGGLY_MAX_CONCURRENT_REQUESTS (default 4) limits the concurrency per account.
- Tool metadata is stored in tool-manifest.json and validated against src/server.js.
- Smoke tests can run without Loggly credentials via LOGGLY_SMOKE_TEST=1.
- The .env file must never be committed. Tokens and API keys (LOGGLY_TOKEN, LOGGLY_ACCOUNTS, GREYNOISE_API_KEY, ABUSEIPDB_API_KEY, MCP_BEARER_TOKEN) are treated as confidential.
- IP intelligence calls are read-only GET requests to third-party services; Loggly credentials are not sent to them, and IP intelligence keys are not sent to Loggly.