@arabold/docs-mcp-server 1.11.0 → 1.12.1

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
@@ -29,6 +29,7 @@ LLM-assisted coding promises speed and efficiency, but often falls short due to:
29
29
  - **Up-to-Date Knowledge:** Fetches the latest documentation directly from the source.
30
30
  - **Version-Aware Search:** Get answers relevant to specific library versions (e.g., `react@18.2.0` vs `react@17.0.0`).
31
31
  - **Accurate Snippets:** Reduces AI hallucinations by using context from official docs.
32
+ - **Web Interface:** Provides a easy-to-use web interface for searching and managing documentation.
32
33
  - **Broad Source Compatibility:** Scrapes websites, GitHub repos, package manager sites (npm, PyPI), and even local file directories.
33
34
  - **Intelligent Processing:** Automatically chunks documentation semantically and generates embeddings.
34
35
  - **Flexible Embedding Models:** Supports OpenAI (incl. compatible APIs like Ollama), Google Gemini/Vertex AI, Azure OpenAI, AWS Bedrock, and more.
@@ -42,6 +43,10 @@ LLM-assisted coding promises speed and efficiency, but often falls short due to:
42
43
 
43
44
  Get up and running quickly!
44
45
 
46
+ - [Option 1: Using Docker](#option-1-using-docker)
47
+ - [Option 2: Using npx](#option-2-using-npx)
48
+ - [Option 3: Using Docker Compose](#option-3-using-docker-compose)
49
+
45
50
  ### Option 1: Using Docker
46
51
 
47
52
  This approach is easy, straightforward, and doesn't require Node.js to be installed.
@@ -145,7 +150,7 @@ docker run -i --rm \
145
150
 
146
151
  ### Option 2: Using npx
147
152
 
148
- This approach is useful when you need local file access (e.g., indexing documentation from your local file system). While this can also be achieved by mounting paths into a Docker container, using npx is simpler but requires a Node.js installation.
153
+ This approach is useful when you need local file access (e.g., indexing documentation from your local file system). While this can also be achieved by mounting paths into a Docker container, using `npx` is simpler but requires a Node.js installation.
149
154
 
150
155
  1. **Ensure Node.js is installed.**
151
156
  2. **Configure your MCP settings:**
@@ -173,22 +178,97 @@ This approach is useful when you need local file access (e.g., indexing document
173
178
 
174
179
  3. **That's it!** The server will now be available to your AI assistant.
175
180
 
176
- ### Option 3: Using npx with HTTP Protocol
181
+ ### Option 3: Using Docker Compose
177
182
 
178
- Similar to Option 2, this uses `npx` to run the latest published package without needing Docker or a local clone. However, this option starts the server using the Streamable HTTP protocol instead of the default stdio, making it accessible via HTTP endpoints. This is useful if you have multiple clients, you work with multiple code assistants in parallel, or want to expose the server to other applications.
183
+ This method provides a persistent local setup by running the server and web interface using Docker Compose. It requires cloning the repository but simplifies managing both services together.
179
184
 
180
- 1. **Ensure Node.js is installed.**
181
- 2. **Run the command:**
185
+ 1. **Ensure Docker and Docker Compose are installed and running.**
186
+ 2. **Clone the repository:**
187
+ ```bash
188
+ git clone https://github.com/arabold/docs-mcp-server.git
189
+ cd docs-mcp-server
190
+ ```
191
+ 3. **Set up your environment:**
192
+ Copy the example environment file and **edit it** to add your necessary API keys (e.g., `OPENAI_API_KEY`).
193
+ ```bash
194
+ cp .env.example .env
195
+ # Now, edit the .env file with your editor
196
+ ```
197
+ Refer to the [Configuration](#configuration) section for details on available environment variables.
198
+ 4. **Launch the services:**
199
+ Run this command from the repository's root directory. It will build the images (if necessary) and start the server and web interface in the background.
182
200
 
183
201
  ```bash
184
- # Ensure required environment variables like OPENAI_API_KEY are set
185
- npx --package=@arabold/docs-mcp-server docs-server --protocol http --port 8000
202
+ docker compose up -d
186
203
  ```
187
204
 
188
- - `--protocol http`: Instructs the server to use the HTTP protocol.
189
- - `--port <number>`: Specifies the listening port (default: 8000).
205
+ - `-d`: Runs the containers in detached mode (in the background). Omit this to see logs directly in your terminal.
206
+
207
+ **Note:** If you pull updates for the repository (e.g., using `git pull`), you'll need to rebuild the Docker images to include the changes by running `docker compose up -d --build`.
208
+
209
+ 5. **Configure your MCP client:**
210
+ Add the following configuration block to your MCP settings file (e.g., for Claude, Cline, Roo):
211
+
212
+ ```json
213
+ {
214
+ "mcpServers": {
215
+ "docs-mcp-server": {
216
+ "url": "http://localhost:6280/sse", // Connects via HTTP to the Docker Compose service
217
+ "disabled": false,
218
+ "autoApprove": []
219
+ }
220
+ }
221
+ }
222
+ ```
223
+
224
+ Restart your AI assistant application after updating the configuration.
225
+
226
+ 6. **Access the Web Interface:**
227
+ The web interface will be available at `http://localhost:6281`.
228
+
229
+ **Benefits of this method:**
230
+
231
+ - Runs both the server and web UI with a single command.
232
+ - Uses the local source code (rebuilds automatically if code changes and you run `docker compose up --build`).
233
+ - Persistent data storage via the `docs-mcp-data` Docker volume.
234
+ - Easy configuration management via the `.env` file.
235
+
236
+ To stop the services, run `docker compose down` from the repository directory.
237
+
238
+ ## Using the Web Interface
239
+
240
+ You can access a web-based GUI at `http://localhost:6281` to manage and search library documentation through your browser. **Important: Use the same method (Docker or npx) for both the server and web interface to ensure access to the same indexed documentation.**
241
+
242
+ ### Using Docker Web Interface
243
+
244
+ If you're running the server with Docker, use Docker for the web interface as well:
245
+
246
+ ```bash
247
+ docker run --rm \
248
+ -e OPENAI_API_KEY="your-openai-api-key-here" \
249
+ -v docs-mcp-data:/data \
250
+ -p 3000:3000 \
251
+ ghcr.io/arabold/docs-mcp-server:latest \
252
+ docs-web
253
+ ```
254
+
255
+ Make sure to:
256
+
257
+ - Use the same volume name (`docs-mcp-data` in this example) as your server
258
+ - Map port 6281 with `-p 6281:3000`
259
+ - Pass any configuration environment variables with `-e` flags
260
+
261
+ ### Using `npx Web Interface
262
+
263
+ If you're running the server with `npx`, use `npx` for the web interface as well:
264
+
265
+ ```bash
266
+ npx -y --package=@arabold/docs-mcp-server docs-web --port 6281
267
+ ```
268
+
269
+ You can specify a different port using the `--port` flag.
190
270
 
191
- The server will expose endpoints like `/mcp` and `/sse` on the specified port.
271
+ The `npx` approach will use the default data directory on your system (typically in your home directory), ensuring consistency between server and web interface.
192
272
 
193
273
  ## Using the CLI
194
274
 
@@ -210,15 +290,15 @@ docker run --rm \
210
290
 
211
291
  Make sure to use the same volume name (`docs-mcp-data` in this example) as you did for the server. Any of the configuration environment variables (see [Configuration](#configuration) above) can be passed using `-e` flags, just like with the server.
212
292
 
213
- ### Using npx CLI
293
+ ### Using `npx CLI
214
294
 
215
- If you're running the server with npx, use npx for the CLI as well:
295
+ If you're running the server with npx, use `npx` for the CLI as well:
216
296
 
217
297
  ```bash
218
298
  npx -y --package=@arabold/docs-mcp-server docs-cli <command> [options]
219
299
  ```
220
300
 
221
- The npx approach will use the default data directory on your system (typically in your home directory), ensuring consistency between server and CLI.
301
+ The `npx` approach will use the default data directory on your system (typically in your home directory), ensuring consistency between server and CLI.
222
302
 
223
303
  The main commands available are:
224
304
 
@@ -0,0 +1,57 @@
1
+ -- Initial database schema setup
2
+
3
+ -- Documents table
4
+ CREATE TABLE IF NOT EXISTS documents(
5
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
6
+ library TEXT NOT NULL,
7
+ version TEXT NOT NULL DEFAULT '',
8
+ url TEXT NOT NULL,
9
+ content TEXT,
10
+ metadata JSON,
11
+ sort_order INTEGER NOT NULL,
12
+ UNIQUE(url, library, version, sort_order)
13
+ );
14
+
15
+ -- Indexes
16
+ CREATE INDEX IF NOT EXISTS idx_documents_library_lower ON documents(lower(library));
17
+ CREATE INDEX IF NOT EXISTS idx_documents_version_lower ON documents(lower(library), lower(version));
18
+
19
+ -- Create Embeddings virtual table
20
+ -- Note: Dimension is hardcoded here based on the value in schema.ts at the time of creation.
21
+ -- If VECTOR_DIMENSION changes, a separate migration would be needed to update/recreate this table.
22
+ CREATE VIRTUAL TABLE IF NOT EXISTS documents_vec USING vec0(
23
+ library TEXT NOT NULL,
24
+ version TEXT NOT NULL,
25
+ embedding FLOAT[1536]
26
+ );
27
+
28
+ -- Create FTS5 virtual table
29
+ CREATE VIRTUAL TABLE IF NOT EXISTS documents_fts USING fts5(
30
+ content,
31
+ title,
32
+ url,
33
+ path,
34
+ tokenize='porter unicode61',
35
+ content='documents',
36
+ content_rowid='id'
37
+ );
38
+
39
+ -- Delete trigger to maintain FTS index
40
+ CREATE TRIGGER IF NOT EXISTS documents_fts_after_delete AFTER DELETE ON documents BEGIN
41
+ INSERT INTO documents_fts(documents_fts, rowid, content, title, url, path)
42
+ VALUES('delete', old.id, old.content, json_extract(old.metadata, '$.title'), old.url, json_extract(old.metadata, '$.path'));
43
+ END;
44
+
45
+ -- Update trigger to maintain FTS index
46
+ CREATE TRIGGER IF NOT EXISTS documents_fts_after_update AFTER UPDATE ON documents BEGIN
47
+ INSERT INTO documents_fts(documents_fts, rowid, content, title, url, path)
48
+ VALUES('delete', old.id, old.content, json_extract(old.metadata, '$.title'), old.url, json_extract(old.metadata, '$.path'));
49
+ INSERT INTO documents_fts(rowid, content, title, url, path)
50
+ VALUES(new.id, new.content, json_extract(new.metadata, '$.title'), new.url, json_extract(new.metadata, '$.path'));
51
+ END;
52
+
53
+ -- Insert trigger to maintain FTS index
54
+ CREATE TRIGGER IF NOT EXISTS documents_fts_after_insert AFTER INSERT ON documents BEGIN
55
+ INSERT INTO documents_fts(rowid, content, title, url, path)
56
+ VALUES(new.id, new.content, json_extract(new.metadata, '$.title'), new.url, json_extract(new.metadata, '$.path'));
57
+ END;
@@ -0,0 +1,6 @@
1
+ -- Add indexed_at column to track when documents were last indexed
2
+ -- Step 1: Add the column allowing NULLs (SQLite limitation workaround)
3
+ ALTER TABLE documents ADD COLUMN indexed_at DATETIME;
4
+
5
+ -- Step 2: Update existing rows to set the timestamp
6
+ UPDATE documents SET indexed_at = CURRENT_TIMESTAMP WHERE indexed_at IS NULL;