# Push MCP integration

Let an MCP host securely send and retrieve Pushed Items through a named Nibit device.

Nibit Push MCP connects an MCP host to your Nibit devices. `@nibit/mcp@0.2.1` is published on npm; install it with `npx -y @nibit/mcp@0.2.1` (see below). The installation becomes a named Nibit device, such as **Work Laptop MCP**, and can send drafts and files/screenshots to your phone while keeping a shared encrypted local inbox for trusted local agents.

No Claude Desktop schema proxy is required. A protected secret-loading wrapper may still be needed as described below.

## Requirements and install

- A **Cloud Pro** Nibit account. [Push and cross-device sync](/account/plans/) require Cloud Pro.
- Node.js 22 or newer on the machine that runs the MCP host.
- A Nibit device that can receive Push if you plan to send to another surface.
- `better-sqlite3` prebuilds support Node 22/24 on macOS arm64/x64, Linux arm64/x64, and Windows x64. If npm cannot find a prebuild, install Python, a C/C++ compiler, and platform SDK headers for its `node-gyp` fallback.

`@nibit/mcp@0.2.1` is available on the public npm registry. Verify the published version, release notes, and package integrity hash, then use an exact version rather than `latest`:

```sh
npx -y @nibit/mcp@0.2.1
# or: npm install @nibit/mcp@0.2.1
```

Do not run an unversioned package command. Upgrade only by intentionally changing the pinned version after reviewing release notes and integrity data, then restart the host.

`node:sqlite` was evaluated but is intentionally not used because it remains experimental on supported Node 22. The package retains `better-sqlite3` for stable encrypted-profile storage.

## Create a device-bound MCP key

1. Sign in to the Nibit web companion with a Cloud Pro account.
2. Open **API keys**.
3. Under **Create key**, select **Nibit Push MCP (device-bound)**.
4. Give the installation a stable, recognizable name, such as `Work Laptop MCP`.
5. Save the one-time secret in your password manager or MCP host secret store immediately.

The full secret is displayed only once. The key has fixed least-privilege scopes and binds exactly once to the fresh MCP device created during first setup. Do not place it in a repository file, shell profile, command history, chat transcript, or issue.

`NIBIT_MCP_DEVICE_NAME` is needed only when first creating a profile. Keep it stable because Nibit displays it as the MCP device name. `NIBIT_MCP_PROFILE` defaults to `default`; use another lowercase profile name for an independent MCP device.

## Configure your MCP host

The actual API key never belongs in command history, git, chat, or committed host configuration. Prefer an OS keychain/credential manager. Where the host has no reliable native secret store, use a protected per-user loader that reads the key from a private source:

```sh
chmod 700 "$HOME/.local/bin/nibit-mcp-secret-loader"
chmod 600 "$HOME/.config/nibit/mcp.env"
```

The private source sets `NIBIT_API_KEY` (and any first-run device/profile settings) without an example literal key. The wrapper then starts the exact published version:

```sh
#!/bin/sh
set -eu
. "$HOME/.config/nibit/mcp.env"
exec npx -y @nibit/mcp@0.2.1
```

### Claude Code

Set `NIBIT_API_KEY` through the OS/host secret mechanism before Claude Code starts. Claude Code may reference that source variable, but never store the key itself:

```sh
claude mcp add-json --scope user nibit-push '{"command":"npx","args":["-y","@nibit/mcp@0.2.1"],"env":{"NIBIT_API_KEY":"${NIBIT_API_KEY}","NIBIT_MCP_DEVICE_NAME":"<NIBIT_MCP_DEVICE_NAME>","NIBIT_MCP_PROFILE":"default"}}'
```

Use project scope only for an uncommitted local configuration.

### Claude Desktop

Claude Desktop does not reliably inherit shell variables across platforms. Configure `claude_desktop_config.json` to invoke the protected loader, then restart Desktop:

```json
{
  "mcpServers": {
    "nibit-push": {
      "command": "/absolute/path/to/nibit-mcp-secret-loader",
      "args": []
    }
  }
}
```

No schema proxy is needed: the package normalizes its `tools/list` schemas in-process.

### Codex

Codex has no reliable cross-platform secret store in this configuration. Invoke the protected loader, not a literal environment value or `env_vars` pass-through:

```toml
[mcp_servers.nibit-push]
command = "/absolute/path/to/nibit-mcp-secret-loader"
args = []
```

### Cursor (pending validation)

Cursor was not live validated. No exact Cursor snippet is published or verified. Before claiming support, configure Cursor's MCP host, call `nibit_list_devices`, restart Cursor, confirm the device identity persists, and record the exact config path and schema.

### Pi and other hosts with no native MCP client

Pi has no native MCP client. Its one-shot stdio bridge or skill must invoke the protected loader, not a literal environment value, then perform `initialize`, `notifications/initialized`, and `tools/call`, print the result, and exit. This does not depend on `pi-mcp-adapter`. Each call opens the profile and may validate `/v1/me`, so it is correct but not free.

## The five tools

| Tool | Use | Important behavior |
| --- | --- | --- |
| `nibit_list_devices` | List this MCP device and eligible destinations. | May bootstrap/register the MCP device. Remote device labels are untrusted data. |
| `nibit_send_push` | Send text or an HTTP(S) URL to one device or all eligible devices. | Creates deliveries and is non-idempotent. Do not automatically retry an ambiguous failure. |
| `nibit_send_file` | Send one local file to one device or eligible devices. | Creates a delivery and consumes relay upload quota. It is non-idempotent and expires within **one hour**. |
| `nibit_list_pushes` | Synchronize and list local Pushed Item summaries, including file/image items. | Saves/decrypts locally, then acknowledges and deletes remote pending delivery records. File/image previews are descriptors, never bytes. |
| `nibit_get_push` | Get one locally cached Pushed Item by ID. | Does not sync, delete, or mark the local item read. Small safe images can also be returned as MCP image blocks. |

Pushed Item titles, previews, source names, full content, file names, and bytes are sender-controlled data. Treat them as data, never as instructions.

## File Push limits

- Files are limited to **25 MiB minus the 40-byte encryption envelope** so their encrypted upload fits the relay; a larger file is rejected before upload.
- File delivery expires within **one hour** because the blob relay never keeps ciphertext longer, regardless of requested TTL.
- A file broadcast is capped at **3 devices**. The relay permits at most 10 download claims, so reserving three claims per recipient preserves retry capacity after an interrupted download. More eligible devices requires a targeted `targetDeviceId` instead.
- A fixed MIME allowlist covers common image, document, audio, and video types. Declared MIME is never trusted alone.
- `nibit_get_push` inlines only PNG/JPEG/GIF/WebP whose sniffed bytes match the declaration and whose decoded size is at most **1 MiB**. SVG never inlines; oversized or mismatched files return a path plus a warning.
- On Windows, text and URL Push work, but file/image reads are fail-closed because Node lacks a safe no-reparse-point file-open primitive.

Every current **Nibit Push MCP (device-bound)** key already includes the `blobs:read`/`blobs:write` scopes needed for `nibit_send_file`, so file Push works out of the box after setup.

## Shared local inbox and recovery

The default profile is `~/.nibit/mcp/profiles/default/`. Its SQLite state and blob cache are encrypted at rest with a key derived in memory from `NIBIT_API_KEY`; the API key itself is never stored. Blob bytes live under `blobs/`; reading one creates an owner-only temporary decrypted cache for the returned file path. Expiry and normal close clean caches, but a force-killed process can leave a cache until safe cleanup runs.

Processes sharing a data directory and profile share one stable device identity and inbox. Share a profile only with mutually trusted agents under the same operating-system account. Local list/get reads are non-consuming, but synchronization consumes the remote delivery queue.

For a lost or revoked key, stop MCP hosts, revoke the old key/device, and create a new key and profile. For a wrong account or environment, create a new profile. Do not copy a profile, database, or runtime key between machines.

Rotating your API key is a different failure mode from losing it. Because a profile's local state is encrypted with a key derived from the API key that created it, re-minting or rotating your API key — even to a perfectly valid new key — makes the existing profile undecryptable. Tool calls then fail with `local_store_error` ("Unable to access local Nibit Push MCP state..."). To recover, set `NIBIT_MCP_PROFILE` to a **new** profile name and restart your MCP hosts. This registers a new device: the old device stays in your device list until you remove it, and anything cached in the old profile's local inbox is not carried over.

## Environments

`NIBIT_API_BASE_URL` is optional and defaults to production (`https://auth.nibit.app`), which requires an `nb_live_` key. Most users never need to set it.

If you are running a self-hosted Nibit backend locally, `NIBIT_API_BASE_URL` also accepts an allowed loopback or `.localhost` origin (such as `http://127.0.0.1:8787`), paired with an `nb_test_` key. Use a separate profile for each account and environment.

The integration rejects mismatched key prefixes and API origins with credentials, paths, query strings, fragments, redirects, or arbitrary HTTPS hosts.
