MetaLens Skill for Claude Code / OpenClaw
A small CLI helper that gives Claude Code agents (local, Docker, OpenClaw, CI) programmatic access to your MetaLens instance.The installer is open source and lives at metalens.it/install/metalens.sh. Read it before running.What this installs
The installer writes three files into your home directory under~/.claude:| Path | Purpose |
|---|---|
~/.claude/utils/metalens.js | Node.js CLI helper, talks to the MetaLens REST API |
~/.claude/skills/metalens/SKILL.md | Skill definition so Claude Code can auto-invoke it |
~/.claude/metalens-config.json | Your API token, base URL, default connection (chmod 600) |
~/.claude. The script is plain bash, ~140 lines.Recommended install (review before running)
# 1. Download the installer from metalens.it curl -fsSL https://metalens.it/install/metalens.sh -o metalens.sh # 2. Inspect it (optional but encouraged) less metalens.sh # 3. Verify checksum (optional) shasum -a 256 metalens.sh # Expected: 3f7d5de5925be9fee1e428c9e48b9fa124947dd695cfc40c2c6aef185f645053 # 4. Run with your API token bash metalens.sh --token mlns_your_token_here
Getting an API token
1.Sign in at metalens.it/login.
2.Open Settings, scroll to API Tokens.
3.Click + New Token, give it a name (e.g.
OpenClaw bot).4.Copy the
mlns_... value once shown. It is not stored in plaintext on the server, so we cannot show it again.Available commands after install
node ~/.claude/utils/metalens.js <command> [args] [--json] connections List Metabase connections xray latest [connection] Latest X-Ray scan health grade + insights search "<query>" [connection] Semantic search across cards and dashboards chat "<question>" [connection] Natural-language question, returns SQL gaps [connection] Latest gap analysis review "<sql>" Review SQL for performance issues tree list [connection] List metric trees tree get <tree-id> Show a single metric tree tree generate [connection] Generate a new metric tree (5 credits) tree share <tree-id> Create a public share link kb list [connection] List knowledge base documentsRun
node ~/.claude/utils/metalens.js help to see all flags.Environment variables
If you prefer not to store the token in~/.claude/metalens-config.json, set it per-shell instead:•
METALENS_TOKEN — API token•
METALENS_BASE_URL — defaults to https://metalens.it•
METALENS_CONNECTION_ID — pre-set default connection UUID•
CLAUDE_DIR — install target (default: $HOME/.claude)Using inside OpenClaw (Docker)
Find your container, then run the installer inside it:docker ps | grep openclaw docker exec -it YOUR_OPENCLAW_CONTAINER bash -lc ' curl -fsSL https://metalens.it/install/metalens.sh -o /tmp/metalens.sh bash /tmp/metalens.sh --token mlns_your_token_here 'After the skill is installed, you can mention OpenClaw in Slack or Telegram with natural-language questions:
•"find all Metabase questions about churn"
•"what is the current X-Ray health grade?"
•"generate a metric tree for my Metabase, industry: marketplace"
•"show me the latest gap analysis"
metalens.js.Updating
Re-running the installer overwritesmetalens.js and SKILL.md with the latest versions and backs up your config to metalens-config.json.bak:curl -fsSL https://metalens.it/install/metalens.sh -o metalens.sh bash metalens.sh --token "$(jq -r .apiToken ~/.claude/metalens-config.json)"
Security notes
•API tokens are SHA-256 hashed on the server. We store the hash, never the plaintext.
•Tokens can be revoked at any time from Settings.
•A token has the same permissions as your user account, including credit usage. Treat it like a password.
•Do not commit tokens to git, paste them in chat, or share them by email. Rotate immediately on suspected compromise.
•The config file is written with
chmod 600 so only your user can read it.Troubleshooting
| Symptom | Likely cause |
|---|---|
| HTTP 401 | Token is invalid, expired, or revoked. Create a new one. |
| HTTP 402 | Out of credits. Buy a pack in Settings or upgrade your plan. |
HTTP 503 on search or chat | OpenAI embeddings are not configured server-side. |
Connection not found | Run metalens connections to list valid IDs and set defaultConnectionId in config. |