mcpField
B
blink-rag

blink-rag

github.com/blink-newData & databases437 installsUpdated 2w ago
Repository

About blink-rag

blink-rag is a skill for managing Blink document collections and searching their contents. It is intended for developers building retrieval-based features, and covers uploads from text, URLs, and files as well as semantic and AI search.

Key features

  1. 01Search collections semantically
  2. 02Run AI Q&A over documents
  3. 03Create and list collections
  4. 04Upload text, URLs, and files
  5. 05Stream AI search results

Use cases

  1. 01Find answers in a documentation collection
  2. 02Upload web articles or text for retrieval
  3. 03Stream answers about a document collection

MCP support

It exposes `blink_rag_search` for semantic search or AI Q&A and `blink_rag_collections` for listing collections to MCP clients.

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/blink-new/blink-plugin --skill blink-rag

After installing, type/blink-ragin Claude Code to confirm it loaded.

Details

From the project README

Getting Started

# Search a collection
blink rag search docs "How do I configure auth?"

# Upload a document
blink rag upload docs ./guide.txt

# List collections
blink rag collections

MCP Tools

ToolDescription
blink_rag_searchSemantic search or AI Q&A over a collection
blink_rag_collectionsList available collections

SDK Methods

// Create collection
const col = await blink.rag.createCollection({ name: 'docs', description: 'Product docs' })

// Upload document
const doc = await blink.rag.upload({
  collectionName: 'docs',
  filename: 'guide.txt',
  content: 'Your content...',
})
await blink.rag.waitForReady(doc.id)

// Vector search
const results = await blink.rag.search({
  collectionName: 'docs',
  query: 'How do I configure auth?',
  maxResults: 5,
})

// AI search (RAG) — returns answer + sources
const result = await blink.rag.aiSearch({
  collectionName: 'docs',
  query: 'What are the main features?',
  model: 'google/gemini-3-flash',
})
console.log(result.answer, result.sources)

Upload Methods

// Text content
await blink.rag.upload({ collectionName: 'docs', filename: 'notes.txt', content: 'Text...' })

// From URL
await blink.rag.upload({ collectionName: 'docs', filename: 'article.html', url: 'https://example.com/article' })

// File (base64)
await blink.rag.upload({ collectionName: 'docs', filename: 'report.pdf', file: { data: base64, contentType: 'application/pdf' } })

Critical: PDF Upload Pattern

Do NOT upload PDFs directly as base64 — embeddings may store incorrectly. Extract text first:

// 1. Upload PDF to storage
const { publicUrl } = await blink.storage.upload(pdfFile, `docs/${Date.now()}_${pdfFile.name}`)

// 2. Extract text
const text = await blink.data.extractFromUrl(publicUrl)

// 3. Upload extracted text as content
await blink.rag.upload({ collectionName: 'docs', filename: pdfFile.name, content: text })

Document Lifecycle

Documents go through: pending → processing → ready (or error). Processing takes 30-40 seconds. Always wait before searching:

const doc = await blink.rag.upload({ ... })
await blink.rag.waitForReady(doc.id, { timeoutMs: 120000 })

Streaming AI Search

const stream = await blink.rag.aiSearch({
  collectionName: 'docs',
  query: 'Explain the architecture',
  stream: true,
})

Model Selection

Always use google/gemini-3-flash for RAG AI search. Deprecated models will fail.

Common Errors

ErrorFix
409 "Collection exists"Catch and reuse existing collection
Zero tokens in searchDocument still processing — wait for ready status
"Identical content" on uploadDuplicate doc — catch error, use existing doc ID

Comments

Markdown supported