> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hydradb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# HydraDB MCP

> MCP (Model Context Protocol) server for [HydraDB](https://hydradb.com). Provides tools for storing, recalling, and managing memories with knowledge-graph enriched context.

## Quick Start

<Steps>
  <Step title="Get your credentials">
    * Create an API key from the [HydraDB dashboard](https://app.hydradb.com/keys)
    * Create or copy your tenant ID from the [HydraDB dashboard](https://app.hydradb.com/tenants)
  </Step>

  <Step title="Add the MCP server to your client">
    <Tabs>
      <Tab title="Claude Desktop">
        ```json theme={"dark"}
        {
          "mcpServers": {
            "hydradb": {
              "command": "npx",
              "args": ["-y", "@hydradb/mcp@0.0.1"],
              "env": {
                "HYDRA_DB_API_KEY": "your-api-key",
                "HYDRA_DB_TENANT_ID": "your-tenant-id"
              }
            }
          }
        }
        ```
      </Tab>

      <Tab title="Cursor">
        Add to `~/.cursor/mcp.json`:

        ```json theme={"dark"}
        {
          "mcpServers": {
            "hydradb": {
              "command": "npx",
              "args": ["-y", "@hydradb/mcp@0.0.1"],
              "env": {
                "HYDRA_DB_API_KEY": "your-api-key",
                "HYDRA_DB_TENANT_ID": "your-tenant-id"
              }
            }
          }
        }
        ```
      </Tab>

      <Tab title="Windsurf">
        Add to `~/.codeium/windsurf/mcp_config.json`:

        ```json theme={"dark"}
        {
          "mcpServers": {
            "hydradb": {
              "command": "npx",
              "args": ["-y", "@hydradb/mcp@0.0.1"],
              "env": {
                "HYDRA_DB_API_KEY": "your-api-key",
                "HYDRA_DB_TENANT_ID": "your-tenant-id"
              }
            }
          }
        }
        ```
      </Tab>

      <Tab title="VS Code">
        Add to `.vscode/mcp.json`:

        ```json theme={"dark"}
        {
          "servers": {
            "hydradb": {
              "type": "stdio",
              "command": "npx",
              "args": ["-y", "@hydradb/mcp@0.0.1"],
              "env": {
                "HYDRA_DB_API_KEY": "your-api-key",
                "HYDRA_DB_TENANT_ID": "your-tenant-id"
              }
            }
          }
        }
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step title="Replace the placeholder values">
    Swap `your-api-key` and `your-tenant-id` with the credentials you copied in Step 1.
  </Step>

  <Step title="Restart your client">
    Restart your editor or client so it picks up the new MCP server configuration.
  </Step>
</Steps>

<Note>
  Requires **Node.js 18 or later**. Run `node --version` to check.
</Note>

***

## Configuration

### Environment Variables

| Variable                 | Description                                 | Default        |
| ------------------------ | ------------------------------------------- | -------------- |
| `HYDRA_DB_API_KEY`       | Your HydraDB API key                        | *Required*     |
| `HYDRA_DB_TENANT_ID`     | Your HydraDB tenant identifier              | *Required*     |
| `HYDRA_DB_SUB_TENANT_ID` | Sub-tenant for data partitioning            | `hydra-db-mcp` |
| `HYDRA_DB_LOG_LEVEL`     | Log level: `DEBUG`, `INFO`, `WARN`, `ERROR` | `ERROR`        |

### Custom Sub-Tenant

Use `HYDRA_DB_SUB_TENANT_ID` to partition data across projects:

```json theme={"dark"}
{
  "mcpServers": {
    "hydradb": {
      "command": "npx",
      "args": ["-y", "@hydradb/mcp@0.0.1"],
      "env": {
        "HYDRA_DB_API_KEY": "your-api-key",
        "HYDRA_DB_TENANT_ID": "your-tenant-id",
        "HYDRA_DB_SUB_TENANT_ID": "my-project"
      }
    }
  }
}
```

<Note>
  Use a project-specific `HYDRA_DB_SUB_TENANT_ID` to keep memory isolated per workspace, or a shared value to share context across projects.
</Note>

***

## How It Works

At recall time, `hydra_db_search` queries HydraDB and returns graph-enriched context - entity paths, chunk relations, and linked extra context - injected directly into the model's prompt.

At capture time, `hydra_db_store` and `hydra_db_ingest_conversation` send content with `infer: true` and `upsert: true`, triggering HydraDB's knowledge graph extraction pipeline automatically.

### Available Tools

| Tool                           | Endpoint                          | Description                                                                                                             |
| ------------------------------ | --------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `hydra_db_search`              | `POST /recall/recall_preferences` | Query for relevant memories; returns graph-enriched context (entity paths, chunk relations, extra context)              |
| `hydra_db_store`               | `POST /memories/add_memory`       | Store text with `infer: true` and `upsert: true` - HydraDB extracts insights and builds a knowledge graph automatically |
| `hydra_db_ingest_conversation` | `POST /memories/add_memory`       | Store user-assistant pairs as conversation turns, grouped by `source_id`                                                |
| `hydra_db_list_memories`       | `GET /list/data`                  | Browse all stored memories                                                                                              |
| `hydra_db_list_sources`        | `GET /list/data`                  | Browse all stored sources                                                                                               |
| `hydra_db_delete_memory`       | `DELETE /memories/delete_memory`  | Remove a specific memory by ID                                                                                          |
| `hydra_db_fetch_content`       | `GET /fetch/content`              | Retrieve the original ingested content                                                                                  |

***

## Source & Show Support

<Note>
  If this HydraDB MCP server makes your agentic memory workflow faster (and smarter), please star the open-source repo that powers it.

  <Card title="hydradb-mcp" icon="star" href="https://github.com/usecortex/hydradb-mcp">
    Star on GitHub if you found it useful.
  </Card>
</Note>
