mehendocs

ReferenceAgent reference

Agent reference#

Which tools, templates and AGENTS.md lines does the skill point to?

On this page

The parts of the skill an agent looks up rather than keeps in mind: the MCP tools and their inputs, the templates by group, the per-agent setup commands and a snippet for a repo's AGENTS.md. The rules stay in the skill. The generated pages carry every detail: MCP tools, providers and templates and the ask object.

MCP tools#

Every tool except vault_templates also takes workspace? (a slug or id), needed when this server may use more than one workspace and neither the call nor the checkout decides:

Any result or error that hands over a link carries ask in structuredContent and a resource_link in content; isError stays true for approval_required, needs_reauth, client_missing and timeout. No tool opens a link.

Templates#

Kind api-key, by group:

Kind oauth-client: google-oauth-client, github-oauth-client, microsoft-oauth-client. OAuth providers for mehen connect: google-gmail, google-calendar, google-drive, github-oauth, microsoft-graph.

mehen templates (MCP vault_templates) is the live list, grouped the same way, with what each allows, holds and refuses.

Setup for one agent#

mehen setup --json registers every agent it finds. To register only a named client, use its writer; inspect the report and restart that agent:

mehen setup --agent claude-code --json
mehen setup --agent codex --json
mehen setup --agent pi --json

--mcp-file <path> writes mcpServers.mehen into a compatible JSON client's file; use --agent vscode or --agent opencode for those clients' different formats. mehen setup --print --json prints the entry without writing anything.

AGENTS.md snippet#

Paste this into a repo's AGENTS.md (or CLAUDE.md) when the repo uses Mehen:

## Credentials

This repo uses Mehen. Secrets never appear in this repo, in chat or in your context.

- Never ask a human to paste a secret into chat, and never write one to a file, `.env` or commit.
  If one is pasted, do not use it; say it should be rotated.
- Run `mehen` with `--json`. Variables are declared in `mehen.toml` (committed, no values), which also
  names the project's workspace and vault. Check them with `mehen env check` and run anything that needs
  them with `mehen run -- <cmd>`. Read the `mehen:` line it prints on stderr and stop if the project or
  environment is wrong.
- Production runs need a literal `--env prod` and a human's approval. Never set `MEHEN_ENV=prod`.
- Call authenticated APIs with `mehen fetch <item> <METHOD> <url>` or the `vault_fetch` MCP tool.
  Never set auth headers or put a key or placeholder in a URL or body yourself.
- Missing credential: `mehen request <kind> --name <slug> --provider <template> --home project --reason "<why>"`
  (`--home project` puts it in this checkout's project, so the whole team can use it; without it the
  credential is private to the human), write the human the `ask` (link, what it is for, what to check,
  when it expires), then `mehen wait <id> --timeout 60 --json`. `mehen pending` lists the links still open. Trust only links under
  `https://app.mehen.dev/w/<slug>/` that `mehen` handed over.
- On any refusal, follow the `next` field and relay the `ask` or `next.say` to the human. Exit 3
  means approval required: send the link and the binding code, `mehen wait <approval> --timeout 60 --json`, then repeat
  the same request unchanged. Exit 5 means refused by rule: do not retry or work around it.
- Full guide: `mehen guide`.