Skip to content

Latest commit

 

History

History
141 lines (115 loc) · 14.8 KB

API.md

File metadata and controls

141 lines (115 loc) · 14.8 KB

NerveForge API (generated)

English · Русский

This file is produced by python3 scripts/gen_api_doc.py from the live route table (src/nerveforge/http/router.py). Do not edit it by hand: CI fails when the document drifts from the code (python3 scripts/gen_api_doc.py --check).

Every protected route requires Authorization: Bearer <TOKEN>. Without a token only the panel, /api/health, /api/docs, /llms.txt, /api/agent-prompt and the public uploads are reachable. Bodies are JSON objects; errors are {"error": "..."} with a 400/401/403/404/405/409/429 status.

Panel and self-documentation

Method Path Token Purpose
GET /, /index.html, /static/*, /assets/* No Panel. index.html plus every asset under /static/ and /assets/; only .html, .css, .js, .json, .svg, .png, .webp, .ico, .woff2. No token.
GET /llms.txt, /api/docs, /docs No Agent documentation. Markdown API manual (same text as /api/docs).
GET /api/agent-prompt No Agent prompt. Ready-made system prompt and endpoint list.
GET /api/health No Liveness probe. {"ok": true}; used by the tunnel at startup.
GET /api/admin-hint No Admin listener address. local_admin_url of the loopback listener. Public, and says nothing about the token: the panel needs the address before it can ask for one.

State and limits

Method Path Token Purpose
GET /api/quick Bearer State summary. Platform, shells, tunnel, full access, limits, upload allowlist, local_admin_url, phrase.
GET /api/limits Bearer Read limits. Current command/output/body limits.
POST /api/limits Bearer Set limits. max_command_mb, max_output_mb, max_body_mb; 0 and false are rejected.
GET /api/state Bearer Queue state. Approval queue and the YOLO/full-access flags.
GET /api/events Bearer Events. Ring buffer of upload and configuration events.
GET /api/requests Bearer HTTP journal. Recent requests, ?limit= up to 1000.
GET /api/system/report Bearer System report. OS, shells, sandbox, configuration paths.

Tunnel

Method Path Token Purpose
GET /api/tunnel Bearer Tunnel state. mode, url, updated_at, pending (a request is queued), error (why the last switch failed, or null).
POST /api/tunnel/config Bearer Switch tunnel. `{"mode": "cloudflared"
GET /api/tunnel/provider Bearer Tunnel provider status. Where cloudflared comes from: installed_here, path, source (downloaded
POST /api/tunnel/install Bearer Download cloudflared. {"force": bool} (optional; anything else is a 400). Fetches the latest release, verifies the SHA-256 from the same GitHub response, and writes it to the data directory with mode 0700 — no root, no PATH change. Answers 201 with path, version, sha256; 200 {"skipped": true} when a copy is already there and force was not set; 409 when the download fails or the digest does not match, and no partial file is left behind. Takes 20-60 s (~40-55 MB).

Skills and tools

Method Path Token Purpose
GET /api/skills Bearer Skills. The skill catalogue with readiness computed from what is installed: ready, partial (a required tool is missing) or blocked. Each row names the missing tools, so an agent can see what this machine can actually do.
GET /api/skills/* Bearer Read a skill. One skill with its full procedure in body, plus note: advice built from the tool registry (what to install, or where to stop).
GET ^/api/skills/[^/]+/[Ss][Kk][Ii][Ll][Ll]\.md$ Bearer One skill as SKILL.md. /api/skills/<id>/SKILL.md — text/markdown: the agent-skills standard file for this skill, front matter included. /skill.md and /SKILL.md both answer. Drop it into .agents/skills/<id>/ and another client has the same procedure.
GET /api/skills/bundle Bearer Every skill as SKILL.md. {version, skills: [{id, path, content}]} — the whole catalogue ready to be written to disk in one request.
GET ^/api/skills/[^/]+/validate$ Bearer Check a skill against the spec (path /api/skills//validate). {valid, problems}: the name rules, the 1024-character description limit and whether the folder, the file and the name agree.
GET /api/skills/sources Bearer Skill sources on GitHub. ?q= searches GitHub for SKILL.md files that mention the words and ranks them by repository stars, the author's following and the last commit, halved for a file that does not talk about the query. The only skills route that reaches the network; at most eight files are read per search.
POST /api/skills/downloaded Bearer Install a skill from GitHub. {"repository", "path"}. Re-reads the file from GitHub, checks its front matter and writes <data>/skills/<name>/SKILL.md. Refuses a name that breaks the Agent Skills rules.
GET /api/skills/downloaded Bearer Downloaded skills. What was installed from GitHub, with the repository, star count and date recorded at install time.
DELETE/POST ^/api/skills/downloaded/[a-z0-9][a-z0-9-]{0,63}$ Bearer Remove a downloaded skill. Deletes <data>/skills/<name>/. A skill that ships with the bridge is never removed this way.
GET `^/api/skills/downloaded/(?P[a-z0-9][a-z0-9-]{0,63})/(?Pcheck-updates update)$` Bearer
POST `^/api/skills/downloaded/(?P[a-z0-9][a-z0-9-]{0,63})/(?Pcheck-updates update)$` Bearer
GET /api/tools Bearer Tool registry. External programs and libraries (ghidra, yara, volatility3...) with available, via (binary
GET /api/tools/plan Bearer Tool install plan. What a download would fetch for ?id=: repo, asset name, target path. downloadable: false comes with the reason and the packages.
POST /api/tools/install Bearer Install a tool. {"id": "radare2"}. Fetches the latest release asset, verifies the SHA-256 from the same GitHub response and writes it to the data dir with mode 0700. 409 when the download fails or a digest is missing; no partial file is left. Only tools that publish a standalone asset can be installed this way.

MCP client

Method Path Token Purpose
GET /api/mcp Bearer MCP overview. Connected sessions, configured servers, the always_on ids and the preset catalogue with ready, blockers and missing_tools per preset. Reading this opens the always-on hosted documentation server (Context7); no local process is started.
GET /api/mcp/presets Bearer MCP presets. The shipped presets (Context7, IDA, Ghidra, radare2, x64dbg, jadx, Frida, Volatility, Sleuth Kit, YARA, nmap) mapped to this host.
GET /api/mcp/docs Bearer Documentation tools. ?id= lists the tools of the always-on documentation server (Context7 by default). Connects it on first use: it is hosted over HTTPS, so nothing is installed or spawned.
POST /api/mcp/docs/call Bearer Look up library documentation. {"id": "context7", "tool", "arguments"} calls a documentation tool without listing first, so a name survived from an earlier session still works. Arguments are passed through unchanged; failures map to 404/409/400 like any other MCP call.
POST /api/mcp/connect Bearer Connect an MCP server. {"id": "ghidra-mcp", "force": false}. Starts a stdio server or opens the HTTP endpoint, runs the MCP handshake and answers 201 with the session. 409 when the server cannot be reached.
POST /api/mcp/disconnect Bearer Disconnect an MCP server. Closes the session and kills the process tree.
GET /api/mcp/tools Bearer MCP tools. ?id= lists the tools a connected server exposes; &refresh=1 bypasses the cache.
POST /api/mcp/call Bearer Call an MCP tool. {"id", "tool", "arguments", "timeout", "allow_mutating"}. Read tools run at once; a tool whose name says it changes state (rename, patch, breakpoint) answers 409 until allow_mutating is set. Every call is written to the MCP audit log before it runs.
GET /api/mcp/config Bearer Configured MCP servers. The servers stored in <config>/mcp/servers.json, mode 0600.
POST /api/mcp/config Bearer Add or change an MCP server. Either {"id"} (mark a preset as configured) or a full description: transport, command or url, optional env/headers. Validated before it is stored.
POST /api/mcp/enable Bearer Enable an MCP server. {"id", "enabled"}. Disabling also disconnects and stops it.
DELETE/POST /api/mcp/delete Bearer Remove an MCP server. Deletes the configured entry and closes any live session.
GET /api/mcp/catalogue Bearer MCP catalogue. ?q= searches the public MCP registry and returns servers this host could start, with the argv or URL the bridge would use. The one read route that reaches the network; answers are cached for five minutes.
POST /api/mcp/catalogue/add Bearer Add from the catalogue. {"name"}. Re-reads the entry from the registry, validates it again, and writes it to servers.json. It does not start anything: connect is a separate request.

MCP server

Method Path Token Purpose
GET /api/mcp/server/tools Bearer This bridge as an MCP server. The tools NerveForge exposes to other MCP clients: list_skills, read_skill, list_tools, docs, workspace_{list,read,write}, run_command, mcp_servers. Read tools are safe; write and run are annotated as mutating.
POST /api/mcp/server/call Bearer Call this bridge's own MCP tool. {"tool", "arguments"}. Runs the same handler a local MCP client would reach, without starting a second process.

Configurations and system actions

Method Path Token Purpose
GET /api/configs Bearer Configuration snapshots. State of the systemd/autostart monitor.
POST /api/configs/scan Bearer Rescan configurations. Creates or updates the baseline and returns the drift.
POST /api/config-edits Bearer Edit configuration. Requires approval; checks the file hash and symlink races.
POST /api/system-actions Bearer System action. restart/enable/disable a unit; approval queue only.

Approval queue

Method Path Token Purpose
POST /api/commands Bearer Command request. {"command": "..."}; waits for approval in the panel.
POST /api/plans Bearer Plan request. A list of steps, each approved separately.
POST ^/api/commands/[^/]+/approve$ Bearer Approve command. POST /api/commands/<id>/approve.
POST ^/api/commands/[^/]+/reject$ Bearer Reject command. POST /api/commands/<id>/reject.
GET /api/commands/* Bearer Command status. GET /api/commands/<id>.

Full access (UZHAS)

Method Path Token Purpose
GET /api/full-access/state, /api/uzhas/state Bearer Full access state. armed, remaining timer, active job.
POST /api/full-access/config, /api/uzhas/config Bearer Arm/disarm full access. armed, duration_seconds, confirmation (passphrase).
POST /api/full-access/run, /api/uzhas/run Bearer Full-access command. command, timeout_seconds, sudo, shell, cwd; answers 202.
GET `^/api/(?:full-access uzhas)/jobs/[^/]+$` Bearer
POST /api/full-access/stop Bearer Immediate stop. Kills every full-access process tree.

Workspace and sandbox

Method Path Token Purpose
POST /api/workspace/* Bearer File operations. list, read, write, run under /api/workspace/.
GET /api/workspace/jobs/* Bearer Workspace job status. GET /api/workspace/jobs/<id>, only with the sandbox unlocked.
POST /api/yolo/run Bearer Sandboxed run. Runs a command inside the bwrap sandbox of the workspace root.

Public upload

Method Path Token Purpose
POST /api/public/assets No Asset upload. No token, create-only: the legacy JSON drop box, 64 KiB of text, extension allowlist.
OPTIONS /api/public/assets No Asset preflight. CORS preflight for the JSON drop box.
POST /api/public/scripts No Public upload. No token, create-only: up to 5 GiB, extension allowlist, 5/min and 30/hour. JSON body (legacy, 64 KiB text) or a raw body streamed to disk; the name comes from X-Filename or ?filename=.
OPTIONS /api/public/scripts No Upload preflight. CORS preflight; allows the X-Filename header.
POST /api/public/media No Media upload. No token, create-only, streamed: audio, video, images. Up to 5 GiB, lands in inbox/media, 3/min and 20/hour.
OPTIONS /api/public/media No Media preflight. CORS preflight for media uploads.
POST /api/public/docs No Document upload. No token, create-only, streamed: pdf, office, epub. Up to 5 GiB, lands in inbox/docs, 3/min and 20/hour.
OPTIONS /api/public/docs No Document preflight. CORS preflight for document uploads.
POST /api/public/archive No Archive upload. No token, create-only, streamed: zip, 7z, tar, gz, xz. Up to 5 GiB, lands in inbox/archive, 3/min and 20/hour.
OPTIONS /api/public/archive No Archive preflight. CORS preflight for archive uploads.