Claude Memory Tool
Use Trayn memory as a Claude tool or MCP server for persistent agent learning.
Installation
npm install @trayn/memorybun add @trayn/memorypnpm add @trayn/memoryyarn add @trayn/memoryClaude Tool Use
Use @trayn/memory as a native Claude memory tool with the Anthropic SDK:
import Anthropic from "@anthropic-ai/sdk";
import { TraynMemoryTool } from "@trayn/memory/claude";
const client = new Anthropic();
const memory = new TraynMemoryTool({
sessionId: "my-agent-session",
});
const response = await client.beta.messages.create({
model: "claude-opus-4-6",
max_tokens: 4096,
tools: [memory.tool()],
betas: ["context-management-2025-06-27"],
messages: [{ role: "user", content: "Help me book a flight" }],
});MCP Server
Expose Trayn memory as an MCP tool for any MCP-compatible client:
import { TraynMemoryServer } from "@trayn/memory/mcp";
const server = new TraynMemoryServer({
sessionId: process.env.SESSION_ID!,
});
server.listen(); // stdio transport