Docs/Getting Started

Getting Started

Learn how to integrate PersistQ into your AI application in under 5 minutes.

Choose Your Integration

PersistQ offers two ways to integrate:

TypeScript/JavaScript SDK

For web apps, Node.js backends, and serverless functions

persistq-sdk

MCP Server

For Claude Code, GitHub Copilot CLI, Cursor IDE, OpenCode IDE, and VS Code integration

persistq

Installation

TypeScript/JavaScript SDK

Install via npm:

npm install persistq-sdk

MCP Server (for AI tools)

Use with npx (recommended):

npx -y persistq

Or install globally:

{
  "mcpServers": {
    "persistq": {
      "command": "npx",
      "args": ["-y", "persistq"],
      "env": {
        "PERSISTQ_URL": "https://api.persistq.com",
        "PERSISTQ_API_KEY": process.env.PERSISTQ_API_KEY,
      }
    }
  }
}

Authentication

Get your API key from the dashboard after signing up:

Tip: Your API key starts with pq_

Quick Start: TypeScript SDK

1. Initialize Client

import { createClient } from 'persistq-sdk'

const client = createClient({
  baseUrl: 'https://api.persistq.com',
  apiKey: 'your-api-key-here',
})

2. Store a Memory

const result = await client.createMemory(
  'User prefers dark mode and compact layouts',
  'preferences',
  { tags: ['ui', 'settings'] }
)

if (result.status === 'success') {
  console.log('Memory created:', result.data?.memoryId)
}

3. Search Memories

const results = await client.searchMemories('user interface preferences', {
  limit: 5,
  threshold: 0.7,
})

if (results.status === 'success') {
  results.data?.forEach(memory => {
    console.log(memory.content, 'Similarity:', memory.similarity)
  })
}

4. List Memories

const memories = await client.listMemories({
  project: 'preferences',
  limit: 10,
  offset: 0,
})

if (memories.status === 'success' && memories.data) {
  console.log('Total memories:', memories.data.total)
  console.log('Memories:', memories.data.memories)
}

Quick Start: MCP Server

For Claude Code, GitHub Copilot CLI, Cursor IDE, OpenCode IDE, or VS Code users:

1. Configure Claude Code

Add to your ~/.claude/mcp.json:

{
  "mcpServers": {
    "persistq": {
      "command": "persistq",
      "env": {
        "PERSISTQ_URL": "https://api.persistq.com",
        "PERSISTQ_API_KEY": "your-api-key-here"
      }
    }
  }
}

2. Use in Claude Code

Claude Code will automatically detect the MCP server and you can use it naturally:

"Store this information: The user prefers TypeScript and uses Next.js"

"What do you remember about my tech stack preferences?"

Next Steps

Need Help?

Check out the API reference for detailed endpoint documentation.