Skip to content

Commit 5651103

Browse files
wip: testing pkgx & docker builds
1 parent c48014e commit 5651103

File tree

12 files changed

+266
-15
lines changed

12 files changed

+266
-15
lines changed

.dockerignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
target
2+
**/target
3+
.git
4+
.gitignore
5+
*.log
6+
node_modules
7+
dist
8+
tmp
9+
.DS_Store

.github/workflows/docker.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "v*"
9+
workflow_dispatch:
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: ${{ github.repository }}
14+
15+
jobs:
16+
build-and-push:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Set up QEMU
26+
uses: docker/setup-qemu-action@v3
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Log in to registry
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ${{ env.REGISTRY }}
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Docker metadata
39+
id: meta
40+
uses: docker/metadata-action@v5
41+
with:
42+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
43+
tags: |
44+
type=ref,event=branch
45+
type=ref,event=tag
46+
type=semver,pattern={{version}}
47+
type=semver,pattern={{major}}.{{minor}}
48+
49+
- name: Build and push
50+
uses: docker/build-push-action@v6
51+
with:
52+
context: .
53+
push: true
54+
platforms: linux/amd64
55+
tags: ${{ steps.meta.outputs.tags }}
56+
labels: ${{ steps.meta.outputs.labels }}

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
3+
## [0.3.0] - 2025-11-12
4+
- rename the crate and repository references to `rust-cargo-docs-rag-mcp`
5+
- document the new GitHub location plus attribution expectations for upstream
6+
- add Cocogitto (`cog`) configuration, release script, and changelog scaffolding for version control
7+
- add an Alpine-based Docker image build + entrypoint script plus usage docs for container publishing
8+
- publish the container automatically to GHCR using `.github/workflows/docker.yml`
9+
- update Docker builder stage to the latest stable Rust toolchain (1.91.1) for smaller, faster binaries

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[package]
2-
name = "cratedocs-mcp"
3-
version = "0.2.0"
2+
name = "rust-cargo-docs-rag-mcp"
3+
version = "0.3.0"
44
edition = "2021"
55
description = "Rust Documentation MCP Server for LLM crate assistance"
66
authors = ["Brian Horakh <[email protected]>",
77
"Claude <[email protected]>"]
88
license = "MIT"
9-
repository = "https://github.com/d6e/cratedocs-mcp"
9+
repository = "https://github.com/promptexecution/rust-cargo-docs-rag-mcp"
1010

1111
[workspace]
1212
members = [

Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM rust:1.91.1-alpine3.20 AS builder
2+
3+
RUN apk add --no-cache \
4+
build-base \
5+
pkgconfig \
6+
openssl-dev \
7+
git
8+
9+
WORKDIR /app
10+
11+
# Cache dependency compilation
12+
COPY Cargo.toml Cargo.lock ./
13+
RUN mkdir src && echo "fn main() {}" > src/main.rs
14+
RUN cargo fetch
15+
RUN rm -rf src
16+
17+
# Copy the full source tree
18+
COPY . .
19+
20+
RUN cargo build --locked --release --bin cratedocs
21+
22+
FROM alpine:3.20
23+
24+
RUN apk add --no-cache ca-certificates libgcc libstdc++ libssl3
25+
26+
COPY --from=builder /app/target/release/cratedocs /usr/local/bin/cratedocs
27+
COPY docker/entrypoint.sh /entrypoint.sh
28+
29+
RUN chmod +x /entrypoint.sh
30+
31+
EXPOSE 8080
32+
33+
ENV CRATEDOCS_MODE=http \
34+
CRATEDOCS_ADDRESS=0.0.0.0:8080 \
35+
CRATEDOCS_DEBUG=false
36+
37+
ENTRYPOINT ["/entrypoint.sh"]

README.md

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# CrateDocs MCP
1+
# Rust Cargo Docs RAG MCP
22

3-
This is an MCP (Model Context Protocol) server that provides tools for Rust crate documentation lookup. It allows LLMs to look up documentation for Rust crates they are unfamiliar with.
3+
`rust-cargo-docs-rag-mcp` is an MCP (Model Context Protocol) server that provides tools for Rust crate documentation lookup. It allows LLMs to look up documentation for Rust crates they are unfamiliar with.
44

55
## Features
66

@@ -11,8 +11,8 @@ This is an MCP (Model Context Protocol) server that provides tools for Rust crat
1111
## Installation
1212

1313
```bash
14-
git clone https://github.com/promptexecution/cratedocs-mcp.git
15-
cd cratedocs-mcp
14+
git clone https://github.com/promptexecution/rust-cargo-docs-rag-mcp.git
15+
cd rust-cargo-docs-rag-mcp
1616
cargo build --release
1717
cargo install --path .
1818
```
@@ -39,6 +39,31 @@ cargo run --bin cratedocs http --address 0.0.0.0:3000
3939
cargo run --bin cratedocs http --debug
4040
```
4141

42+
### Using Docker
43+
44+
You can also build and run the server in an Alpine-based container. Prebuilt images are automatically published to GHCR via [`.github/workflows/docker.yml`](.github/workflows/docker.yml):
45+
46+
```bash
47+
docker pull ghcr.io/promptexecution/rust-cargo-docs-rag-mcp:latest
48+
```
49+
50+
To build locally (useful before pushing to another registry):
51+
52+
```bash
53+
# Build the image (adjust the tag to match your registry)
54+
docker build -t promptexecution/rust-cargo-docs-rag-mcp .
55+
56+
# Run HTTP/SSE mode on port 8080
57+
docker run --rm -p 8080:8080 promptexecution/rust-cargo-docs-rag-mcp
58+
```
59+
60+
Configuration is controlled through environment variables:
61+
- `CRATEDOCS_MODE` (default `http`): switch to `stdio` to expose the stdio MCP server
62+
- `CRATEDOCS_ADDRESS` (default `0.0.0.0:8080`): bind the HTTP server to a specific interface/port
63+
- `CRATEDOCS_DEBUG` (default `false`): set to `true` to enable verbose logging in HTTP mode
64+
65+
All additional arguments appended to `docker run ... -- <args>` are forwarded to the underlying `cratedocs` process.
66+
4267
### Directly Testing Documentation Tools
4368

4469
You can directly test the documentation tools from the command line without starting a server:
@@ -229,6 +254,26 @@ Stub: list_crate_items for crate: serde, version: 1.0.0, filters: Some(ItemListF
229254
When implemented, the output will be a structured list of items matching the filters.
230255

231256

257+
## Versioning & Releases
258+
259+
This repository includes a [`cog.toml`](./cog.toml) profile wired to [`scripts/set-version.sh`](./scripts/set-version.sh) so [Cocogitto](https://github.com/cocogitto/cocogitto) can bump the crate version and regenerate the changelog automatically.
260+
261+
Typical release flow:
262+
1. `cargo install cocogitto` (once)
263+
2. `cog bump minor` (or `patch`/`major`) – this updates `Cargo.toml`, `Cargo.lock`, and `CHANGELOG.md`
264+
3. Review the generated changelog, run tests, and push the resulting tag/commit
265+
266+
See [`CHANGELOG.md`](./CHANGELOG.md) for the latest published versions.
267+
232268
## License
233269

234270
MIT License
271+
272+
## Attribution & Linkback Request
273+
274+
This fork builds on the original [`d6e/cratedocs-mcp`](https://github.com/d6e/cratedocs-mcp) work by:
275+
- wiring the crate-documentation helpers into a full MCP server with both `stdio` and HTTP/SSE launch modes
276+
- documenting the new unified CLI, RooCode/Vscode integration examples, and the `list_crate_items` tool surface
277+
- adding guidance on testing individual tools directly from the CLI plus notes on caching and output formatting
278+
279+
If you decide to keep these changes upstream, could you please add a short linkback to [`promptexecution/rust-cargo-docs-rag-mcp`](https://github.com/promptexecution/rust-cargo-docs-rag-mcp) in your README? That attribution helps other developers understand where this MCP-focused variant originated and makes it easier for them to follow improvements across both projects.

cog.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from_latest_tag = true
2+
ignore_merge_commits = true
3+
branch_whitelist = ["main"]
4+
5+
[git]
6+
tag_prefix = "v"
7+
8+
[changelog]
9+
path = "CHANGELOG.md"
10+
template = "remote"
11+
12+
pre_bump_hooks = [
13+
"./scripts/set-version.sh {{version}}"
14+
]
15+
16+
post_bump_hooks = [
17+
"git add Cargo.toml Cargo.lock CHANGELOG.md"
18+
]
19+
20+
[[packages]]
21+
name = "rust-cargo-docs-rag-mcp"
22+
path = "."

docker/entrypoint.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
set -eu
3+
4+
MODE="${CRATEDOCS_MODE:-http}"
5+
ADDRESS="${CRATEDOCS_ADDRESS:-0.0.0.0:8080}"
6+
DEBUG="${CRATEDOCS_DEBUG:-false}"
7+
8+
if [ "$MODE" = "http" ]; then
9+
if [ "$DEBUG" = "true" ]; then
10+
exec /usr/local/bin/cratedocs http --address "$ADDRESS" --debug "$@"
11+
else
12+
exec /usr/local/bin/cratedocs http --address "$ADDRESS" "$@"
13+
fi
14+
else
15+
exec /usr/local/bin/cratedocs "$MODE" "$@"
16+
fi

justfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
install:
2-
cargo install --git https://github.com/PromptExecution/cratedocs-mcp --locked
2+
cargo install --git https://github.com/promptexecution/rust-cargo-docs-rag-mcp --locked
33

44
run:
55
cargo run --bin cratedocs http --address 0.0.0.0:3000 --debug
66

7+
docker-build:
8+
docker build -t promptexecution/rust-cargo-docs-rag-mcp .
9+
10+
docker-run:
11+
docker run --rm -p 8080:8080 promptexecution/rust-cargo-docs-rag-mcp
12+
713
debug-mcp-remote:
814
# use bunx or npx to see how the mcp-remote proxy connects
915
bunx mcp-remote@latest "http://127.0.0.1:3000/sse" --allow-http --transport sse-only --debug
10-

0 commit comments

Comments
 (0)