Skip to the page

Guides · Agents & copilots

Coding agents

Set up a repository so a coding agent reads your schema, checks each new query before saving and keeps no secret in 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.

The agent knows the conventions
Your repository documents the layout of a Napalm project: schema, deployed queries, access policies and generated client.
Queries are checked first
The agent compiles each candidate EdgeQL statement against your live schema before writing the query file.
No secret in git
Committed MCP configs invoke napalm mcp, reading your key from local CLI config rather than repository files.
The agent cannot do damage
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 the repository up#

Three CLI commands wire your repository to the project’s MCP tools while keeping every service key outside version control.

Zero-secret repo wiring via napalm init and napalm mcp

napalm init writes project conventions into AGENTS.md and registers napalm mcp <project> in .mcp.json, relaying stdio tool calls with the --read-only key stored in your local CLI config.

Your terminal
# In your repository: the agent's instructions, and its connection to the project.napalm init notes # A key for it, kept in this machine's config and never in the repository.napalm keys create notes --label coding-agent --read-only --save # Let it read the schema and check queries against it.napalm endpoint notes --share-schema
Instructions
napalm init writes a Napalm section into AGENTS.md and makes CLAUDE.md import AGENTS.md. Run napalm init again after an upgrade to update only the Napalm section.
The connection
napalm init also registers the project in .mcp.json, .cursor/mcp.json and .vscode/mcp.json using napalm mcp notes. Those files hold zero secrets and are safe to commit.
The key
--save stores the key in your local CLI config where napalm mcp reads it automatically. Each teammate creates a separate key.
.mcp.json
{  "mcpServers": {    "notes": {      "command": "napalm",      "args": ["mcp", "notes"]    }  }}

Learn the agent’s tools#

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

ToolPurpose
describe_schemaReads your types, links and access rules as written.
check_queryCompiles a statement against the schema and proves whether the statement reads or writes, or returns the compile error. Nothing runs.
explain_queryReports a statement’s cost: run count and duration, or the planner’s estimate for a statement that has not run.
queryRuns a statement and returns the rows. A read-only key cannot write.
describe_reachCounts the rows the active key can read, change and delete in each type.
read_changesReads the change log since a given time, as visible to the active key.
Your deployed queriesEach deployed query is a separate tool that takes variables by name.

The first three tools need the schema shared. query works unless the project’s passthrough is none. MCP server lists every tool and the conditions for each.

Make a change#

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 reads the schema and writes a query

    The agent edits dbschema/default.gel and the files in dbschema/queries like any other code and calls check_query on each statement before saving.

  2. You deploy

    The project’s MCP server cannot change a schema or deploy a query. Schema pushes and deploys are CLI commands that run as you. Either you or the agent runs three commands in your terminal.

    Your terminal
    napalm schema push notes      # the schema, migratednapalm queries push notes     # the queries, deployed by namenapalm generate --lang ts               # a typed call for each query
  3. The agent tries the new query

    A deployed query shows up as a tool on the agent’s next tools/list. With a key that may write, the agent can send is_dry_run to preview a change. A dry run keeps nothing.

Give the agent a branch#

To let an agent test mutations freely, create an isolated branch cloned with --data and issue a branch-scoped key so main stays completely out of the agent’s reach.

Isolated --data branch and branch-scoped key

napalm branches create --data forks schema and rows at /branches/agent-work, pairing with a --branch key that cannot read or mutate main and disappears when the branch is deleted.

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

A saved key always belongs to main, so pass a branch key through the environment. Because branches do not host deployed queries, the agent sends ad-hoc statements on the branch. Delete the branch after merging, and its key is revoked 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 answer lists query, describe_schema, check_query and the other tools, then your deployed queries. Next, ask the agent about your schema. The agent should call describe_schema and answer from your own types.

Type a word or two to search every docs page.