connect

connect is a command for Claude Code from themoah/klag. It costs 20 tokens per session (1,232 once invoked), scanned C, original, Apache-2.0.

A command that connects a running Klag service to an AI client through MCP, a standard way for software to expose callable tools.

In plain words
What is it for?
Use it to connect to a supplied or discovered Klag instance, check its readiness, handle Kubernetes port forwarding, and make consumer-lag queries available to the AI client.
Why use it?
It removes the manual work of finding Klag's endpoint, checking that it is ready, and registering the connection with the required settings.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: names the AskUserQuestion tool; mentions Claude Code; reads ~/.codex paths.

Part of the klag plugin — 1 skill, 3 commands shipped together

Good fit Use it to connect to a supplied or discovered Klag instance, check its readiness, handle Kubernetes port forwarding, and make consumer-lag queries available to the AI client.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/themoah/klag/connect
View source ↗ themoah/klag
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/themoah/klag

Made for: Claude Code.

Or install klag, the plugin that ships this one along with the rest of its 1 skill, 3 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for connect

README.md
[![agentmods](https://agentmods.dev/badge/commands/themoah/klag/connect/github.svg)](https://agentmods.dev/commands/themoah/klag/connect)
Your own site
<a href="https://agentmods.dev/commands/themoah/klag/connect"><img src="https://agentmods.dev/badge/commands/themoah/klag/connect/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for connect

Your own site · 80×15
<a href="https://agentmods.dev/commands/themoah/klag/connect"><img src="https://agentmods.dev/badge/commands/themoah/klag/connect.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 20 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,232 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 3 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00020 $0.01232
Opus 5.5 $0.00008 $0.00493
Sonnet 5.5 $0.00004 $0.00246
Haiku 4.5 $0.00002 $0.00123

Measured 1mo ago against content hash 121df058e6e1, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

connect scanned grade C with 3 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

- Codex — `~/.codex/config.toml`: `[mcp_servers.klag]` with `url` and

Reads MCP configurationmediumAgent snooping

mcp.json carries server URLs and auth tokens; reading it lets a mod discover and abuse other integrations.

- Cursor — `~/.cursor/mcp.json`: `{"mcpServers":{"klag":{"url":"<url>/mcp","headers":{"Authorization":"Bearer <token>"}}}}`

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -s -o /dev/null -w '%{http_code}\n' "$KLAG_URL/readyz"
plugin/commands/connect.md · 90 lines

How it starts

The opening of the file, as written. The whole thing — 90 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Wire the user's running Klag into their AI client over MCP. URL hint: $ARGUMENTS.

Klag's MCP is read-only and served from an in-memory snapshot — it never queries Kafka on demand. Tools: list_consumer_groups, get_consumer_group_lag, find_lagging_groups, diagnose.

1. Find the endpoint

If $ARGUMENTS has a URL, use it. Otherwise look for a running Klag. Export the result as KLAG_URL (and NS for the namespace) so the commands below stay quoted and copy-pasteable:

docker ps --filter ancestor=themoah/klag --format '{{.Names}} {{.Ports}}'
kubectl get deploy -A -l app.kubernetes.io/name=klag 2>/dev/null

For a cluster install, start a port-forward (confirm first) and use http://localhost:18888:

kubectl -n "$NS" port-forward svc/klag 18888:8888

A port-forward dies with the shell — tell the user the registration points at a tunnel they must keep open, and that a real setup should expose Klag through a Service/Ingress and register that URL instead.

2. Check the prerequisites

curl -s -o /dev/null -w '%{http_code}\n' "$KLAG_URL/readyz"
# Drop the Authorization line when MCP_AUTH_TOKEN is unset — do not send the literal placeholder.
curl -s -X POST "$KLAG_URL/mcp" -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $KLAG_MCP_TOKEN" \
  --data '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
  • 404 on /mcp → MCP_ENABLED is not true. Offer to enable it (mcp.enabled=true in the chart, -e MCP_ENABLED=true for docker) and redeploy.
  • 401 → MCP_AUTH_TOKEN is set; get the token from the user or read it from the Secret with their confirmation. Never print it back.
  • 405 → that was a GET; MCP here is POST only.
  • Empty snapshot → the collector has nothing to publish. Check in this order: METRICS_REPORTER is set (default none means no collection at all), /metrics actually has klag_consumer_lag series, METRICS_GROUP_FILTER / METRICS_GROUP_EXCLUDE do not exclude every group, and the cluster really does have groups with committed offsets. Only the first needs a redeploy.

Read the full file on GitHub · 90 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 90 lines · 20 tokens per session scan C 121df058e6e1

Subscribe to this mod's changes

connect is a command published in the GitHub repository themoah/klag (88 stars, last pushed 5d ago), licensed Apache-2.0. It adds 20 tokens to every session and 1,232 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it C with 3 findings (reads agent configuration directories, reads mcp configuration, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.