Mem- Oracle

API Reference

HTTP API endpoints for the worker service.

Base URL

Base URL
http://127.0.0.1:7432

Endpoints

MethodEndpointDescription
POST/indexIndex a documentation site
POST/retrieveSearch for relevant snippets
GET/statusGet indexing status
POST/refreshRefresh a docset (by id or baseUrl)
POST/refresh-allRefresh all docsets
GET/docset/:idGet a docset and its index status
GET/docset/:id/pagesList pages in a docset
DELETE/docset/:idDelete a docset
POST/session/registerRegister a client session
POST/session/unregisterUnregister a client session
GET/sessionsList active sessions
GET/healthHealth check

POST /index

Index a documentation website.

Request

Request Body
{
  "baseUrl": "https://nextjs.org",
  "seedSlug": "/docs/getting-started",
  "name": "Next.js Docs",
  "allowedPaths": ["/docs"],
  "waitForSeed": true
}

Parameters

FieldTypeRequiredDescription
baseUrlstringYesBase URL of the documentation site
seedSlugstringYesStarting path to begin crawling
namestringNoCustom name for the docset
allowedPathsstring[]NoAllowed path prefixes to crawl
waitForSeedbooleanNoWait for seed page to be indexed before returning

Response

Response
{
  "docsetId": "abc123",
  "status": "indexing",
  "seedIndexed": true
}

Example

Terminal
curl -X POST http://localhost:7432/index \
  -H "Content-Type: application/json" \
  -d '{
    "baseUrl": "https://nextjs.org",
    "seedSlug": "/docs/getting-started",
    "name": "Next.js Docs",
    "allowedPaths": ["/docs"],
    "waitForSeed": true
  }'

POST /retrieve

Search for relevant documentation snippets with diversity filtering and character budget control.

Request

Request Body
{
  "query": "how to use server components",
  "topK": 5,
  "docsetIds": ["abc123"],
  "maxChunksPerPage": 2,
  "maxTotalChars": 16000,
  "formatSnippets": true
}

Parameters

FieldTypeRequiredDefaultDescription
querystringYes-Search query
topKnumberNo5Number of results (clamped 1-100)
docsetIdsstring[]NoAllFilter by specific docsets
maxChunksPerPagenumberNo3Max chunks from same page (diversity)
maxTotalCharsnumberNo32000Total character budget for results
formatSnippetsbooleanNotrueInclude formatted snippets

Response

Response
{
  "query": "how to use server components",
  "results": [
    {
      "chunkId": "chunk-123",
      "pageId": "page-456",
      "docsetId": "abc123",
      "content": "Server Components allow you to write UI that can be rendered...",
      "url": "https://nextjs.org/docs/app/building-your-application/rendering/server-components",
      "title": "Server Components",
      "heading": "Introduction",
      "score": 0.89,
      "snippet": {
        "formatted": "## Server Components\nSource: https://nextjs.org/docs/.../server-components\nSection: Rendering > Server Components > Introduction\n\nServer Components allow you to write UI that can be rendered...",
        "title": "Server Components",
        "url": "https://nextjs.org/docs/app/building-your-application/rendering/server-components",
        "breadcrumb": "Rendering > Server Components > Introduction",
        "content": "Server Components allow you to write UI that can be rendered...",
        "charCount": 245
      }
    }
  ],
  "totalChars": 1250,
  "truncated": false
}

Response Fields

FieldTypeDescription
resultsarrayArray of search results with optional snippets
totalCharsnumberTotal characters across all results
truncatedbooleanWhether results were truncated due to budget

Snippet Object

When formatSnippets is enabled, each result includes a snippet object:

FieldTypeDescription
formattedstringReady-to-use formatted text for context injection
titlestringPage title
urlstringSource URL
breadcrumbstringHeading path (e.g., "Api > Auth > OAuth")
contentstringThe content text (may be truncated)
charCountnumberCharacter count of formatted snippet

Example

Terminal
curl -X POST http://localhost:7432/retrieve \
  -H "Content-Type: application/json" \
  -d '{
    "query": "how to use server components",
    "topK": 5,
    "maxChunksPerPage": 2,
    "maxTotalChars": 16000,
    "formatSnippets": true
  }'

Diversity Filtering

The maxChunksPerPage parameter prevents results from being dominated by chunks from a single page:

Diverse Results
# Get at most 2 chunks from each page
curl -X POST http://localhost:7432/retrieve \
  -H "Content-Type: application/json" \
  -d '{
    "query": "authentication",
    "topK": 10,
    "maxChunksPerPage": 2
  }'

Character Budget

Control the total size of returned content for predictable context injection:

Limited Budget
# Limit total response to ~8000 characters
curl -X POST http://localhost:7432/retrieve \
  -H "Content-Type: application/json" \
  -d '{
    "query": "getting started",
    "topK": 10,
    "maxTotalChars": 8000
  }'

GET /status

Get the status of all indexed documentation.

Query Parameters

ParameterTypeDescription
docsetIdstringFilter to a specific docset
includeStuckbooleanInclude stuckPages details

Response

Response
{
  "docsets": [
    {
      "id": "abc123",
      "name": "Next.js Docs",
      "baseUrl": "https://nextjs.org",
      "seedSlug": "/docs/getting-started",
      "allowedPaths": ["/docs"],
      "createdAt": 1705318800000,
      "updatedAt": 1705320600000,
      "status": "ready",
      "indexStatus": {
        "docsetId": "abc123",
        "totalPages": 245,
        "indexedPages": 245,
        "pendingPages": 0,
        "errorPages": 0,
        "skippedPages": 0,
        "totalChunks": 4120,
        "status": "ready",
        "stuckPages": 0,
        "retriedPages": 0
      }
    }
  ]
}

stuckPages is included when includeStuck=true or when stuck pages exist.

Example

Terminal
curl http://localhost:7432/status

POST /refresh

Refresh a specific docset by docsetId or baseUrl.

Request

Request Body
{
  "docsetId": "abc123",
  "force": false,
  "maxAge": 24,
  "fullReindex": false
}

Parameters

FieldTypeRequiredDescription
docsetIdstringNoDocset ID to refresh
baseUrlstringNoDocset base URL to refresh
forcebooleanNoRefresh even if docset is fresh
maxAgenumberNoMax age in hours before refresh is needed
fullReindexbooleanNoClear hashes and re-embed all pages

Response

Response
{
  "docsetId": "abc123",
  "status": "pending",
  "refreshed": true,
  "message": "Refreshing 245 pages from Next.js Docs (incremental mode)",
  "incremental": {
    "preservedHashes": 240,
    "clearedHashes": 5
  }
}

POST /refresh-all

Refresh all docsets that are stale (or all, if force is true).

Request

Request Body
{
  "force": false,
  "maxAge": 24,
  "fullReindex": false
}

Response

Response
{
  "total": 2,
  "refreshed": 1,
  "results": [
    {
      "docsetId": "abc123",
      "status": "pending",
      "refreshed": true,
      "message": "Queued 245 pages for refresh (incremental)",
      "incremental": {
        "preservedHashes": 240,
        "clearedHashes": 5
      }
    }
  ]
}

GET /docset/:id

Get a single docset and its index status.

Response

Response
{
  "id": "abc123",
  "name": "Next.js Docs",
  "baseUrl": "https://nextjs.org",
  "seedSlug": "/docs/getting-started",
  "allowedPaths": ["/docs"],
  "createdAt": 1705318800000,
  "updatedAt": 1705320600000,
  "status": "ready",
  "indexStatus": {
    "docsetId": "abc123",
    "totalPages": 245,
    "indexedPages": 245,
    "pendingPages": 0,
    "errorPages": 0,
    "skippedPages": 0,
    "totalChunks": 4120,
    "status": "ready",
    "stuckPages": 0,
    "retriedPages": 0
  }
}

GET /docset/:id/pages

List pages in a docset with pagination.

Query Parameters

ParameterTypeDescription
statusstringFilter by page status
limitnumberMax pages to return (default: 100, max: 500)
offsetnumberOffset for pagination (default: 0)

Response

Response
{
  "pages": [
    {
      "id": "page-123",
      "url": "https://nextjs.org/docs/app",
      "path": "/docs/app",
      "title": "App Router",
      "status": "indexed",
      "errorMessage": null,
      "fetchedAt": 1705320400000,
      "indexedAt": 1705320410000
    }
  ],
  "total": 245,
  "limit": 100,
  "offset": 0
}

DELETE /docset/:id

Delete a docset and all its indexed content.

Parameters

ParameterTypeDescription
idstringThe docset ID to delete

Response

Response
{
  "success": true,
  "docsetId": "abc123"
}

Example

Terminal
curl -X DELETE http://localhost:7432/docset/abc123

POST /session/register

Register a client session (used by editor plugins).

Request

Request Body
{
  "sessionId": "session-123",
  "clientType": "claude-code"
}

Response

Response
{
  "success": true,
  "session": {
    "id": "session-123",
    "clientType": "claude-code",
    "connectedAt": 1705320400000,
    "lastHeartbeat": 1705320400000
  },
  "totalSessions": 1
}

POST /session/unregister

Unregister a client session.

Request

Request Body
{
  "sessionId": "session-123"
}

Response

Response
{
  "success": true,
  "existed": true,
  "remainingSessions": 0,
  "shouldStop": true
}

GET /sessions

List active sessions.

Response

Response
{
  "sessions": [
    {
      "id": "session-123",
      "clientType": "claude-code",
      "connectedAt": 1705320400000,
      "lastHeartbeat": 1705320400000
    }
  ],
  "count": 1
}

GET /health

Health check endpoint.

Response

Response
{
  "status": "ok",
  "timestamp": 1705320400000,
  "version": "1.4.0"
}

Example

Terminal
curl http://localhost:7432/health

Error Responses

All endpoints return errors in this format:

Error Response
{
  "error": "Error message here"
}

On this page