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

# MCP

> High-level instructions for using the hosted Memex MCP server

Use the hosted Memex MCP server when your agent runtime supports the Model Context Protocol.

Server URL:

`https://memex.garden/api/mcp`

Use the same base URL for both OAuth and API-key clients. Do not point clients at `/oauth/*` directly unless the client explicitly asks for issuer metadata.

## Before your first call

1. Connect with your client's OAuth flow. No API keys or bearer-token exports are required for the default setup.
2. Call `discover_actions` with the intended Memex operation to get the relevant action IDs and input descriptions.
3. Parse responses using [Response shape](https://docs.memex.garden/general/response-shape.md).
4. If credits run out, follow [Buy credits](https://docs.memex.garden/general/buy-credits.md).

To add usage balance, open [https://memex.garden/pricing](https://memex.garden/pricing) in your browser.

## Available tools

* `discover_actions`
* `read_action`
* `write_action`

Use the execution tool in the discovered card's `name` field. Reads use `read_action`; mutations and external effects use `write_action`. Both take the chosen `actionId` and its input object. The server enforces that separation. Read tools declare `readOnlyHint: true`; write tools declare `destructiveHint: true`. Additional app-only and handoff integration tools have their own permission annotations. See the [Action catalog](https://docs.memex.garden/for-agents/action-catalog.md).

This inventory is registered from the shared action catalogue. Tool identity, descriptions, schemas, ordering, and required scopes must be changed there rather than in the MCP server bootstrap.

REST clients can use the equivalent `POST /actions/discover` endpoint.

These wrap the Memex operations documented on [Available endpoints](https://docs.memex.garden/general/available-endpoints.md).

REST-only operations are also documented in [Available endpoints](https://docs.memex.garden/general/available-endpoints.md). For example, use authenticated REST calls to `POST /list-auto-tagging-rules` and `POST /create-auto-tagging-rule` when a client needs to read or create auto-tagging rules.

For `library.search` through `read_action`:

* pass `responseMode: "lightweight"` for discovery cards: each result has transport-only `contentEntityId` and `url`, plus a type-specific semantic `context` object. URLs and IDs are not intended for model context.
* pass `responseMode: "compact"` for the existing LLM-ready source response, or `responseMode: "full"` for the rich raw payload. `responseMode` takes precedence over the legacy `raw` boolean.
* omit `raw` or pass `raw: false` to get the default compact response array with `type`, `url`, `createdAt`, `title?`, `text`, and optional slim `media`
* pass `raw: true` to get the richer machine-readable payload with `results`, `referencesByResultId`, and related entity lists
* if the client asks for `llm` or `full`, use `llm` for `raw: false` and `full` for `raw: true`
* compact `raw: false` search defaults reranking on when the query is eligible for rerank
* raw `raw: true` search defaults reranking off unless you set `enableRerank: true`
* `contentTypes` accepts a list of exact `content_entity.type` values:
  `web`, `pdf`, `youtube`, `twitter`, `instagram`, `tiktok`, `facebook`, `linkedin`, `pinterest`, `reddit`, `chatgpt`, `claude`, `annotation`, `image`, `transcribedMedia`, `audioRecording`, `selector`, `chatThread`, `twitterProfile`, `subreddit`, `youtubeChannel`
* to search inside private saved views from MCP or Claude, pass `viewIds` with one or more view IDs
* to search specific feeds, pass `feedIds` using IDs returned by `feeds.list_subscribed`
* to search across all subscribed feeds only, pass `feedScope: "all"`
* omit both `feedIds` and `feedScope` to search the full library
* pass `feedReadStates: ["unread", "read","pending" \| "processing" \| "processed" \| "failed" \| "archived"]` when archived feed entries should be included

For saved views:

* use `library.search` with `viewIds` when an MCP or Claude client needs to search inside a private saved view
* use `raw: false` or omit `raw` for the `llm` response option
* use `raw: true` for the `full` response option
* use authenticated REST `POST /create-view` and `POST /list-views` to create or list saved views
* use authenticated or public-token REST `POST /execute-view-search` only when the full/raw shape is acceptable or when searching a public shared view token

For `feeds.list_subscribed` through `read_action`, use an empty `input` object. The response returns `feeds`, the authenticated user's subscribed RSS and YouTube feed list.

For `handoffs.list` through `read_action`:

* omit `status` to list pending/unprocessed handoffs, including items that are not ready for webhook delivery
* pass `status: "processing"`, `"processed"`, `"failed"`, or `"archived"` only when the user asks beyond pending handoffs
* use `referenceContentEntityId` to filter to handoffs that reference a specific Memex content entity
* use `createdAtFrom` and `createdAtTo` for arbitrary ISO timestamp ranges, or `day` for a single `YYYY-MM-DD` day
* use `requestedDestinationText` to filter to a target app, agent, or person
* the response includes `handoffs`; these are operational queue records, not content entities
* execute the discovered handoff-draining action only after an agent actually processed a pulled handoff

For `sharing.create_link` through `write_action`:

* pass a saved `contentId` returned by `library.search` or `library.save_url`
* set `access` to `view` for read-only sharing or `collaborate` for collaborative access
* the response includes `shareUrl`, `publicToken`, `access`, and `accessMode`

For `sharing.list_links`:

* omit arguments to list all public content sharing links
* optionally filter by `contentId`, `contentType`, or `access`
* each link includes `shareUrl`, `publicToken`, `access`, `accessMode`, `contentId`, and `contentType`

## Choose an auth mode

### Claude Code or raw MCP client

Use API-key auth when the MCP client can send custom headers or query parameters directly.

Send the API key as either query parameters:

```text theme={null}
https://memex.garden/api/mcp?apiKey=YOUR_MEMEX_API_KEY
https://memex.garden/api/mcp?userId=YOUR_USER_ID&apiKey=YOUR_MEMEX_API_KEY
```

Or as headers:

```http theme={null}
X-Api-Key: YOUR_MEMEX_API_KEY
X-User-Id: YOUR_USER_ID
```

If your MCP client already has an OAuth access token or Supabase session JWT, it can also send:

```http theme={null}
Authorization: Bearer YOUR_BEARER_TOKEN
```

## Request shape

### List tools

```json theme={null}
{
    "jsonrpc": "2.0",
    "id": "tools-list-1",
    "method": "tools/list",
    "params": {}
}
```

### Call a tool

```json theme={null}
{
    "jsonrpc": "2.0",
    "id": "call-1",
    "method": "tools/call",
    "params": {
        "name": "search_content",
        "arguments": {
            "query": "vector databases",
            "contentTypes": ["web", "pdf"],
            "limit": 5
        }
    }
}
```

### Call `library.search` in raw mode

```json theme={null}
{
    "jsonrpc": "2.0",
    "id": "call-2",
    "method": "tools/call",
    "params": {
        "name": "search_content",
        "arguments": {
            "query": "vector databases",
            "limit": 5,
            "raw": true,
            "includeNotes": true
        }
    }
}
```

### Call `library.search` inside a saved view

Use this shape for the LLM-ready response:

```json theme={null}
{
    "jsonrpc": "2.0",
    "id": "call-3",
    "method": "tools/call",
    "params": {
        "name": "search_content",
        "arguments": {
            "viewIds": ["view_id"],
            "query": "vector database benchmarks",
            "limit": 10,
            "raw": false
        }
    }
}
```

Use this shape for the full response:

```json theme={null}
{
    "jsonrpc": "2.0",
    "id": "call-4",
    "method": "tools/call",
    "params": {
        "name": "search_content",
        "arguments": {
            "viewIds": ["view_id"],
            "query": "vector database benchmarks",
            "limit": 10,
            "raw": true,
            "includeNotes": true
        }
    }
}
```

## Response parsing

For successful Memex MCP calls:

* use `result.structuredContent` as the parsed object
* treat `result.content[0].text` as the serialized text copy of the same payload

If the tool call fails before `structuredContent` exists, re-check the request against [Available endpoints](https://docs.memex.garden/general/available-endpoints.md).

## Related agent setups

* Copyable markdown skill: [Skill.md](https://docs.memex.garden/for-agents/skill-md.md)
* Hosted plugin bundle for Codex: [Codex plugin](https://docs.memex.garden/for-agents/codex-plugin.md)
* Claude plugin: [Claude plugin](https://docs.memex.garden/for-agents/claude-plugin.md)
* GenSpark MCP setup: [GenSpark MCP](https://docs.memex.garden/for-agents/genspark-mcp.md)
* GBrain MCP setup: [GBrain MCP](https://docs.memex.garden/for-agents/gbrain-mcp.md)
* GPT Researcher MCP setup: [GPT Researcher MCP](https://docs.memex.garden/for-agents/gptr-mcp.md)
* OpenClaw wiring notes: [OpenClaw plugin](https://docs.memex.garden/for-agents/openclaw-plugin.md)
* Obsidian desktop integration: [Obsidian plugin](https://docs.memex.garden/for-agents/obsidian-plugin.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.