# Hive Intelligence

[![npm version](https://img.shields.io/npm/v/hive-intelligence.svg)](https://www.npmjs.com/package/hive-intelligence)
[![Node.js 22.12+](https://img.shields.io/badge/node-%3E%3D22.12-339933.svg)](https://nodejs.org/)
[![License: Proprietary](https://img.shields.io/badge/license-Proprietary-red.svg)](./LICENSE)
[![MCP compatible](https://img.shields.io/badge/MCP-compatible-111827.svg)](https://modelcontextprotocol.io/)

One connection for evidence-backed crypto due diligence. Every Hive-backed
answer carries sources, freshness, and a runtime receipt.

Hive gives Claude Code, Cursor, VS Code, OpenAI Responses API, Gemini CLI,
Codex, and supported custom agents one compact way to discover and call live
crypto data. Agents search the catalog, inspect schemas before execution, keep calls bounded, and return provider provenance plus runtime
status instead of browsing a wall of raw endpoints. Hive is shipped as a
hosted MCP server, local `stdio` runtime, CLI, and REST API.

```bash
npx -y -p hive-intelligence@latest hive init --all --skip-verify
```

Use the hosted MCP when your client can add a remote MCP URL. Use local `stdio`
for desktop clients that only launch local processes (it proxies to the hosted
MCP by default), or opt into `hive serve --local` to self-host with your own
provider keys.

## What You Get

- Evidence-backed workflows for token diligence, wallet investigation,
  security checks, market research, DeFi, DEX pools, NFTs, Solana, and RWA
  perps.
- A compact six-tool root MCP surface — three direct hero tools
  (`get_token_price`, `check_token_safety`, `get_wallet_portfolio`) plus the
  three-tool discovery loop, so agents can route before they call.
- CLI commands for auth, client setup, tool discovery, schema inspection,
  direct execution, diagnostics, aliases, polling, and config generation.
- Runtime resources for provider availability and skills.
- Bundled agent skills that teach assistants the right Hive workflow:
  discovery -> schema lookup -> bounded execution -> evidence receipt.
- A broad provider catalog remains available behind discovery for agents that
  need a long-tail endpoint. The current catalog contains 413 tools, but that
  coverage is not the primary product contract.

## Quickstart

Requirements:

- Node.js 22.12+ (Node.js 24 LTS recommended)
- npm
- Browser authorization for interactive hosted MCP after OAuth activation, or
  a Hive API key for direct CLI, REST, and headless agents

For the fastest proof before setup, run the fixed, read-only public demo. It
requires no account and returns the same source/freshness/runtime-receipt shape
used by authenticated calls:

```text
https://www.hiveintelligence.xyz/playground
```

For direct CLI or headless REST access, create a key:

```text
https://www.hiveintelligence.xyz/login?next=/dashboard/keys
```

After hosted OAuth activation, configure OAuth-capable AI clients without
putting a secret in their config:

```bash
npx -y -p hive-intelligence@latest hive init --all --skip-verify
```

Add `--browser` to sign the CLI in during the same run; `--skip-verify` keeps
the command non-interactive so agents and CI can run it.

For automation, exit code `0` means every detected programmable client,
requested skill install, and enabled readiness check completed; partial setup
returns non-zero and is detailed in `--json` output.

For direct CLI or headless REST use, sign in separately:

```bash
npx -y -p hive-intelligence@latest hive auth login
```

Make a first successful call:

```bash
npx -y -p hive-intelligence@latest hive tools call get_token_price --token bitcoin --json
```

Expected output shape:

```json
{
  "ok": true,
  "data": {
    "bitcoin": {
      "usd": 0
    }
  },
  "meta": {
    "provider": "CoinGecko",
    "runtime_status": "ok",
    "fetched_at": "2026-07-11T12:00:00.000Z",
    "observed_at": "2026-07-11T11:59:59.900Z",
    "cache_age_ms": 100,
    "source": "live",
    "receipt_id": "00000000-0000-4000-8000-000000000000",
    "receipt_version": "1.0",
    "server_version": "1.8.0",
    "build_sha": null,
    "digest_algorithm": "sha256",
    "input_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "result_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
    "duration_ms": 0
  }
}
```

Use `--json` for scripts and agents. Use `--pretty` for human-readable output.

## Connect Hosted MCP

After hosted OAuth activation, use secret-free config prefill for OAuth-capable
clients. Review the public URL in the client, approve it, and complete Hive
authorization in the browser. These links never contain an API key:

Use these native OAuth paths only after the hosted protected-resource metadata
reports OAuth enabled. Until that deployment gate is open, use the API-key
fallback from a trusted client/backend; do not paste a key into an install URL.

[![Cursor setup](https://img.shields.io/badge/Cursor-Setup-000000.svg?logo=cursor)](https://www.hiveintelligence.xyz/install/cursor)
[![VS Code setup](https://img.shields.io/badge/VS_Code-Setup-0098FF?logo=visualstudiocode&logoColor=white)](https://www.hiveintelligence.xyz/install/vs-code)

The setup pages check the live OAuth and release contract before exposing a
native install action, so a stale deployment cannot masquerade as a successful
one-click install.

Hosted MCP URL:

```text
https://mcp.hiveintelligence.xyz/mcp
```

Claude Code:

```bash
claude mcp add --transport http --scope user hive https://mcp.hiveintelligence.xyz/mcp
```

OpenAI Codex:

```bash
codex mcp add hive --url https://mcp.hiveintelligence.xyz/mcp
codex mcp login hive
```

Generic OAuth-capable Streamable HTTP config:

```json
{
  "mcpServers": {
    "hive": {
      "url": "https://mcp.hiveintelligence.xyz/mcp"
    }
  }
}
```

For headless automation that cannot open a browser, add
`Authorization: Bearer $HIVE_API_KEY` from secret storage instead.

## Client Compatibility

| Client                                | Hosted HTTP MCP  | Hosted auth                         | Local stdio | Recommended setup                                                            |
| ------------------------------------- | ---------------- | ----------------------------------- | ----------- | ---------------------------------------------------------------------------- |
| Claude Code                           | Yes              | OAuth or API-key fallback           | Yes         | `claude mcp add --transport http --scope user hive https://mcp.hiveintelligence.xyz/mcp`  |
| Cursor                                | Yes              | OAuth or API-key fallback           | Yes         | Secret-free config prefill above                                             |
| VS Code                               | Yes              | OAuth or API-key fallback           | Yes         | Secret-free config prefill above                                             |
| Windsurf / Devin Desktop              | Yes              | OAuth or API-key fallback           | Yes         | Add the hosted URL in MCP settings                                           |
| Gemini CLI                            | Yes              | OAuth or API-key fallback           | Yes         | `gemini mcp add hive https://mcp.hiveintelligence.xyz/mcp --transport http --scope user`  |
| Codex                                 | Yes              | OAuth or API-key fallback           | Yes         | `codex mcp add hive --url https://mcp.hiveintelligence.xyz/mcp`, then `codex mcp login hive` |
| OpenAI Responses API                  | Yes              | API-key authorization token         | No          | Use a server-side remote MCP `tools` entry                                   |
| ChatGPT custom apps                   | Deployment-gated | OAuth 2.1                           | No          | Direct after hosted OAuth + consent activation; use Responses API until then |
| Claude custom connectors/directory    | Deployment-gated | OAuth 2.1                           | No          | Direct after hosted OAuth + consent activation                               |
| Grok custom connectors                | Deployment-gated | OAuth 2.1                           | No          | Add the hosted URL at `grok.com/connectors`                                  |

Header-based API key auth works today for clients or API surfaces that support
custom headers or authorization tokens. The server also includes a fail-closed
OAuth 2.1 foundation with PKCE, protected-resource discovery, CIMD/DCR, rotating
refresh tokens, and revocation. It is disabled until the hosted deployment and
the Hive consent page are configured. See [MCP OAuth 2.1 operations](docs/OAUTH.md).

Codex versions that do not show `--url` in `codex mcp add --help` must be
updated before the remote-MCP command will work. Run `codex update` when the
installed release supports self-update; otherwise update it through the
installer or package manager you originally used. Public OpenAI/Codex and Cursor
plugin artifacts are staged in the public SDK, but marketplace installs are not
advertised as live until external approval and clean-profile verification. See
[the distribution runbook](docs/DISTRIBUTION.md).

## Run Local stdio MCP

Use local `stdio` for clients that only launch local processes, such as Claude
Desktop's `claude_desktop_config.json`. By default the stdio server is a thin
proxy to the hosted MCP, so it serves the same production tools, data, and
receipts. It authenticates with the key saved by `hive auth login` (or
`HIVE_API_KEY` in the launching environment); without one it can list tools
but every tool call asks you to sign in.

```json
{
  "mcpServers": {
    "hive": {
      "command": "npx",
      "args": ["-y", "-p", "hive-intelligence@latest", "hive"]
    }
  }
}
```

Running `hive` with no subcommand starts the `stdio` MCP server. Always launch
it through `hive-intelligence@latest`: `npx hive-mcp` downloads an unrelated npm
package (or runs a stale global install), and `npx hive-intelligence` without
`@latest` can keep running an old version.

To self-host with your own upstream provider keys instead, opt in with
`hive serve --local` or `HIVE_STDIO_MODE=local`:

```json
{
  "mcpServers": {
    "hive-local": {
      "command": "npx",
      "args": ["-y", "-p", "hive-intelligence@latest", "hive", "serve", "--local"],
      "env": {
        "COINGECKO_PRO_API_KEY": "optional",
        "ALCHEMY_API_KEY": "optional",
        "HELIUS_API_KEY": "optional"
      }
    }
  }
}
```

## Staying Current

The hosted MCP (`https://mcp.hiveintelligence.xyz/mcp`) is managed by Hive.
Local `stdio` installs are pinned to whatever your client last fetched, so:

- Keep `hive-intelligence@latest` in your client config (as shown above) so each
  host restart re-resolves the newest version.
- Update a global install with npm, then restart your MCP client to load it:

```bash
npm install -g hive-intelligence@latest
```

`hive` checks npm for newer versions once a day and surfaces the result through
`hive doctor` and the MCP server instructions, so your agent can prompt you when
an update is available. Set `HIVE_NO_UPDATE_CHECK=1` to disable the check.

`hive doctor` also flags a stale global `hive-intelligence` install, client
configs that launch `npx hive-mcp`, a bare global `hive` binary, a pinned or
untagged `hive-intelligence`, or the retired `https://hiveintelligence.xyz/mcp`
URL, and duplicate Hive entries. `hive doctor --fix` rewrites those entries to
the canonical form after saving a `.hive-backup-<time>` copy of each file:

```bash
npx -y -p hive-intelligence@latest hive doctor --fix
```

## Use The CLI

Search the catalog:

```bash
npx -y -p hive-intelligence@latest hive tools search "token risk"
```

Inspect a schema before execution:

```bash
npx -y -p hive-intelligence@latest hive tools info get_price
```

Call a tool from the terminal:

```bash
npx -y -p hive-intelligence@latest hive tools call get_token_price --token bitcoin --json
```

Check setup and provider status:

```bash
npx -y -p hive-intelligence@latest hive doctor
npx -y -p hive-intelligence@latest hive status
```

Write client config for every app it finds, or preview it first:

```bash
npx -y -p hive-intelligence@latest hive init --all --skip-verify
npx -y -p hive-intelligence@latest hive init --all --dry-run
```

## How Agents Should Use Hive

Hive is designed for retrieval-led agent work:

1. For one token price, token safety check, or wallet portfolio, call the hero
   tool directly.
2. Otherwise call `search_tools`; use its cursor instead of loading the entire
   catalog.
3. Inspect exact parameters and the endpoint's `operation` with
   `get_api_endpoint_schema` or `hive tools info`.
4. Execute reads through `invoke_api_endpoint`.
5. Copy each material call's server-returned `_hive` block into the answer's
   receipt and map each material claim to exact receipt IDs.
6. Stop when the decision is answerable or a material gap cannot be resolved.
   Report partial evidence instead of silently expanding scope.

`search_tools`, `get_api_endpoint_schema`, MCP `tools/list`, and resource reads cost zero Hive credits.
Material endpoint executions cost one credit each.

Freshness has two layers. `_hive.observed_at` is when Hive first observed the
response, or the original cache-population time on a cache hit;
`cache_age_ms: 0` means newly retrieved by Hive, not necessarily that the
upstream datum is current. Use a provider timestamp, block, slot, transaction,
or candle close for source recency. If the provider supplies none, report
upstream recency as unknown.

The runtime receipt also includes server/build version plus SHA-256
`input_digest` and `result_digest` self-checks. The result check covers the
canonical normalized returned payload with the top-level `_hive` block
removed. They are not signatures and do not imply a retained receipt lookup.

This flow lets an agent answer questions like:

- "Is this token safe to buy?"
- "What changed in this wallet over the last week?"
- "Compare Aave and Curve by TVL, fees, chains, and risk."
- "Compare funding for a tokenized stock perp across the RWA venues."
- "Show the best pools for this token and explain liquidity risk."

## MCP Contract

Root endpoint:

```text
https://mcp.hiveintelligence.xyz/mcp
```

Local development endpoint:

```text
http://localhost:8080/mcp
```

Root MCP tools:

- `get_token_price`, `check_token_safety`, `get_wallet_portfolio` (hero tools)
- `search_tools`
- `get_api_endpoint_schema`
- `invoke_api_endpoint` for read-only endpoints

A 10-minute worker persists current-build provider, MCP protocol, and OAuth
lifecycle canary evidence in Redis for `/api/health` and `/status`; missing or
stale evidence remains `unknown`.

Discovery resources:

- `hive://providers`
- `hive://skills`
- `hive://skills/{name}` for one complete procedural skill

## Providers

| Provider        | Coverage                                                                           | Env var                                                                                                                                         |
| --------------- | ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| Alchemy         | EVM wallet, token, NFT, transfer, simulation, gas, Solana DAS/Photon, and RPC data | `ALCHEMY_API_KEY`                                                                                                                               |
| CoinGecko       | Prices, OHLC, trending, news, on-chain networks, and tokenized RWA markets          | Optional `COINGECKO_PRO_API_KEY` or `COINGECKO_DEMO_API_KEY`                                                                                    |
| DeFiLlama       | TVL, yields, fees, bridges                                                         | Free                                                                                                                                            |
| CCXT            | CEX data, funding rates, perpetuals                                                | Free                                                                                                                                            |
| GoPlus          | Token, wallet, NFT, approval, phishing, and dApp security                          | `GOPLUS_APP_KEY` plus `GOPLUS_APP_SECRET`                                                                                                         |
| Helius          | Solana RPC, DAS, priority fees, wallet history, and Parsed Events                  | `HELIUS_API_KEY`                                                                                                                                |
| Tenderly        | EVM simulation, tracing, gas estimation, and read-only Node RPC                    | REST: `TENDERLY_API_KEY` + `TENDERLY_ACCOUNT_SLUG` + `TENDERLY_PROJECT_SLUG`; Node: `TENDERLY_NODE_ACCESS_KEY` or `TENDERLY_GATEWAY_ACCESS_KEY` |
| Hyperliquid     | Full /info surface: perp/spot markets, order books, user state, vaults, staking, borrow/lend, HIP-4 outcome markets | Free                                                                                                                                            |
| RWA Perps       | Keyless three-venue fan-out for tokenized-asset perps (`rwa_` tools): Hyperliquid HIP-3 builder dexes, Lighter, Extended                   | Free                                                                                                                                            |
| Hive Archive    | ClickHouse-backed derivatives history (`archive_` tools) served by Hive            | None (Hive-hosted)                                                                                                                              |
| Polymarket      | Prediction markets: market and event search, market-implied odds, order books, odds history, wallet positions | Free (keyless)                                                                                                        |
| Kalshi          | Prediction markets: market and event search, market-implied odds, order books, trades, candlestick history | Free (keyless)                                                                                                        |
| Alternative.me  | Crypto Fear and Greed Index, current plus daily history                            | Free (keyless)                                                                                                        |
| Blockchain.com  | Daily Bitcoin on-chain charts: hash rate, active addresses, transaction count      | Free (keyless)                                                                                                        |
| Blockscout      | EVM token holder counts by USD balance tier (`get_token_holder_distribution`)      | Free (keyless); optional `BLOCKSCOUT_API_KEY` for the PRO API                                                         |
| Goldsky         | EVM JSON-RPC on ~150 chains (eth_call, logs, traces, archive, HyperEVM) and priced wallet balances/transfers (Feeds) | `GOLDSKY_EDGE_API_KEY` (Edge RPC endpoint key) and `GOLDSKY_DATA_API_KEY` (Feeds key)                                 |
| Open Data Fetch | Allowlisted, size-capped access to long-tail public crypto APIs                    | Free                                                                                                                                            |

Providers without configured keys remain discoverable and return classified
runtime status such as `missing_key`, `plan_required`, `rate_limited`,
`degraded`, or `failing` when execution is unavailable.

## REST API

Use REST when your app does not speak MCP.

List tools:

```bash
curl -X GET "https://mcp.hiveintelligence.xyz/api/v1/tools?search=price&limit=20" \
  -H "Authorization: Bearer $HIVE_API_KEY"
```

Execute a tool:

```bash
curl -X POST https://mcp.hiveintelligence.xyz/api/v1/execute \
  -H "Authorization: Bearer $HIVE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tool": "get_price",
    "args": {
      "ids": "bitcoin",
      "vs_currencies": "usd"
    }
  }'
```

## Troubleshooting

| Symptom                                                     | What to check                                                                                                                          |
| ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `API key required`                                          | Run `hive auth login`, pass `--api-key`, or set the hosted MCP `Authorization: Bearer ...` header.                                     |
| `Unsupported engine` or install failure                     | Use Node.js 22.12 or newer; Node.js 24 LTS is recommended.                                                                             |
| Hosted MCP works in one client but not another              | Confirm whether the client uses custom API-key headers or native OAuth. Native connectors require the hosted OAuth deployment and consent page to be enabled. |
| A provider tool returns `missing_key`                       | The tool is discoverable, but that provider needs an env var such as `ALCHEMY_API_KEY`, `HELIUS_API_KEY`, or `TENDERLY_API_KEY`.       |
| A provider returns `rate_limited`, `degraded`, or `failing` | Check `hive status`, `hive doctor`, or `hive://providers` for runtime status and retry guidance.                                       |
| `npx` install/cache errors                                  | Retry with a clean cache: `NPM_CONFIG_CACHE=$(mktemp -d) npx -y -p hive-intelligence@latest hive --help`.                              |

## Develop Locally

Install:

```bash
npm install
```

Run:

```bash
npm run dev          # stdio MCP
npm run dev:http     # HTTP MCP and REST API on :8080
```

Verify:

```bash
npm run check
```

Focused checks:

```bash
npm run build
npm run test:unit
npm run test:mcp-compliance
npm run verify:agent-skills
npm run env:render:check
```

## Package Contents

The `hive-intelligence` npm package includes:

- `hive`, `hive-intelligence`, `hive-mcp`, and `hive-mcp-server` binaries.
- Built MCP server and CLI files in `build/`.
- Bundled Hive agent skills in `agent-skills/`.
- Local `stdio` MCP runtime for desktop clients and self-hosting.

## Contributor Context

Core implementation areas:

- `src/mcpServer.ts` builds the MCP server, tools, resources, and runtime
  instructions.
- `src/server.ts` runs Express, Streamable HTTP MCP, REST routes, auth,
  middleware, discovery descriptors, and shutdown.
- `src/cli.ts` and `src/cli/` expose auth, setup, discovery, execution,
  diagnostics, config generation, aliases, and watch mode.
- `agent-skills/` ships agent-installable Hive skills.

## Links

- Website: https://www.hiveintelligence.xyz
- Hosted MCP: https://mcp.hiveintelligence.xyz/mcp
- Public SDK and issues: https://github.com/hive-intel/hive-sdk
- Authenticated REST tool catalog: https://mcp.hiveintelligence.xyz/api/v1/tools
- Public live catalog overview: https://www.hiveintelligence.xyz/tools/live-catalog
- Install guides: https://www.hiveintelligence.xyz/install
- Quick start: https://www.hiveintelligence.xyz/quick-start
