@gitpagedocs/mcp 0.0.8 → 0.0.10

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.
Files changed (2) hide show
  1. package/README.md +116 -15
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,27 +1,128 @@
1
1
  # @gitpagedocs/mcp
2
2
 
3
- The **Model Context Protocol server** for [Git Page Docs](../README.md). It exposes repository-analysis and AI documentation capabilities to MCP clients (editors, agents), delegating all logic to [`@gitpagedocs/tools`](../tools/README.md). Built on `@modelcontextprotocol/sdk` + `zod`. Ships TypeScript source; run via `tsx`.
3
+ The Model Context Protocol server exposes 20 tools and 7 resources over **stdio**. It starts as a child process of your MCP client. It does not open an HTTP port or run a background daemon.
4
4
 
5
- ## Start
5
+ ## Install and connect
6
6
 
7
- ```bash
8
- gitpagedocs mcp start # via the published CLI (stdio transport)
9
- # or directly:
10
- node --import tsx mcp/src/index.ts
7
+ Use Node.js 20+. Install the CLI in the project with `npm install --save-dev @gitpagedocs/cli`; this includes the server and its TypeScript runtime. A global installation also supports `gitpagedocs mcp start`. For a one-off run, use `npx --yes @gitpagedocs/cli mcp start`.
8
+
9
+ In VS Code, create `.vscode/mcp.json` with the following configuration. The process working directory is the project root; the MCP command has no `--root` or `--cwd` flag.
10
+
11
+ ```json
12
+ {
13
+ "servers": {
14
+ "gitpagedocs": {
15
+ "type": "stdio",
16
+ "command": "node",
17
+ "args": [
18
+ "${workspaceFolder}/node_modules/@gitpagedocs/cli/index.mjs",
19
+ "mcp",
20
+ "start"
21
+ ],
22
+ "cwd": "${workspaceFolder}"
23
+ }
24
+ }
25
+ }
11
26
  ```
12
27
 
13
- Provider API keys are read from environment variables (per-provider) plus an optional `.gitpagedocs-mcp.json` selection file.
28
+ Open the client's MCP server controls, start GitPageDocs and list its tools/resources. Test `list_files` with `{"path":".","recursive":false}` and read `project://readme`. These operations need no provider key. A terminal launched with `mcp start` waits for JSON-RPC; ordinary text typed into stdin is not a chat command. On a source checkout, the direct entry is `node --import tsx mcp/src/bin.ts`, not `index.ts`.
29
+
30
+ ## Configure a provider
31
+
32
+ Provider calls read credentials from the server process environment. MCP does not automatically load `.env` or the CLI's encrypted vault. Use the client's protected input/secret facility to inject environment values; never place real keys in a committed configuration. Restart the MCP process after changing its environment.
33
+
34
+ Select a provider using `configure_ai_provider` or `.gitpagedocs-mcp.json` at the project root:
35
+
36
+ ```json
37
+ {
38
+ "provider": "ollama",
39
+ "model": "llama3"
40
+ }
41
+ ```
42
+
43
+ | Provider | Environment |
44
+ | --- | --- |
45
+ | `openai` | `OPENAI_API_KEY` |
46
+ | `anthropic` | `ANTHROPIC_API_KEY / CLAUDE_API_KEY` |
47
+ | `gemini` | `GEMINI_API_KEY / GOOGLE_API_KEY` |
48
+ | `openrouter` | `OPENROUTER_API_KEY` |
49
+ | `ollama` | `OLLAMA_BASE_URL` |
50
+ | `azure-openai` | `AZURE_OPENAI_API_KEY + AZURE_OPENAI_BASE_URL` |
51
+ | `mistral` | `MISTRAL_API_KEY` |
52
+ | `deepseek` | `DEEPSEEK_API_KEY` |
53
+ | `cohere` | `COHERE_API_KEY` |
54
+ | `groq` | `GROQ_API_KEY` |
55
+ | `xai` | `XAI_API_KEY` |
56
+ | `together` | `TOGETHER_API_KEY` |
57
+ | `fireworks` | `FIREWORKS_API_KEY` |
58
+ | `perplexity` | `PERPLEXITY_API_KEY` |
59
+
60
+ With no valid selection, the default provider is OpenAI. Ollama does not require an API key; its local service and chosen model must be available. `OLLAMA_BASE_URL` is optional. Azure's base URL is the complete chat-operation URL, including deployment and API-version query when required. Model listings are the bundled catalog, not a live availability check.
61
+
62
+ ## Tool reference
63
+
64
+ `?` marks an optional argument. Paths and content are strings; `recursive` is boolean. Provider identifiers come from the provider catalog. Call tools through the MCP client's tool interface.
65
+
66
+ | Tool | Arguments | Behavior |
67
+ | --- | --- | --- |
68
+ | `list_files` | `path?, recursive?` | List files (defaults: current directory, non-recursive) |
69
+ | `read_file` | `path` | Read UTF-8 text |
70
+ | `write_file` | `path, content` | Write the entire file; create parent directories |
71
+ | `search_project` | `query, extension?` | Case-insensitive substring search |
72
+ | `list_ai_providers` | `—` | Read the provider catalog |
73
+ | `list_ai_models` | `provider?` | Read the local model catalog |
74
+ | `configure_ai_provider` | `provider, model?` | Save .gitpagedocs-mcp.json |
75
+ | `ask_ai` | `prompt, provider?, model?, system?` | Return one response, without conversation history |
76
+ | `generate_documentation` | `path, provider?` | Document one source file |
77
+ | `generate_api_docs` | `path, provider?` | Describe the API in one file |
78
+ | `generate_database_docs` | `path, provider?` | Describe data models in one file |
79
+ | `analyze_source_code` | `path, provider?` | Analyze one source file |
80
+ | `generate_readme` | `provider?` | Use the tree and package.json |
81
+ | `generate_architecture_docs` | `provider?` | Use the repository tree |
82
+ | `analyze_repository` | `provider?` | Analyze the repository tree |
83
+ | `analyze_project` | `provider?` | Analyze the tree and package.json |
84
+ | `generate_changelog` | `provider?` | Use up to 80 commits, falling back to the tree |
85
+ | `generate_release_notes` | `provider?` | Use the same context as the changelog |
86
+ | `validate_docs` | `provider?` | Ask the provider to review gathered Markdown |
87
+ | `update_documentation` | `path, instructions?, provider?` | Generate and write a managed region |
88
+
89
+ `generate_*`, `analyze_*`, `ask_ai` and `validate_docs` return text; they do not save it automatically. `validate_docs` is a provider review, not a deterministic link checker. Only `write_file`, `configure_ai_provider` and `update_documentation` write files. `update_documentation` preserves text outside `<!-- gitpagedocs:start -->` / `<!-- gitpagedocs:end -->`; it appends a region when a valid pair is absent. The server does not show its own confirmation prompt; configure permissions in the MCP client.
90
+
91
+ ## Resource reference
92
+
93
+ | URI | Content |
94
+ | --- | --- |
95
+ | `project://structure` | Repository tree |
96
+ | `project://docs` | Collected Markdown documents |
97
+ | `project://config` | Resolved configuration and sourcePath |
98
+ | `project://repository` | package.json content |
99
+ | `project://readme` | README.md |
100
+ | `project://ai/providers` | Provider catalog |
101
+ | `project://ai/models` | Model catalog by provider |
102
+
103
+ ## Example workflow
104
+
105
+ 1. Read `project://structure` and `project://readme`.
106
+ 2. Call `list_ai_providers` and `list_ai_models` to select a provider/model.
107
+ 3. Call `generate_api_docs` with `{"path":"src/index.ts"}` to review the returned draft.
108
+ 4. Save approved text with `write_file`, or use `update_documentation` with `{"path":"docs/api.md","instructions":"Document the public API in English."}` for a managed region.
109
+
110
+ The generation step sends selected project content to the configured provider.
14
111
 
15
- ## Tools (20)
112
+ ## Limits and troubleshooting
16
113
 
17
- - **Filesystem:** `list_files`, `read_file`, `write_file`, `search_project`
18
- - **AI:** `list_ai_providers`, `list_ai_models`, `configure_ai_provider`, `ask_ai`
19
- - **Docs + analysis:** `generate_documentation`, `generate_api_docs`, `generate_architecture_docs`, `generate_database_docs`, `generate_readme`, `generate_changelog`, `generate_release_notes`, `update_documentation` (marker-patch), `validate_docs`, `analyze_repository`, `analyze_project`, `analyze_source_code`
114
+ - File reads: up to 512,000 bytes. Listing: up to 2,000 entries; gathered project trees: 400 entries.
115
+ - Search: up to 5,000 entries, 200 matches, 240 characters per matching line.
116
+ - Documentation gathering: first 40 Markdown files among up to 2,000 entries; files over 40,000 bytes are skipped. Provider context is capped at 24,000 characters.
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.
119
+ - 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
+ - If tools work but generation fails, verify provider selection, environment credentials, model availability and service connectivity.
20
121
 
21
- ## Resources (7)
122
+ ## Package and validation
22
123
 
23
- `project://structure` · `project://docs` · `project://config` · `project://repository` · `project://readme` · `project://ai/providers` · `project://ai/models`
124
+ The package ships TypeScript source and delegates filesystem, configuration and provider work to `@gitpagedocs/tools`. The published CLI is the supported executable entry point. `@gitpagedocs/mcp` alone has no npm `bin` command.
24
125
 
25
- ## Tests
126
+ From a repository checkout, run `pnpm run smoke:mcp` and `pnpm exec vitest run mcp/tests`. The tests exercise client/server requests over the MCP interfaces.
26
127
 
27
- In-process Client↔Server integration + E2E in `mcp/tests/**` and `mcp/smoke/mcp-selftest.ts`. Run from the repo root: `npm run smoke:mcp` and `npx vitest run`.
128
+ See [the main project](../README.md), [CLI package](../cli/README.md) and the [official MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk) for the surrounding packages and protocol implementation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitpagedocs/mcp",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
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.8",
16
+ "@gitpagedocs/tools": "^0.0.10",
17
17
  "@modelcontextprotocol/sdk": "^1.12.0",
18
18
  "zod": "^3.23.8"
19
19
  },