Integrations
LlamaIndex
Give a LlamaIndex agent persistent, governed memory with MemClaw over MCP.
MemClaw is MCP-native, so a LlamaIndex FunctionAgent
can load the full memclaw_* tool surface through the
llama-index-tools-mcp
package.
pip install llama-index llama-index-tools-mcp llama-index-llms-openaifrom llama_index.tools.mcp import BasicMCPClient, McpToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
# A "/mcp" URL uses the Streamable HTTP transport.
mcp_client = BasicMCPClient(
"https://memclaw.net/mcp",
# Use an agent-scoped key in production (see Per-agent keys below).
headers={"X-API-Key": "mc_xxx"},
)
async def main():
tools = await McpToolSpec(client=mcp_client).to_tool_list_async()
agent = FunctionAgent(
tools=tools,
llm=OpenAI(model="gpt-4o"),
system_prompt="You can persist and recall facts with MemClaw.",
)
print(await agent.run("Remember our Q3 revenue target is $4M, then recall it."))
Always bind a real agent_id to the credential. For anything beyond a
prototype, give each agent its own agent-scoped key — see
Per-agent keys — so trust gating, fleet
membership, and per-agent keystones apply.
Prefer REST?
Without MCP, wrap MemClaw's POST /api/v1/memories
and POST /api/v1/recall as LlamaIndex tools with
FunctionTool.from_defaults (from llama_index.core.tools). See
REST for the request shapes.