Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,15 @@ print(f"Exit code: {exit_code}\nOutput:\n{output}")
## 4. When the bridge is an MCP server

An operator can also run `python3 -m nerveforge.toolkit --serve` so that *this* bridge is an MCP
server for another agent. It offers `list_skills`, `read_skill`, `list_tools`, `workspace_list`,
`workspace_read`, `workspace_write`, `run_command` and `mcp_servers`. Write and run are absent
unless it was started with `--allow-write`, and `run_command` additionally needs armed full access
— a `403` there means "ask the user to enable it", not "retry".
server for another agent. It offers `list_skills`, `read_skill`, `list_tools`, `docs`,
`workspace_list`, `workspace_read`, `workspace_write`, `run_command` and `mcp_servers`. Write and
run are absent unless it was started with `--allow-write`, and `run_command` additionally needs
armed full access — a `403` there means "ask the user to enable it", not "retry".

`docs` answers from **Context7** (`https://mcp.context7.com/mcp`), the one MCP client preset that
is hosted and always on: no install, no token. Use it for a third-party library's API instead of
remembering one — the tool name is discovered at call time, so a `get-library-docs` /
`query-docs` rename cannot break it.

## 5. Built-in self-documentation

Expand Down
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,62 @@

**English** · [Русский](docs/ru/CHANGELOG.md)

## 8.3.0

Context7, on by default. The bridge has spoken MCP in both directions since
8.2.0, and the one server it should never have to be asked about is the one
that knows what the libraries on this machine actually look like today.
`context7` is now a preset, the only preset that opens itself, and the agent is
told to use it before writing code rather than merely allowed to.

### Context7: documentation that is not from memory

A model's memory of an API is a snapshot, and the code it writes against that
snapshot compiles until it does not. Context7 indexes current documentation for
libraries and frameworks and serves it over MCP; the bridge connects to it at
`https://mcp.context7.com/mcp` over Streamable HTTP with **no token and no local
install**. It is the first preset to be **hosted**: it points at somebody else's
HTTPS endpoint, so `probe()` has no `server` blocker to report and no runtime to
look for — either the network is there or it is not.

Two new fields carry that: `Preset.hosted` (no local process to be missing) and
`Preset.auto_connect` (open without a click). `GET /api/mcp` now lists
`always_on` and opens those servers on first read; failures are returned in the
payload instead of raised, because a bridge with no internet is a normal state
and the rest of the API must keep working.

"Always available" had to mean three things, or it would have been a sentence in
a README:

- **The agent is told.** `/llms.txt`, `GET /api/docs` and `GET /api/agent-prompt`
say that library documentation is looked up before code depending on a
third-party API is written — on every such task, not after a failure.
- **The tools are one call away.** `GET /api/mcp/docs` lists the server's tools
and connects it; `POST /api/mcp/docs/call` calls one without a prior listing,
which is the request an agent makes after a reconnect when its cache is empty.
- **An IDE agent sees it without being told.** The bridge's own MCP server gained
a ninth tool, `docs`, which discovers Context7's tool names at call time
instead of hard-coding them: `get-library-docs` and `query-docs` have both
shipped, and a name written into this repository would be a bug waiting for
someone else's release. A reader that returns pages is preferred over a
resolver that only finds an id, and the arguments are named the way the
chosen tool's own `inputSchema` names them, so `context7CompatibleLibraryID`
and `libraryId` both work without either being in the code.

A free key from `context7.com/dashboard` raises the rate limits and stays
optional; if one is configured it travels as an `Authorization` header and is
redacted in the audit log like every other secret.

### Everything else

- `GET /api/mcp` answers with `always_on` alongside the sessions and presets.
- The MCP client presets went from twelve to thirteen, and the bridge's own MCP
server from eight tools to nine; README, `docs/API.md` (generated), TOOLKIT,
ARCHITECTURE and the Russian mirrors follow.
- Reading `/api/mcp` now makes one HTTPS request when Context7 is not connected.
It is the module's only exception to "reading never causes anything to
happen", and the module docstring says so.

## 8.2.0

8.2.0 collects everything that had accumulated under `Unreleased`: the public
Expand Down
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# NerveForge 8.2.0 ⚡ Arena.ai ↔ PC & Android Bridge
# NerveForge 8.3.0 ⚡ Arena.ai ↔ PC & Android Bridge

![NerveForge — Build boldly. Ship cleverly.](assets/nerveforge-lockup.png)

Expand Down Expand Up @@ -159,9 +159,10 @@ python3 -m nerveforge.toolkit --serve # read-only tools
python3 -m nerveforge.toolkit --serve --allow-write # adds workspace_write and run_command
```

It speaks MCP `2025-06-18` over stdio and offers eight tools — `list_skills`, `read_skill`,
`list_tools`, `workspace_list`, `workspace_read`, `workspace_write`, `run_command`,
`mcp_servers`. Write and run are annotated as mutating and need the second flag.
It speaks MCP `2025-06-18` over stdio and offers nine tools — `list_skills`, `read_skill`,
`list_tools`, `docs`, `workspace_list`, `workspace_read`, `workspace_write`, `run_command`,
`mcp_servers`. Write and run are annotated as mutating and need the second flag. `docs` answers
from Context7, so an agent that sees only `tools/list` still finds current library documentation.

### Step 2 — read the connection details

Expand Down Expand Up @@ -228,11 +229,12 @@ Every protected call needs `Authorization: Bearer <token>`.
| `GET /api/skills`, `GET /api/skills/<id>` | bearer | Skill catalogue with `ready`/`partial`/`blocked` and the body of one skill |
| `GET /api/tools` | bearer | Tool catalogue: what is installed, what is missing, what can be downloaded |
| `POST /api/tools/install` | bearer | `{"id": "jadx"}` — download, verify the SHA-256, unpack into the data dir; `201` |
| `GET /api/mcp/presets` | bearer | Twelve MCP bridges and what blocks each one |
| `GET /api/mcp/presets` | bearer | Thirteen MCP bridges and what blocks each one |
| `GET /api/mcp/docs`, `POST /api/mcp/docs/call` | bearer | Current library documentation from Context7, on by default |
| `POST /api/mcp/connect`, `/call`, `/disconnect` | bearer | Drive an MCP server; mutations need `allow_mutating` |
| `GET /api/mcp/server/tools` | bearer | This bridge as an MCP server: eight tools, write and run annotated |
| `GET /api/mcp/server/tools` | bearer | This bridge as an MCP server: nine tools, write and run annotated |

The reference lists all 61 routes; [docs/API.md](docs/API.md) is generated from the table, so it cannot drift.
The reference lists all 63 routes; [docs/API.md](docs/API.md) is generated from the table, so it cannot drift.

Full allowlist: `GET /api/quick` → `capabilities.public_upload.extensions`; add your own with
`NERVEFORGE_PUBLIC_UPLOAD_EXTRA`. Details: [docs/PUBLIC_UPLOAD.md](docs/PUBLIC_UPLOAD.md).
Expand All @@ -241,11 +243,11 @@ Full allowlist: `GET /api/quick` → `capabilities.public_upload.extensions`; ad

## 🧪 Tests and code quality

The repository ships **1660 automated unit tests** (Linux, Windows, Android/Termux, API, security,
The repository ships **1680 automated unit tests** (Linux, Windows, Android/Termux, API, security,
tunnels). CI runs them on Linux and Windows:

```bash
python3 -m unittest discover -s tests -v # 1660 tests
python3 -m unittest discover -s tests -v # 1680 tests
python3 -m compileall -q src tests run.py # Python bytecode
find static -name '*.js' -print0 | xargs -0 -n1 node --check # JavaScript syntax # JS syntax
bash -n setup.sh && bash -n setup_termux.sh # shell installers
Expand Down Expand Up @@ -308,7 +310,7 @@ nerveforge/
│ ├── uzhas_manager.py # Shell runner with timeout and tree cancellation
│ └── workspace_manager.py # File operations, bwrap sandbox, public uploads
├── static/ # Web panel assets (HTML, CSS, JS)
├── tests/ # Unit tests (1660 tests)
├── tests/ # Unit tests (1680 tests)
├── pyproject.toml # PEP 517/518 build metadata
├── run.py # Run in place
├── setup.sh / setup_windows.ps1 / setup_termux.sh
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Security policy — NerveForge 8.2.0
# Security policy — NerveForge 8.3.0

**English** · [Русский](docs/ru/SECURITY.md)

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.2.0
8.3.0
8 changes: 5 additions & 3 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ the public uploads are reachable. Bodies are JSON objects; errors are

| Method | Path | Token | Purpose |
|---|---|---|---|
| `GET` | `/api/mcp` | Bearer | **MCP overview.** Connected sessions, configured servers and the preset catalogue with `ready`, `blockers` and `missing_tools` per preset. Starting a process never happens here. |
| `GET` | `/api/mcp/presets` | Bearer | **MCP presets.** The shipped presets (IDA, Ghidra, radare2, x64dbg, jadx, Frida, Volatility, Sleuth Kit, YARA, nmap) mapped to this host. |
| `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. |
Expand All @@ -71,7 +73,7 @@ the public uploads are reachable. Bodies are JSON objects; errors are

| 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`, `workspace_{list,read,write}`, `run_command`, `mcp_servers`. Read tools are safe; write and run are annotated as mutating. |
| `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
Expand Down
2 changes: 1 addition & 1 deletion docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
`tools/call`, timeouts, one pending map keyed by request id;
* `registry.py` / `mcpservice.py` — twelve presets with the reason each is blocked, live sessions,
a 120 s tool cache, the mutation gate and the JSONL audit;
* `mcpserver.py` — the same bridge as an MCP server (eight tools, `allow_writes` off by default);
* `mcpserver.py` — the same bridge as an MCP server (nine tools, `allow_writes` off by default);
* `cli.py` — `python -m nerveforge.toolkit [--serve | --list-skills | --list-tools | --install]`.

**Two rules worth stating.** A skill is knowledge, not a runner: it declares the tools it needs
Expand Down
2 changes: 1 addition & 1 deletion docs/REFACTORING_PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
> version 7.0.7). The analysis covered `src/`, `static/`, `tests/`, the installers and the
> documentation. Test suite at the time of analysis: **66/66 green**.
>
> **Status: all eight stages are done. Eight releases later the project is at 8.2.0 with 1660
> **Status: all eight stages are done. Nine releases later the project is at 8.3.0 with 1680
> tests.** The "before" numbers below are kept as the record of what motivated each stage; the
> tables say what each stage started from, not what the suite contains today.
>
Expand Down
36 changes: 33 additions & 3 deletions docs/TOOLKIT.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,12 @@ MCP is JSON-RPC 2.0. The handshake is `initialize` (protocol `2025-06-18`) →
when somebody presses connect. Nothing is spawned at startup, and nothing is respawned in the
background.

Twelve presets ship with the address or argv each expects, and `probe()` names exactly what is
Thirteen presets ship with the address or argv each expects, and `probe()` names exactly what is
missing:

| Preset | Transport | Blocked by |
|---|---|---|
| `context7` | http `mcp.context7.com/mcp` (hosted) | nothing: no install, no token |
| `ida-pro-mcp` | http `127.0.0.1:13337/mcp` | IDA 9.4+ and the plugin listening |
| `ghidra-mcp` | http `127.0.0.1:8080/mcp` | a Ghidra window with the extension, a JVM |
| `ghidra-headless-mcp` | stdio `uvx pyghidra-mcp` | `uvx`, Ghidra |
Expand All @@ -155,7 +156,35 @@ missing:

`probe()` reports three separate blockers, because they need three different fixes: a missing tool
(`tool:ghidra`), a missing runtime (`runtime:uvx`), and a server that is not listening (`server`) —
the last one only applies to the HTTP presets.
the last one only applies to HTTP presets that are not **hosted**. A hosted preset points at
somebody else's HTTPS endpoint, so there is no local process to be missing and no blocker to
report.

### Context7: documentation, on by default

`context7` is the one preset that is **always on**. It is hosted
(`https://mcp.context7.com/mcp`, Streamable HTTP), needs no token and no install, and the bridge
opens it when the MCP state is first read rather than waiting for a connect click. Nothing is
spawned — it is one HTTPS request — and the one cost of an offline machine is a failed request
that is reported in `/api/mcp` instead of raised.

Two things follow from "always on", and both are the point:

- **The agent is told to use it, not merely allowed to.** `/llms.txt`, `GET /api/docs` and
`GET /api/agent-prompt` say that library documentation comes from Context7 before code that
depends on a third-party API is written, and `docs` is a tool on the bridge's own MCP server,
so an IDE agent sees it in `tools/list` without being told anything.
- **The tool name is discovered, not hard-coded.** Context7 has shipped both
`get-library-docs`/`resolve-library-id` and newer names; the `docs` tool asks `tools/list`
and picks the tool that returns pages over the one that only resolves an id. A name written
into this file would be a bug waiting for someone else's release.

`GET /api/mcp/docs` lists the server's tools and connects it on first use;
`POST /api/mcp/docs/call` with `{"id": "context7", "tool": "...", "arguments": {...}}` calls one
without a prior listing, which is the call an agent makes after a reconnect when nothing is
cached. A free API key from `context7.com/dashboard` raises the rate limits and is optional; if
configured, it is passed as an `Authorization` header and redacted in the audit log like every
other secret.

### What is audited, and what is refused

Expand All @@ -182,12 +211,13 @@ python3 -m nerveforge.toolkit --serve # read-only
python3 -m nerveforge.toolkit --serve --allow-write # adds write and run
```

It speaks `2025-06-18` over stdio and advertises eight tools:
It speaks `2025-06-18` over stdio and advertises nine tools:

| Tool | Mutating | What it does |
|---|---|---|
| `list_skills`, `read_skill` | no | The catalogue and one skill's body, with its verdict |
| `list_tools` | no | The tool catalogue for this machine |
| `docs` | no | Current library documentation from Context7; tool name and arguments are discovered |
| `workspace_list`, `workspace_read` | no | The workspace, through the same sandbox as the API |
| `workspace_write` | **yes** | Write a file; needs `--allow-write` |
| `run_command` | **yes** | Run a command; needs `--allow-write` **and** armed full access |
Expand Down
7 changes: 6 additions & 1 deletion docs/ru/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,16 @@ print(f"Exit code: {exit_code}\nOutput:\n{output}")
## 4. Когда мост сам является MCP-сервером

Оператор может запустить `python3 -m nerveforge.toolkit --serve`, и тогда *этот* мост становится
MCP-сервером для другого агента. Он предлагает `list_skills`, `read_skill`, `list_tools`,
MCP-сервером для другого агента. Он предлагает `list_skills`, `read_skill`, `list_tools`, `docs`,
`workspace_list`, `workspace_read`, `workspace_write`, `run_command` и `mcp_servers`. Запись и
запуск отсутствуют, если он не запущен с `--allow-write`, а `run_command` дополнительно требует
включённого полного доступа — `403` там означает «попросите пользователя включить», а не «повторите».

`docs` отвечает из **Context7** (`https://mcp.context7.com/mcp`) — единственного хостингового и
всегда включённого пресета MCP-клиента: без установки и без токена. Используйте его для API
сторонней библиотеки вместо памяти: имя инструмента определяется в момент вызова, поэтому
переименование `get-library-docs` / `query-docs` его не сломает.

## 5. Встроенные эндпоинты самодокументирования

* `GET /api/docs` или `GET /llms.txt` — открытый текстовый манифест и руководство для агентов в Markdown.
Expand Down
Loading
Loading