mcpField
D
denser-retriever

denser-retriever

github.com/denser-orgDocuments656 installsUpdated 36w ago
Repository

About denser-retriever

denser-retriever is a skill for using the Denser Retriever REST API to manage knowledge bases and search documents semantically. It guides file and text imports, processing checks, and queries through curl.

Key features

  1. 01Create and manage knowledge bases
  2. 02Upload and import supported files
  3. 03Import plain text content
  4. 04Check document processing status
  5. 05Search documents semantically

Use cases

  1. 01Build a searchable knowledge base from files
  2. 02Add text documents without file upload
  3. 03Search one or all knowledge bases

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/denser-org/claude-skills --skill denser-retriever

After installing, type/denser-retrieverin Claude Code to confirm it loaded.

Bundled filesreferences/api_reference.md

Details

From the project README

Denser Retriever API

Manage knowledge bases and perform semantic search over documents via the Denser Retriever REST API. All operations use curl commands.

Setup

API Key: Read from DENSER_API_KEY environment variable. If not set, ask the user for their API key.

Base URL: https://retriever.denser.ai/api/open/v1

To check if the key is available:

echo $DENSER_API_KEY

If empty, ask the user: "Please provide your Denser Retriever API key (from your organization settings)."

Quick Reference

OperationMethodEndpoint
Get usageGET/v1/getUsage
Get balanceGET/v1/getBalance
Create KBPOST/v1/createKnowledgeBase
List KBsGET/v1/listKnowledgeBases
Update KBPOST/v1/updateKnowledgeBase
Delete KBPOST/v1/deleteKnowledgeBase
Upload file (presign)POST/v1/presignUploadUrl
Import filePOST/v1/importFile
Import textPOST/v1/importTextContent
List documentsGET/v1/listDocuments
Delete documentPOST/v1/deleteDocument
Check doc statusGET/v1/getDocumentStatus
Search/queryPOST/v1/query

For full request/response schemas, read references/api_reference.md.

Common Workflows

1. Build a Knowledge Base from Files

This is a multi-step process: create KB, upload each file, wait for processing, then search.

Step 1: Create a knowledge base

curl -s -X POST "https://retriever.denser.ai/api/open/v1/createKnowledgeBase" \
  -H "x-api-key: $DENSER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "My KB", "description": "Optional description"}' | python3 -m json.tool

Save the returned id for subsequent operations.

Step 2: For each file, do a 3-step upload

a) Get a presigned upload URL:

curl -s -X POST "https://retriever.denser.ai/api/open/v1/presignUploadUrl" \
  -H "x-api-key: $DENSER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"knowledgeBaseId": "KB_ID", "fileName": "document.pdf", "size": FILE_SIZE_BYTES}' | python3 -m json.tool

b) Upload the file to the presigned URL (raw bytes, PUT request):

curl -s -X PUT "PRESIGNED_UPLOAD_URL" --data-binary @/path/to/document.pdf

c) Trigger import processing:

curl -s -X POST "https://retriever.denser.ai/api/open/v1/importFile" \
  -H "x-api-key: $DENSER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"fileId": "FILE_ID"}' | python3 -m json.tool

Step 3: Poll until processed

curl -s -X GET "https://retriever.denser.ai/api/open/v1/getDocumentStatus?documentId=DOC_ID" \
  -H "x-api-key: $DENSER_API_KEY" | python3 -m json.tool

Repeat every 2-3 seconds until status is "processed". If "failed" or "timeout", report the error.

Step 4: Search

curl -s -X POST "https://retriever.denser.ai/api/open/v1/query" \
  -H "x-api-key: $DENSER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "your search query", "knowledgeBaseIds": ["KB_ID"], "limit": 10}' | python3 -m json.tool
2. Import Text Content Directly

For plain text that doesn't need file upload:

curl -s -X POST "https://retriever.denser.ai/api/open/v1/importTextContent" \
  -H "x-api-key: $DENSER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"knowledgeBaseId": "KB_ID", "title": "My Document", "content": "Full text content here..."}' | python3 -m json.tool
3. Search Across All Knowledge Bases

Omit knowledgeBaseIds to search everything:

curl -s -X POST "https://retriever.denser.ai/api/open/v1/query" \
  -H "x-api-key: $DENSER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "your search query", "limit": 10}' | python3 -m json.tool

Automation Patterns

Batch Upload Multiple Files

When the user provides a directory of files, loop through them:

KB_ID="your-kb-id"
for file in /path/to/files/*; do
  FILE_NAME=$(basename "$file")
  FILE_SIZE=$(stat -f%z "$file" 2>/dev/null || stat -c%s "$file" 2>/dev/null)

  # Get presigned URL
  PRESIGN=$(curl -s -X POST "https://retriever.denser.ai/api/open/v1/presignUploadUrl" \
    -H "x-api-key: $DENSER_API_KEY" \
    -H "Content-Type: application/json" \
    -d "{\"knowledgeBaseId\": \"$KB_ID\", \"fileName\": \"$FILE_NAME\", \"size\": $FILE_SIZE}")

  UPLOAD_URL=$(echo "$PRESIGN" | python3 -c "import sys,json; print(json.load(sys.stdin)['data']['uploadUrl'])")
  FILE_ID=$(echo "$PRESIGN" | python3 -c "import sys,json; print(json.load(sys.stdin)['data']['fileId'])")

  # Upload file
  curl -s -X PUT "$UPLOAD_URL" --data-binary @"$file"

  # Trigger import
  curl -s -X POST "https://retriever.denser.ai/api/open/v1/importFile" \
    -H "x-api-key: $DENSER_API_KEY" \
    -H "Content-Type: application/json" \
    -d "{\"fileId\": \"$FILE_ID\"}"

  echo "Uploaded: $FILE_NAME (fileId: $FILE_ID)"
done
Poll Document Status Until Ready
DOC_ID="your-document-id"
while true; do
  STATUS=$(curl -s -X GET "https://retriever.denser.ai/api/open/v1/getDocumentStatus?documentId=$DOC_ID" \
    -H "x-api-key: $DENSER_API_KEY" | python3 -c "import sys,json; print(json.load(sys.stdin)['data']['status'])")
  echo "Status: $STATUS"
  if [ "$STATUS" = "processed" ] || [ "$STATUS" = "failed" ] || [ "$STATUS" = "timeout" ]; then
    break
  fi
  sleep 3
done

Response Format

All responses follow this structure:

Success: {"success": true, "data": { ... }}

Error: {"success": false, "message": "Error details", "errorCode": "ERROR_CODE"}

Common error codes: STORAGE_LIMIT_EXCEEDED, KNOWLEDGE_BASE_LIMIT_EXCEEDED, INSUFFICIENT_CREDITS, INPUT_VALIDATION_FAILED

Supported File Types

PDF, DOCX, PPTX, XLS, XLSX, HTML, TXT, CSV, XML, Markdown. Max file size: 512MB.

Important Notes

  • Each search query costs 1 credit. Check balance with getBalance before bulk searches.
  • Document processing is async — always poll getDocumentStatus before searching.
  • The presignUploadUrl -> PUT upload -> importFile flow is required for file uploads.
  • Search results include score, content, title, document_id, and metadata.

Comments

Markdown supported