Skip to the page

Guides · Agents & copilots

Coding agents

Configure a repository so coding agents inspect your schema, typecheck every new query before saving and keep credentials out of git.

API
—
In the schema
—

What you’ll build#

You will connect a coding agent such as Claude Code or Cursor so it reads your live schema, type-checks every query before saving and keeps secrets out of git across four guarantees.

Project conventions
Your repository documents the layout of a Napalm project: schema, deployed queries, access policies and generated client.
Checked queries
The agent compiles each candidate EdgeQL statement against your live schema before writing the query file.
Zero secrets in git
Committed MCP configs invoke napalm mcp, reading your key from local CLI config rather than repository files.
Read-only by default
The agent starts with a --read-only key while schema pushes and query deploys stay in your terminal.

Before you start#

You need a project and the napalm CLI signed in with napalm login. Use any editor or coding agent with MCP support, such as Claude Code, Cursor or VS Code.

Set up the repository#

napalm init configures your editor and coding agent against the project’s MCP server while keeping every service key outside version control.

Local CLI bridge

Editors invoke the local CLI subprocess while service keys stay outside git.

Run three commands from your repository root to generate agent instructions, store a read-only key locally and turn on schema inspection:

Your terminal
# Write agent instructions into AGENTS.md and register the local MCP bridge.napalm init notes # Create a read-only service key and store it in your local CLI config.napalm keys create notes --label coding-agent --read-only --save # Allow the agent to inspect your schema and type-check candidate queries.napalm endpoint notes --share-schema

Each step writes to a distinct location so teammates share project setup without sharing credentials:

Agent instructions
napalm init writes a Napalm section into AGENTS.md and configures CLAUDE.md to import AGENTS.md. Re-run napalm init after upgrading the CLI to refresh that section.
MCP config
napalm init also registers napalm mcp notes in .mcp.json, .cursor/mcp.json and .vscode/mcp.json. Those files contain zero secrets and are safe to commit.
Local service key
--save stores the key in your local CLI config where napalm mcp reads it automatically. Each teammate creates an individual key.

Because the generated .mcp.json passes only the project slug to napalm mcp, you can commit the file directly:

.mcp.json
{  "mcpServers": {    "notes": {      "command": "napalm",      "args": ["mcp", "notes"]    }  }}

Inspect the MCP tools#

Sharing the schema unlocks compiler-backed MCP tools so the agent validates types, access rules and query plans before saving files.

ToolPurpose
describe_schemaReturns your schema types, links and access policies.
check_queryType-checks an EdgeQL statement against the live schema and reports whether the statement reads or writes without executing it.
explain_queryReturns execution counts and latency for past queries, or the planner estimate for a new statement.
queryExecutes an EdgeQL statement and returns JSON rows. Read-only keys reject writes before execution.
describe_reachCounts the rows the active credential can read, update and delete per type.
read_changesReads committed changes since a timestamp or cursor under the active credential’s policies.
Deployed queriesExposes each offered deployed query as a named tool with typed variables.

The first three tools require --share-schema, and query requires passthrough all or keys. MCP server documents every tool and availability rule.

Edit, check and deploy#

The project’s MCP endpoint inspects and queries data but never mutates your schema or deploys query files, keeping deploys explicit in your terminal.

  1. The agent edits and type-checks locally

    The agent edits dbschema/default.gel and dbschema/queries/*.edgeql, calling check_query to validate each statement before saving.

  2. You push and deploy from the terminal

    Review the edited schema and .edgeql files in git, then push the migration, deploy named queries and regenerate your typed client:

    Your terminal
    napalm schema push notes      # apply schema changesnapalm queries push notes     # deploy .edgeql files by namenapalm generate --lang ts               # generate the typed client
  3. The agent tests the deployed tool

    Each newly deployed query appears on the agent’s next tools/list call. Callers with write access can pass is_dry_run: true to preview row diffs inside a rolled-back transaction.

Give the agent a branch#

When an agent needs to test writes or destructive edits, isolate its work on a disposable branch so main stays completely out of the agent’s reach.

Isolated agent branches

Branch keys restrict mutations to a cloned branch and never reach main.

Clone the schema and existing rows with --data, mint a key scoped to that branch and export both environment variables in the shell where your agent starts:

Your terminal
napalm branches create notes agent-work --datanapalm keys create notes --label coding-agent --branch agent-work # Point napalm mcp at the branch in this shell.export NAPALM_KEY=ndb_…export NAPALM_PROJECT_URL=https://notes.napalmdata.com/branches/agent-work

Saved CLI keys target main, so branch keys connect through NAPALM_KEY and NAPALM_PROJECT_URL instead. Branches run ad-hoc queries rather than deployed queries, and deleting a branch revokes its keys automatically.

Check the connection#

Your terminal
curl https://notes.napalmdata.com/mcp \  -H "Authorization: Bearer $NAPALM_KEY" \  -H "Content-Type: application/json" \  -d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/list" }'

The response lists query, describe_schema, check_query and your deployed queries. Ask your coding agent to summarize the project’s schema and confirm that it calls describe_schema to inspect your types.

Type a word or two to search every docs page.