agentleFS
engine9-aiengine9-ai/skills/e9-api-key/SKILL.md

e9-api-key

Skill1 starsChanged 48 days agoApache-2.0View on GitHub

Create and manage engine9 API keys (e9key_ / e9publickey_) — generic non-session auth whose scopes gate HTTP APIs (public signup/payment forms, inbound, Task API, and other routes). MCP apiKey covers catalog, list, get, create, update, revoke, rotate, SqlApiKeyStore (hash only), and a key-management UI. Use when working with API keys, e9key, e9k, scopes, rotate/revoke, public forms, or a keys admin screen.

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Rule: Never send an e9key_ or e9publickey_ credential to MCP.

    line 25
  2. Very specific:

    Rule: Do not schedule SQLWorker.createApiKey (or rotate/revoke) via MCP task.

    line 45
  3. Very specific:

    Create (plaintext in key, shown_once: true):

    line 103
  4. Distinctive:

    Update permissions without rotating:

    line 125

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

engine9 API keys

engine9 API keys provide generic authentication for non-session HTTP callers, including public forms, inbound integrations, data routes, and the Task API. Use this skill to create, scope, rotate, revoke, or integrate e9key_ and e9publickey_ credentials. MCP and console users authenticate through sessions instead; API keys are for machines and other HTTP clients.

Quick reference

NeedUse
Discover scopes and form fieldsMCP apiKey with command: catalog
Create or manage a keyMCP apiKey with create, update, rotate, or revoke
Authenticate an HTTP requestAuthorization: Bearer <key> plus X-ENGINE9-ACCOUNT-ID
Schedule tasksGrant tasks:read and/or tasks:schedule
Use a public formGrant public and only the required write scopes

Rule: Never send an e9key_ or e9publickey_ credential to MCP.

Concepts

There is one key model; scopes decide what a key can do. The Task API is one consumer, not the definition of a key.

Typical callers:

  • Public signup and payment forms (public, people:write, …)
  • Site / inbound HTTP (people:write, tables:write, data:read)
  • Machine integrations, including scheduling work (tasks:read, tasks:schedule)

MCP (POST /mcp) stays on Firebase / session / localdev. That path is distinct. Keys remain the common mechanism for HTTP APIs: Authorization: Bearer e9key_… (or e9publickey_…) plus X-ENGINE9-ACCOUNT-ID. Do not send e9key_ to MCP, and do not send MCP session tokens to key-authenticated routes.

Humans manage keys through MCP apiKey. Machines use the issued secret on HTTP.

Storage and verification always go through @engine9/core (SqlApiKeyStore in the account api_key table). MCP does not invent a second store. Only the SHA-256 hash is retained; plaintext is returned once on create and rotate.

Workflow

Rule: Do not schedule SQLWorker.createApiKey (or rotate/revoke) via MCP task; the plaintext key would land in task run output.

NeedCall
Known scopes + form fieldsapiKey command: catalog (no account_id)
Keys on an accountapiKey command: list
One key (no secret)apiKey command: get + id
New keyapiKey command: create — show key to the user immediately
Change name / scopes / role / expiry / activeapiKey command: update (does not rotate the secret)
DisableapiKey command: revoke
New secretapiKey command: rotate — show key once; old id is revoked

CLI fallbacks (no MCP): server WorkerRunner e9 sqlworker createApiKey / listApiKeys / updateApiKey / revokeApiKey / rotateApiKey on a server account, or core npx e9 create-api-key on a core-only site (@engine9/core bin/e9.js — not the same binary as server bin/e9; see @engine9/core README “The e9 CLI”).

Scopes

The scope list is the permission model. The same key type covers forms, inbound, reads, and tasks; attach only the scopes that surface needs. Keys must list scopes at creation. Empty scopes deny every check. admin grants all scopes. Prefix follows scopes at create/rotate: public → e9publickey_…, otherwise e9key_…. Changing scopes later does not change an existing key's prefix — rotate if you need the other prefix.

Rule: Grant only the scopes required by the calling surface; empty scopes deny every permission check, while admin grants all scopes.

ScopeSurfaceAllows
people:writeCore POST /peopleInbound people pipeline
tables:writeCore POST /upsert/:tableAllowlisted table upserts
data:readCore GET /read/:nameConfigured reads
tasks:readTask APIList/read flows and run status
tasks:scheduleTask APISchedule and control work
adminAnyAll scopes
publicInbound / formsPublic ingest (e9publickey_ prefix)

Constants: SCOPES from @engine9/core. Canonical list for UIs: MCP apiKey command: catalog → scopes[].

A public signup or payment form typically needs:

public,people:write

A partner that discovers flows and schedules tasks needs:

tasks:read,tasks:schedule

MCP examples

Catalog (build the permissions form from this — do not hardcode scopes):

{ "command": "catalog" }

List:

{ "account_id": "<account_id>" }

Create (plaintext in key, shown_once: true):

{
  "command": "create",
  "account_id": "<account_id>",
  "name": "public-signup",
  "scopes": ["public", "people:write"]
}

Task-API partner (same key model, different scopes):

{
  "command": "create",
  "account_id": "<account_id>",
  "name": "partner-tasks",
  "scopes": ["tasks:read", "tasks:schedule"]
}

Update permissions without rotating:

{
  "command": "update",
  "account_id": "<account_id>",
  "id": "<key_id>",
  "scopes": ["tasks:read"]
}

Rotate / revoke: pass command and id. Rotate copies metadata when omitted.

List returns keys[]. Get/update/revoke return record. None of those include plaintext or key_hash. Create/rotate include plaintext in key once (shown_once: true) — display it and do not write it to files, chat logs, or task output.

Auth

  • Managing keys: signed-in MCP user with access to account_id (same gate as sql / task).
  • Using keys: Authorization: Bearer e9key_… + X-ENGINE9-ACCOUNT-ID on any HTTP route that verifies layer-1 keys (core site APIs, public forms, Task API, and other scoped endpoints). MCP POST /mcp does not accept e9key_ keys.

CLI (when MCP is not available)

e9 sqlworker createApiKey -a <account_id> --name partner-tasks --scopes tasks:read,tasks:schedule
e9 sqlworker listApiKeys -a <account_id>
e9 sqlworker updateApiKey -a <account_id> --id <key_id> --scopes tasks:read
e9 sqlworker rotateApiKey -a <account_id> --id <key_id>
e9 sqlworker revokeApiKey -a <account_id> --id <key_id>

Core-only (no accounts.d):

npx e9 create-api-key --db sqlite://./engine9.db --name website --scopes admin

Related documentation

TopicDocumentation
MCP login and tool behaviore9-mcp
Task API authenticationauthentication.md
Task API workflowse9-tasks-api
Key-management UI contractui.md

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.