Back to GigaRAG

Connect an agent

Give an AI tool access to your GigaRAG Workspace, so it can search, read and write your memos while it works.

Vercel AI SDK

Use GigaRAG tools with generateText and streamText.

Use it in code

The snippet has your key in it so it runs as pasted. Move it to an environment variable before the code is committed or shared.

  1. 1.

    Install the SDK

    npm install ai @ai-sdk/mcp
  2. 2.

    Create a client and pass its tools to the model

    import { createMCPClient } from '@ai-sdk/mcp';
    
    const gigarag = await createMCPClient({
      transport: {
        type: 'http',
        url: 'https://mcp.gigarag.com/mcp',
        headers: { Authorization: 'Bearer <api-key>' },
      },
    });
    
    const tools = await gigarag.tools();
    // Pass tools to generateText or streamText, then call gigarag.close().

Check it worked

Send this once it is connected. An answer drawn from your workspace means the connection is live.

Ask the model to list your GigaRAG buckets.

Written from the official docs: MCP tools