aboutsummaryrefslogtreecommitdiffstats
path: root/apps/mcp/src/shared.ts
diff options
context:
space:
mode:
Diffstat (limited to 'apps/mcp/src/shared.ts')
-rw-r--r--apps/mcp/src/shared.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/apps/mcp/src/shared.ts b/apps/mcp/src/shared.ts
index a80c3620..b2ffff05 100644
--- a/apps/mcp/src/shared.ts
+++ b/apps/mcp/src/shared.ts
@@ -6,9 +6,21 @@ import { createKarakeepClient } from "@karakeep/sdk";
const addr = process.env.KARAKEEP_API_ADDR;
const apiKey = process.env.KARAKEEP_API_KEY;
+const getCustomHeaders = () => {
+ try {
+ return process.env.KARAKEEP_CUSTOM_HEADERS
+ ? JSON.parse(process.env.KARAKEEP_CUSTOM_HEADERS)
+ : {};
+ } catch (e) {
+ console.error("Failed to parse KARAKEEP_CUSTOM_HEADERS", e);
+ return {};
+ }
+};
+
export const karakeepClient = createKarakeepClient({
baseUrl: `${addr}/api/v1`,
headers: {
+ ...getCustomHeaders(),
"Content-Type": "application/json",
authorization: `Bearer ${apiKey}`,
},