Skip to main content
Glama
okta-logs-mcp
by barneslardo

okta-logs-mcp

A small, read-only MCP server for the Okta System Log, designed to sit behind the Okta Agent Gateway so an AI agent (for example a Microsoft 365 Copilot declarative agent) can answer questions about Okta activity while Okta governs and audits every call.

No dependencies beyond Node.js ≥ 20. One file of config, two tools, an end-to-end test against a fake Okta.

Why this exists

Okta API scopes such as okta.logs.read can only be issued by an org's org authorization server. An Agent Gateway authenticates agents against a custom authorization server, which can't issue okta.* scopes, so the gateway can't obtain a System Log token on the agent's behalf.

This server splits the two hops:

AI agent ──(token from the gateway's custom AS, scope: logs.read)──▶ Okta Agent Gateway
        ──▶ okta-logs-mcp  (validates that token: signature, issuer, audience, scope, optional client allow-list)
        ──(its own API Services app: client credentials + private key, scope: okta.logs.read)──▶ Okta System Log API
  • The gateway decides which agents and users may reach the tools, and logs each call.

  • This server holds a read-only Okta credential and only ever calls GET /api/v1/logs.

  • Each tool call is written to stdout as a JSON audit line (tool, outcome, caller sub, client ID, duration). Tokens are never logged.

Related MCP server: Okta MCP Server

Tools

Tool

What it does

query_okta_logs

Returns matching events (newest first by default), slimmed to the useful fields: time, event type, message, outcome + reason, actor, client IP/location, targets. Filters: since, until (ISO 8601 or 15m / 24h / 7d), event_type, event_type_prefix, actor, target, outcome, keyword, raw filter; limit up to 200.

summarize_okta_logs

Counts events in a window: by event type and outcome, top actors, top failure reasons, top source IPs. Good for "what's going on?" questions.

Both are annotated readOnlyHint: true. The server supports MCP protocol versions 2025-11-25, 2025-06-18, 2025-03-26 and 2024-11-05 over Streamable HTTP (stateless, JSON responses).

Setup

Okta's admin console labels change over time (and the Agent Gateway / MCP server screens are Early Access); the steps below describe the intent, so match them to what your console shows.

1. Okta: an API Services app for the System Log (outbound credential)

  1. Applications → Applications → Create App Integration → API Services. Name it, e.g. okta-logs-mcp.

  2. Client Credentials → Edit → Client authentication: Public key / Private key → Add key → Generate new key. Save the private key (PEM) straight into your secret store. Note the key's KID.

  3. Okta API Scopes tab → Grant okta.logs.read (nothing else).

  4. Admin roles tab → assign Read-Only Administrator (or a custom role limited to reading the System Log).

  5. DPoP: new API Services apps often have Require Demonstrating Proof of Possession (DPoP) turned on. The server handles DPoP automatically (OKTA_DPOP=auto), so you can leave it on.

2. Okta: the custom authorization server the gateway uses (inbound tokens)

On the custom authorization server your Agent Gateway uses (Security → API → Authorization Servers):

  1. Scopes → Add scope logs.read (any name works; set AUTH_REQUIRED_SCOPE to match).

  2. Access Policies: make sure the rule covering your agent / gateway client allows logs.read.

  3. Note the server's Issuer (AUTH_ISSUER) and Audience (AUTH_AUDIENCE) from its Settings tab.

3. Deploy

Any host that gives the container a public HTTPS URL reachable by Okta works. Configure it with the variables in .env.example; keep the private key in the host's secret store, never in the image or the repo.

docker build -t okta-logs-mcp .
docker run -p 8080:8080 --env-file .env -v /path/to/secrets:/run/secrets:ro okta-logs-mcp

Example: Azure Container Apps (placeholders in <>):

az containerapp up --name okta-logs-mcp --resource-group <rg> --location <region> --source . --ingress external --target-port 8080
az containerapp secret set --name okta-logs-mcp --resource-group <rg> --secrets okta-private-key="$(cat <path-to-private-key.pem>)"
az containerapp update --name okta-logs-mcp --resource-group <rg> --set-env-vars OKTA_PRIVATE_KEY=secretref:okta-private-key OKTA_ORG_URL=<https://your-org.okta.com> OKTA_CLIENT_ID=<api-services-client-id> OKTA_KEY_ID=<kid> AUTH_ISSUER=<custom-as-issuer> AUTH_AUDIENCE=<custom-as-audience> AUTH_REQUIRED_SCOPE=logs.read RESOURCE_URL=https://<app-fqdn>/mcp

Check it: GET https://<host>/healthz → {"ok":true}, and GET https://<host>/.well-known/oauth-protected-resource/mcp shows your issuer and scope.

4. Okta: register it behind the Agent Gateway

  1. Applications and Resources → MCP Servers → Add a custom MCP server with resource URL https://<host>/mcp.

  2. Authorization servers → Add → Okta custom authorization server → the server from step 2, scope logs.read.

  3. Discover tools; you should see query_okta_logs and summarize_okta_logs.

  4. On your Agent Gateway, add the server as a resource connection and, if you like, restrict which agents may call which tools.

  5. Optional hardening: set AUTH_ALLOWED_CLIENT_IDS to the client ID(s) that appear as cid in tokens the gateway sends.

5. Agent

If the agent discovers tools at runtime, it picks the tools up automatically. A line in its instructions helps, e.g. "You can read the Okta System Log with summarize_okta_logs and query_okta_logs. Only read; never change anything."

Configuration

See .env.example. Required: RESOURCE_URL, AUTH_ISSUER, AUTH_AUDIENCE, OKTA_ORG_URL, OKTA_CLIENT_ID, and OKTA_PRIVATE_KEY_FILE or OKTA_PRIVATE_KEY.

Test

npm test

Runs the server against a local fake Okta (authorization server + System Log API, with and without DPoP) and checks token validation (signature, issuer, audience, expiry, scope, client allow-list), protocol negotiation, both tools, pagination, input validation and that no tokens reach the logs. No network or real credentials needed.

Security notes

  • Read-only by design: the only outbound call is GET /api/v1/logs on the configured org; pagination links to any other host are refused.

  • Least privilege: grant the API Services app only okta.logs.read and a read-only admin role.

  • Tool inputs that build filter expressions reject quotes and backslashes; the raw filter input is passed to Okta as a read-only query.

  • The System Log itself can contain personal data (logins, IPs, locations). Decide who may reach these tools in the gateway's policies accordingly.

  • Okta keeps 90 days of System Log; older windows are clipped. Okta's API rate limits apply (the server reports 429s with the retry time).

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to manage Okta users, groups, applications, policies, and logs through natural language commands.
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables natural language management of Okta organizations, allowing users to perform administrative tasks such as user management, group operations, and application monitoring through AI agents.
      Apache 2.0
    • A
      license
      C
      quality
      B
      maintenance
      Enables AI assistants to manage Okta users, groups, applications, policies, group rules, and system logs through the Okta API. Includes dry-run safety guardrails, confirmation flags, and a read-only inspection mode.
      69
      MIT