5.4 TypeScript: MCP Client Integration
TypeScript agents can call MentisDB through MCP tools or REST. MCP is best when your agent runtime already has a tool loop; REST is best for service code.
const result = await mcp.callTool("mentisdb_ranked_search", {
chain_key: "typescript-agent",
text: "what did we decide about auth tokens?",
limit: 5,
});
await mcp.callTool("mentisdb_append", {
chain_key: "typescript-agent",
agent_id: "ts-agent",
thought_type: "Decision",
content: "Use short-lived bearer tokens for remote tool access.",
concepts: ["auth", "mcp"],
tags: ["typescript", "security"],
});Keep the MCP request objects explicit. Hidden wrappers often erase useful metadata like concepts, tags, roles, and importance.