nex-code 0.4.8 → 0.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +50 -0
  2. package/dist/nex-code.js +507 -499
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1354,6 +1354,56 @@ MCP tools appear with the `mcp_` prefix and are available to the agent alongside
1354
1354
 
1355
1355
  ---
1356
1356
 
1357
+ ## MCP Servers
1358
+
1359
+ nex-code supports a dedicated `.nex/mcp.json` file (or `~/.nex/mcp.json` for global config) for
1360
+ connecting MCP tool servers. This format supports environment variable interpolation so you can keep
1361
+ API keys out of the config file.
1362
+
1363
+ ```json
1364
+ // .nex/mcp.json
1365
+ {
1366
+ "servers": {
1367
+ "brave-search": {
1368
+ "command": "npx",
1369
+ "args": ["-y", "@modelcontextprotocol/server-brave-search"],
1370
+ "env": { "BRAVE_API_KEY": "${BRAVE_API_KEY}" }
1371
+ },
1372
+ "filesystem": {
1373
+ "command": "npx",
1374
+ "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
1375
+ }
1376
+ }
1377
+ }
1378
+ ```
1379
+
1380
+ **Search order for config:** `.nex/mcp.json` → `~/.nex/mcp.json`. Override with `--mcp-config <path>`.
1381
+
1382
+ **Slash commands:**
1383
+
1384
+ ```
1385
+ /mcp list — list connected MCP servers and their exposed tools
1386
+ /mcp status — show which servers are running / stopped
1387
+ ```
1388
+
1389
+ **How it works:**
1390
+
1391
+ 1. nex-code spawns each server as a child process using stdio JSON-RPC transport.
1392
+ 2. It sends `initialize` + `tools/list` to discover available tools.
1393
+ 3. All discovered tools are merged into the nex-code tool registry under the name `mcp_<server>_<tool>`.
1394
+ 4. The agent can call them transparently alongside built-in tools.
1395
+ 5. All server processes are shut down cleanly when nex-code exits.
1396
+
1397
+ **Env var interpolation:** `${VAR}` in the `env` block is replaced from `process.env` at startup so you
1398
+ can store the actual key in your shell environment or `.env` file:
1399
+
1400
+ ```bash
1401
+ export BRAVE_API_KEY=my-key
1402
+ nex-code --mcp-config .nex/mcp.json
1403
+ ```
1404
+
1405
+ ---
1406
+
1357
1407
  ## Hooks
1358
1408
 
1359
1409
  Run custom scripts on CLI events: