You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(docker): add configurable storage path & improve support
This commit significantly enhances Docker support and introduces a configurable storage path for the database, simplifying installation and deployment.
- **Configurable Storage:** Introduced the `DOCS_MCP_STORE_PATH` environment variable to allow users to specify a custom directory for the `documents.db` file. The path resolution order is now:
1. `DOCS_MCP_STORE_PATH` (if set)
2. Legacy `./.store/` directory (if `documents.db` exists there)
3. Standard OS-specific application data directory
- **Docker Enhancements:**
- Updated the Dockerfile to use `node:22-slim`, expose a `/data` volume, and set `DOCS_MCP_STORE_PATH=/data`.
- Added a new GitHub Actions workflow (`docker-publish.yml`) to build and publish the Docker image to GHCR.
- Updated the README.md to recommend Docker as the primary installation method, providing clear instructions and an updated MCP configuration example.
- Refined `.dockerignore` for a smaller build context.
- **CI/CD Updates:** Removed `--ignore-scripts` from `npm ci` commands in workflows to align with Docker build process.
- **Dependency Management:** Updated `prepare` script in `package.json` for better compatibility (`husky || true`).
- 'v*.*.*'# Trigger only on version tags like v1.0.0, v1.2.3, etc.
8
+
9
+
jobs:
10
+
publish:
11
+
name: Build and Push Docker Image to GHCR
12
+
runs-on: ubuntu-latest
13
+
permissions:
14
+
contents: read # Needed to check out the code
15
+
packages: write # Needed to push Docker image to GHCR
16
+
17
+
steps:
18
+
- name: Checkout code
19
+
uses: actions/checkout@v4
20
+
21
+
- name: Log in to GitHub Container Registry
22
+
uses: docker/login-action@v3
23
+
with:
24
+
registry: ghcr.io
25
+
username: ${{ github.actor }} # Use the GitHub username initiating the workflow
26
+
password: ${{ secrets.GITHUB_TOKEN }} # Use the automatically generated token
27
+
28
+
- name: Extract Docker metadata
29
+
id: meta
30
+
uses: docker/metadata-action@v5
31
+
with:
32
+
images: ghcr.io/${{ github.repository }} # Use ghcr.io/arabold/docs-mcp-server
33
+
tags: |
34
+
# Extract version number from the Git tag (e.g., v1.2.3 -> 1.2.3)
35
+
type=semver,pattern={{version}}
36
+
# Also tag with 'v' prefix (e.g., v1.2.3)
37
+
type=semver,pattern={{raw}}
38
+
# Add the 'latest' tag
39
+
type=raw,value=latest,enable={{is_default_branch}} # Only add latest tag if the tag is on the default branch (usually main) - semantic-release should ensure this
Copy file name to clipboardExpand all lines: README.md
+57-22Lines changed: 57 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,17 +42,27 @@ Install the package globally using npm. This makes the `docs-server` and `docs-c
42
42
43
43
This method is convenient if you plan to use the `docs-cli` frequently.
44
44
45
-
### Method 2: Direct Execution with `npx` (Recommended for MCP Integration)
45
+
### Method 2: Running with Docker (Recommended for MCP Integration)
46
46
47
-
Run the server or CLI directly using `npx` without needing a global installation. The `-y` flag ensures the package is automatically downloaded if needed.
47
+
Run the server using the pre-built Docker image available on GitHub Container Registry. This provides an isolated environment and simplifies setup.
48
48
49
-
1. **Run the Server (e.g., for MCP Integration):**
49
+
1. **Ensure Docker is installed and running.**
50
+
2. **Run the Server (e.g., for MCP Integration):**
This is the recommended approach for integrating with tools like Claude Desktop or Cline, as it avoids polluting the global namespace and ensures the correct version is used.
59
+
- `-i`: Keep STDIN open, crucial for MCP communication over stdio.
60
+
- `--rm`: Automatically remove the container when it exits.
61
+
- `-e OPENAI_API_KEY="..."`: **Required.** Set your OpenAI API key.
62
+
- `-v docs-mcp-data:/data`: **Required for persistence.** Mounts a Docker named volume (`docs-mcp-data` is created automatically if it doesn't exist) to the container's `/data` directory, where the database is stored. You can replace `docs-mcp-data` with a specific host path if preferred (e.g., `-v /path/on/host:/data`).
63
+
- `ghcr.io/arabold/docs-mcp-server:latest`: Specifies the public Docker image to use.
64
+
65
+
This is the recommended approach for integrating with tools like Claude Desktop or Cline.
56
66
57
67
**Claude/Cline Configuration Example:**
58
68
Add the following configuration block to your MCP settings file (adjust path as needed):
@@ -65,8 +75,17 @@ Run the server or CLI directly using `npx` without needing a global installation
This section covers running the server/CLI using Docker or directly from the source code for development purposes.
247
+
This section covers running the server/CLI directly from the source code for development purposes. The primary usage method is now via the public Docker image as described in "Method 2".
224
248
225
-
### Running with Docker
249
+
### Running from Source (Development)
226
250
227
251
This provides an isolated environment and exposes the server via HTTP endpoints.
228
252
@@ -244,20 +268,22 @@ This provides an isolated environment and exposes the server via HTTP endpoints.
244
268
4. **Run the Docker container:**
245
269
246
270
```bash
247
-
docker run -p 8000:8000 --env-file .env --name docs-mcp-server-container docs-mcp-server
271
+
# Option 1: Using a named volume (recommended)
272
+
# Docker automatically creates the volume 'docs-mcp-data' if it doesn't exist on first run.
273
+
docker run -i --env-file .env -v docs-mcp-data:/data --name docs-mcp-server docs-mcp-server
- `-p 8000:8000`: Maps host port 8000 to container port 8000.
251
-
- `--env-file .env`: Loads environment variables from your local `.env`.
252
-
- `--name docs-mcp-server-container`: Assigns a container name.
279
+
- `-i`: Keep STDIN open even if not attached. This is crucial for interacting with the server over stdio.
280
+
- `--env-file .env`: Loads environment variables (like `OPENAI_API_KEY`) from your local`.env` file.
281
+
- `-v docs-mcp-data:/data` or `-v /path/on/your/host:/data`: **Crucial forpersistence.** This mounts a Docker named volume (Docker creates `docs-mcp-data` automatically if needed) or a host directory to the `/data` directory inside the container. The `/data` directory is where the server stores its `documents.db` file (as configured by `DOCS_MCP_STORE_PATH`in the Dockerfile). This ensures your indexed documentation persists even if the container is stopped or removed.
282
+
- `--name docs-mcp-server`: Assigns a convenient name to the container.
253
283
254
-
5. **Available Endpoints:**
255
-
- SSE: `http://localhost:8000/sse`
256
-
- POST Messages: `http://localhost:8000/message`
284
+
The server inside the container now runs directly using Node.js and communicates over **stdio**.
257
285
258
-
### Running from Source (Development)
259
-
260
-
This method is required for contributing to the project or running un-published versions.
286
+
This method is useful for contributing to the project or running un-published versions.
261
287
262
288
1. **Clone the repository:**
263
289
```bash
@@ -290,8 +316,17 @@ This method is required for contributing to the project or running un-published
290
316
cp .env.example .env
291
317
```
292
318
2. Update your OpenAI API key in`.env`:
319
+
293
320
```
321
+
# Required: Your OpenAI API key for generating embeddings.
294
322
OPENAI_API_KEY=your-api-key-here
323
+
324
+
# Optional: Specify a custom directory to store the SQLite database file (documents.db).
325
+
# If set, this path takes precedence over the default locations.
326
+
# Default behavior (if unset):
327
+
# 1. Uses './.store/' in the project root if it exists (legacy).
328
+
# 2. Falls back to OS-specific data directory (e.g., ~/Library/Application Support/docs-mcp-server on macOS).
0 commit comments