Skip to content

Commit f54b618

Browse files
authored
Merge pull request #24 from ElanHasson/add_OBSIDIAN_HOST
feat: update BASE_URL to use OBSIDIAN_HOST environment variable to enable obsidian running on windows and the mcp server running on WSL and other advanced configurations.
2 parents 63a3003 + b26fe4f commit f54b618

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

packages/mcp-server/src/shared/makeRequest.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { logger } from "./logger";
66
const USE_HTTP = process.env.OBSIDIAN_USE_HTTP === "true";
77
const PORT = USE_HTTP ? 27123 : 27124;
88
const PROTOCOL = USE_HTTP ? "http" : "https";
9-
export const BASE_URL = `${PROTOCOL}://127.0.0.1:${PORT}`;
9+
const HOST = process.env.OBSIDIAN_HOST || "127.0.0.1";
10+
export const BASE_URL = `${PROTOCOL}://${HOST}:${PORT}`;
1011

1112
// Disable TLS certificate validation for local self-signed certificates
1213
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
@@ -23,9 +24,9 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
2324

2425
export async function makeRequest<
2526
T extends
26-
| Type<{}, {}>
27-
| Type<null | undefined, {}>
28-
| Type<{} | null | undefined, {}>,
27+
| Type<{}, {}>
28+
| Type<null | undefined, {}>
29+
| Type<{} | null | undefined, {}>,
2930
>(schema: T, path: string, init?: RequestInit): Promise<T["infer"]> {
3031
const API_KEY = process.env.OBSIDIAN_API_KEY;
3132
if (!API_KEY) {

0 commit comments

Comments
 (0)