Quickstart
Get your AI agent remembering in 5 minutes or less. Choose your integration method.
Choose Your Path
Production-ready integration with wallet-based auth.
⏱️ 5 minutes
🔌 MCP (Model Context Protocol)Zero-boilerplate memory for any MCP-compatible platform.
⏱️ 3 minutes
Path 1: TypeScript SDK
Step 1: Install the SDK
pnpm
pnpm add @zkstash/sdkStep 2: Initialize the Client
zkstash uses wallet-based authentication. The SDK handles this automatically:
import { fromPrivateKey } from "@zkstash/sdk/rest";
// Initialize client with your wallet
const client = await fromPrivateKey(
process.env.PRIVATE_KEY, // Your wallet private key
{
// Optional configuration
payment: {
maxValue: 5000n // Max payment per request
}
}
);The SDK automatically handles signature generation and x402 payments. No manual auth needed!
Step 3: Define Your Schema with Zod
import { z } from "zod";
// Define schema using Zod
const UserProfileSchema = z.object({
name: z.string(),
theme: z.enum(["light", "dark"]),
language: z.string()
});
// Register the schema
await client.registerSchema(
"UserProfile",
UserProfileSchema,
{
description: "User preferences and settings",
cardinality: "single" // Only one profile per user
}
);Step 4: Store and Retrieve Memories
// Store a memory (auto-extracts based on your schemas)
await client.createMemory({
agentId: "my-agent",
conversation: [
{ role: "user", content: "My name is Alex and I prefer dark mode." },
{ role: "assistant", content: "Got it! I'll remember that." }
]
});
// Search memories semantically
const results = await client.searchMemories({
query: "What is the user's preferred theme?",
filters: {
agentId: "my-agent"
}
});
console.log(results.memories[0]); // Returns matching memoryPath 2: MCP (Model Context Protocol)
MCP allows any compatible platform to use zkstash as a tool—no code required in your prompts.
What is MCP?
The Model Context Protocol is an open standard that enables AI systems to access external tools and data sources. zkstash provides an MCP server at zkstash.ai/mcp that exposes memory operations as callable tools.
Using the TypeScript SDK MCP Client
The easiest way to use zkstash with MCP-compatible frameworks is through the SDK:
import * as MCP from "@zkstash/sdk/mcp";
const mcpClient = await MCP.fromPrivateKey(
process.env.PRIVATE_KEY,
{
agentId: "my-agent",
mcpUrl: "https://zkstash.ai/mcp"
}
);
// Get tools for LangChain or other frameworks
const tools = await mcpClient.getTools();The MCP endpoint is at
https://zkstash.ai/mcp.
What Tools Are Available?
The MCP server automatically generates tools based on your schemas:
- Schema Tools: Each schema you create becomes a tool (e.g.,
create_user_profile) - Search Tool: Built-in
search_memoriestool for retrieving context
Example: Using with LangChain
import { ChatAnthropic } from "@langchain/anthropic";
import { createReactAgent } from "@langchain/langgraph/prebuilt";
const agent = createReactAgent({
llm: new ChatAnthropic({ model: "claude-3-5-sonnet-20241022" }),
tools: await mcpClient.getTools()
});
const result = await agent.invoke({
messages: [{ role: "user", content: "My name is Alex and I prefer dark mode." }]
});The LLM will determine when to call memory tools based on conversation context. You prompt it to actively check memories or save important details as per your use case.
What You Built
Regardless of the path you chose, you now have:
✅ Persistent memory across sessions
✅ Wallet authentication (permissionless, no API keys)
✅ Schema-enforced data for consistency
✅ Semantic search for intelligent retrieval