Most agents forget everything between sessions. The Vercel AI SDK makes this easy to fix because it speaks MCP natively — and BlueColumn ships an MCP server on npm, so there is nothing to install and no SDK to learn.
1. No package needed
The SDK has first-class MCP client support, and bluecolumn-mcp runs via npx.
2. Connect (app/api/chat/route.ts)
import { streamText, experimental_createMCPClient as createMCPClient } from 'ai';
import { Experimental_StdioMCPTransport as StdioMCPTransport } from 'ai/mcp-stdio';
export async function POST(req: Request) {
const { messages } = await req.json();
const mcpClient = await createMCPClient({
transport: new StdioMCPTransport({
command: 'npx',
args: ['-y', 'bluecolumn-mcp@latest'],
env: { BLUECOLUMN_API_KEY: process.env.BLUECOLUMN_API_KEY! },
}),
});
try {
const tools = await mcpClient.tools(); // remember, recall, note
const result = streamText({
model: yourModel,
system: 'You have persistent memory. Store durable facts with remember; search with recall before answering questions that depend on past context.',
messages,
tools,
});
return result.toDataStreamResponse();
} finally {
await mcpClient.close();
}
}
3. Prompt the agent
Add to your system prompt: "Store durable facts immediately with remember. Search with recall before answering questions that depend on past context."
Why this pattern works
-
recallreturns cited sources — surface them in your UI and every answer is verifiable against the stored memory. - Writes are idempotent — agents retry, and retries do not triple-store the same fact.
- Namespaces isolate per API key, so one key per user or tenant and nothing leaks across.
- Free tier: 100 writes + 100 reads + 30 audio minutes/mo at https://bluecolumn.ai
One deployment note
Stdio MCP clients spawn a local process, which does not fit edge runtimes. For serverless deployments, keep the route on a long-running Node runtime, or call the memory API directly with two fetch calls:
// write
await fetch('https://api.bluecolumn.ai/remember', { method: 'POST', headers: { Authorization: `Bearer ${key}` }, body: JSON.stringify({ text }) });
// recall
const res = await fetch('https://api.bluecolumn.ai/recall', { method: 'POST', headers: { Authorization: `Bearer ${key}` }, body: JSON.stringify({ q }) });
Same memory, two HTTP calls, works anywhere.
Top comments (0)