feat(kodena): add 'kodena logs' command + 'kodena_get_script_logs' MCP tool#72
Merged
Conversation
…logs M3 of PLAN-kodena-script-observability. New top-level command calls the kodena backend's GET /kodena/scripts/:slug/logs (M2) with optional --since (15m/2h/1d) and --level filters, and a --json mode. Renders one line per event (timestamp / level / message / [rayId]); prints a friendly empty-window message instead of erroring when there are no recent events. Uses the shared /kodena/* gateway surface (accepts both a koda_ CLI token and a dashboard JWT) like every other kodena command — NOT /cli/kodena/*, which is CLI-token-only and would lock the M4 dashboard tab out of the same endpoint. Project-scoped: requires an active org + project, sent as x-org-id/x-project-id.
M3 (optional MCP surface) of PLAN-kodena-script-observability. Mirrors the
kodena logs CLI command: calls GET /kodena/scripts/:slug/logs with optional
since/level and returns the normalized { timestamp, level, message, rayId }
events so an agent can debug a deployed tenant function. Registered among the
read-only (M2) tools; registry count assertions bumped 20→21 / 10→11 read.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
M3 of PLAN-kodena-script-observability. Surfaces a deployed Kodena script's native Workers Logs in the terminal and to agents.
What
kodena logs <slug>— reads recent log events (console.*+ per-invocation summaries) for one of the active project's scripts. Flags:--since 15m|1h|1d,--level error|warn|info|log|debug,--json. Renders one line per event (time / level / message /[rayId]); prints a friendly "no logs in the selected window" message instead of erroring on an empty result.kodena_get_script_logstool (same call) so an agent can fetch logs to debug a tenant function.Both call the kodena backend's
GET /kodena/scripts/:slug/logs(the M2 endpoint) on the shared dashboard+CLI/kodena/*gateway surface — which accepts akoda_…CLI token or a dashboard JWT — matching every existing kodena command. (Not/cli/kodena/*, which is CLI-token-only and isn't even wired in the gateway.)Tenant safety
The backend resolves the slug to a row owned by the caller's org + project before reading; a foreign slug 404s with no Cloudflare call. Nothing tenant-crossing here.
Tests
@sawala/kodena103 tests +@sawala/kodena-mcp95 tests pass; workspacetypecheckclean. MCP registry count assertions bumped 20→21 / 10→11 read-only. Changeset included (minor bump for both packages).🤖 Generated with Claude Code