@gitpagedocs/mcp 1.1.68 → 1.1.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitpagedocs/mcp",
3
- "version": "1.1.68",
3
+ "version": "1.1.70",
4
4
  "type": "module",
5
5
  "description": "Model Context Protocol server for Git Page Docs (delegates to @gitpagedocs/tools). Ships TypeScript source; run via tsx.",
6
6
  "main": "./src/index.ts",
@@ -13,7 +13,7 @@
13
13
  "node": ">=20"
14
14
  },
15
15
  "dependencies": {
16
- "@gitpagedocs/tools": "^1.1.68",
16
+ "@gitpagedocs/tools": "^1.1.70",
17
17
  "@modelcontextprotocol/sdk": "^1.12.0",
18
18
  "zod": "^3.23.8"
19
19
  },
package/src/bin.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { startMcpServer } from "./start";
3
3
 
4
- startMcpServer(process.cwd()).catch((error) => {
4
+ try {
5
+ await startMcpServer(process.cwd());
6
+ } catch (error) {
5
7
  // stderr only — stdout is the MCP stdio channel.
6
8
  console.error("[gitpagedocs-mcp] failed to start:", error);
7
9
  process.exit(1);
8
- });
10
+ }
package/src/context.ts CHANGED
@@ -34,6 +34,17 @@ export const PROVIDER_ENV_KEYS: Record<AiProviderId, string[]> = {
34
34
 
35
35
  const SELECTION_FILE = ".gitpagedocs-mcp.json";
36
36
 
37
+ /** Providers whose endpoint is user-hosted read their base URL from this variable. */
38
+ const BASE_URL_ENV_KEYS: Partial<Record<AiProviderId, string>> = {
39
+ ollama: "OLLAMA_BASE_URL",
40
+ "azure-openai": "AZURE_OPENAI_BASE_URL",
41
+ };
42
+
43
+ function resolveBaseUrlFromEnv(providerId: AiProviderId): string | undefined {
44
+ const name = BASE_URL_ENV_KEYS[providerId];
45
+ return name ? process.env[name] : undefined;
46
+ }
47
+
37
48
  interface ProviderSelection {
38
49
  provider: AiProviderId;
39
50
  model?: string;
@@ -89,15 +100,14 @@ export class ServerContext {
89
100
  `No API key for ${spec.label}. Set ${PROVIDER_ENV_KEYS[id].join(" or ")} in the environment.`,
90
101
  );
91
102
  }
92
- const baseUrl =
93
- id === "ollama"
94
- ? process.env.OLLAMA_BASE_URL
95
- : id === "azure-openai"
96
- ? process.env.AZURE_OPENAI_BASE_URL
97
- : undefined;
98
103
  return {
99
104
  provider: this.factory.create(id),
100
- config: { providerId: id, model: model ?? selection.model ?? spec.defaultModel, apiKey, baseUrl },
105
+ config: {
106
+ providerId: id,
107
+ model: model ?? selection.model ?? spec.defaultModel,
108
+ apiKey,
109
+ baseUrl: resolveBaseUrlFromEnv(id),
110
+ },
101
111
  };
102
112
  }
103
113
  }
@@ -46,7 +46,8 @@ export function registerAiTools(server: McpServer, ctx: ServerContext): void {
46
46
  },
47
47
  safe(async ({ provider, model }) => {
48
48
  await ctx.saveSelection({ provider, model });
49
- return text(`Default provider set to ${provider}${model ? ` (${model})` : ""}.`);
49
+ const modelSuffix = model ? ` (${model})` : "";
50
+ return text(`Default provider set to ${provider}${modelSuffix}.`);
50
51
  }),
51
52
  );
52
53