Get Started in 5 Minutes
Follow this guide to create your first workspace, store a memory, and search semantically.
Prerequisites
- A ContextStream account (sign up at contextstream.io)
- An API key from your dashboard
- curl or any HTTP client
Get Your API Key
Create a Workspace
Workspaces are containers for your projects, memories, and knowledge graphs. Create one to get started:
curl -X POST https://api.contextstream.io/api/v1/workspaces \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "my-project",
"description": "My first ContextStream workspace"
}'Response:
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "my-project",
"slug": "my-project",
"visibility": "private",
"created_at": "2024-01-15T10:30:00Z"
}Store Your First Memory
Memories are pieces of context that your AI tools can retrieve later. Store a decision, conversation, or any important information:
curl -X POST https://api.contextstream.io/api/v1/memory/events \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"workspace_id": "550e8400-e29b-41d4-a716-446655440000",
"event_type": "decision",
"title": "Chose PostgreSQL for the database",
"content": "After evaluating PostgreSQL, MySQL, and MongoDB, we decided to use PostgreSQL because of its strong JSON support, excellent performance, and mature ecosystem."
}'Search Semantically
Now search your memories using natural language. ContextStream understands meaning, not just keywords:
curl -X POST https://api.contextstream.io/api/v1/search/semantic \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "why did we pick that database?",
"search_type": "semantic",
"workspace_id": "550e8400-e29b-41d4-a716-446655440000"
}'Even though you searched for "database" and the memory mentions "PostgreSQL", semantic search understands they're related and returns the relevant result.
Connect Your AI Tools
ContextStream integrates with AI tools via the Model Context Protocol (MCP). Connect Claude Desktop, Cursor, or Windsurf:
# Add to your MCP configuration (claude_desktop_config.json)
{
"mcpServers": {
"contextstream": {
"command": "npx",
"args": ["-y", "@contextstream/mcp"],
"env": {
"CONTEXTSTREAM_API_KEY": "YOUR_API_KEY",
"CONTEXTSTREAM_WORKSPACE_ID": "550e8400-e29b-41d4-a716-446655440000"
}
}
}
}See the MCP Integration Guide for detailed setup instructions.
Enable Token-Saving (Optional)
Save up to 80% on AI tokens by using ContextStream for context instead of chat history:
# Add to .windsurfrules, .cursorrules, or CLAUDE.md
## Token-Saving Context
Before responding, call context_smart with the user's message:
- context_smart(user_message="...") # Returns ~200 tokens of relevant context
At conversation end, compress the chat:
- session_compress(chat_history="...") # Stores key info in memoryThis tells your AI to use ContextStream's context_smart tool instead of including full chat history. See the Token-Saving section for more details.