Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hasna/identities",
"version": "0.2.1",
"version": "0.2.2",
"description": "Open identity records for humans and AI agents",
"type": "module",
"main": "dist/src/index.js",
Expand Down
11 changes: 11 additions & 0 deletions src/mcp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,20 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
import { createIdentityStore, type IdentityStore } from "../storage.js";
import { CloudHttpIdentityStore, resolveCloudHttpConfig } from "../http-store.js";
import { getPackageVersion } from "../version.js";

async function resolveStore(): Promise<{ store: IdentityStore; mode: "cloud" | "local"; close: () => Promise<void> }> {
// Locked client architecture: when the self_hosted API env vars
// (HASNA_IDENTITIES_API_URL + HASNA_IDENTITIES_API_KEY) are set, route ALL
// reads/writes to the cloud `/v1` HTTP API with the bearer key. No DSN on the
// client. Unsetting the vars restores the local store.
const cloud = resolveCloudHttpConfig();
if (cloud) {
return { store: new CloudHttpIdentityStore(cloud), mode: "cloud", close: async () => {} };
}
// Legacy in-VPC server path: raw Postgres DSN is only ever used by the serve
// process (in-VPC), never distributed to client machines.
const mode = (process.env["HASNA_IDENTITIES_STORAGE_MODE"] ?? "local").toLowerCase();
if (mode === "cloud") {
// Lazy import so the local path never loads pg.
Expand Down
Loading