@gitpagedocs/mcp 0.0.14 → 0.0.16

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/README.md CHANGED
@@ -115,7 +115,8 @@ The generation step sends selected project content to the configured provider.
115
115
  - Search: up to 5,000 entries, 200 matches, 240 characters per matching line.
116
116
  - Documentation gathering: first 40 Markdown files among up to 2,000 entries; files over 40,000 bytes are skipped. Gathered file and Markdown context is limited to 24,000 characters. This is not a global prompt limit: tree/package context, an existing document and a caller-supplied question can add content according to the selected tool.
117
117
  - Listing skips build/dependency directories such as `node_modules`, `.git`, `.next`, `out`, `dist`, `prebuilt`, `.turbo` and `coverage`. It does not interpret `.gitignore`; files such as `.env` are not automatically excluded. Run only in a trusted project and select the content to expose.
118
- - Path checks use lexical containment; do not treat the process as an operating-system sandbox or assume symlink/junction isolation. Loading `project://config` can import JavaScript/TypeScript configuration.
118
+ - Filesystem tools check both lexical paths and canonical filesystem paths. Reads and directory listings reject symlinks/junctions that resolve outside the project root. Writes also validate the nearest existing parent before creating directories and reject symbolic links at the destination, including links to internal files. Search skips linked files whose contents cannot be read safely.
119
+ - These checks protect against links already present when a request is handled; they are not an operating-system sandbox against concurrent path replacement by another process. Run the server in a trusted project with appropriate filesystem permissions. Configuration loading and provider-selection persistence use separate filesystem paths; loading `project://config` can import JavaScript/TypeScript configuration.
119
120
  - Tool failures include `isError: true`. Missing resources return `Unavailable: ...`. Check the client's stderr log for startup errors; stdout is reserved for JSON-RPC.
120
121
  - If tools work but generation fails, verify provider selection, environment credentials, model availability and service connectivity.
121
122
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitpagedocs/mcp",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
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": "^0.0.14",
16
+ "@gitpagedocs/tools": "^0.0.16",
17
17
  "@modelcontextprotocol/sdk": "^1.12.0",
18
18
  "zod": "^3.23.8"
19
19
  },
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
- import { DocumentationService, patchManagedRegion, type DocKind, type AiProviderId } from "@gitpagedocs/tools";
3
+ import { DocumentationService, RepositoryError, patchManagedRegion, type DocKind, type AiProviderId } from "@gitpagedocs/tools";
4
4
  import type { ServerContext } from "../context";
5
5
  import { text, safe } from "../result";
6
6
  import { repoListing, fileContext, packageContext, gitLog, docsContext } from "../gather";
@@ -19,6 +19,11 @@ async function generate(
19
19
 
20
20
  const providerOpt = z.string().optional().describe("Override the configured AI provider id.");
21
21
 
22
+ function isMissingFile(error: unknown): boolean {
23
+ const cause = error instanceof RepositoryError ? error.cause : undefined;
24
+ return typeof cause === "object" && cause !== null && "code" in cause && cause.code === "ENOENT";
25
+ }
26
+
22
27
  /** Documentation generators and analyzers (AI-backed, delegating to tools). */
23
28
  export function registerDocsTools(server: McpServer, ctx: ServerContext): void {
24
29
  const def = (
@@ -81,8 +86,8 @@ export function registerDocsTools(server: McpServer, ctx: ServerContext): void {
81
86
  let existing = "";
82
87
  try {
83
88
  existing = await ctx.files.read(path);
84
- } catch {
85
- existing = "";
89
+ } catch (error) {
90
+ if (!isMissingFile(error)) throw error;
86
91
  }
87
92
  const generated = await generate(
88
93
  ctx,