← Back to MetaLens

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:
PathPurpose
~/.claude/utils/metalens.jsNode.js CLI helper, talks to the MetaLens REST API
~/.claude/skills/metalens/SKILL.mdSkill definition so Claude Code can auto-invoke it
~/.claude/metalens-config.jsonYour API token, base URL, default connection (chmod 600)
It does not install system packages, does not require sudo, does not run any code outside ~/.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 documents
Run 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"
Claude Code will auto-invoke the skill and route through metalens.js.

Updating

Re-running the installer overwrites metalens.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

SymptomLikely cause
HTTP 401Token is invalid, expired, or revoked. Create a new one.
HTTP 402Out of credits. Buy a pack in Settings or upgrade your plan.
HTTP 503 on search or chatOpenAI embeddings are not configured server-side.
Connection not foundRun metalens connections to list valid IDs and set defaultConnectionId in config.
For anything else, use the in-app feedback button or open an issue.