Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions mcp/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,38 @@ server.tool(
},
);

server.tool(
"cortex_explain_memory",
{
description:
"Explain a claim: supporting/conflicting evidence, temporal validity, authority, confidence",
inputSchema: {
type: "object",
properties: {
claim_id: { type: "string" },
workspace_id: { type: "string" },
},
required: ["claim_id", "workspace_id"],
},
},
async ({ claim_id, workspace_id }) => {
if (auth.blocked) {
throw new Error(
"Cortex MCP auth error: ENVIRONMENT=production requires CORTEX_API_KEY",
);
}
const url = `${apiBaseUrl}/evidence/explain/${encodeURIComponent(claim_id)}?workspace_id=${encodeURIComponent(workspace_id)}`;
const response = await fetch(url, { headers: apiHeaders() });
if (!response.ok) {
throw new Error(`Cortex API /evidence/explain failed with ${response.status}`);
}
const payload = await response.json();
return {
content: [{ type: "text", text: JSON.stringify(payload, null, 2) }],
};
},
);

async function main() {
const transport = new StdioServerTransport();
await server.connect(transport);
Expand Down
Loading