Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker support for sample mcp servers #368

Merged
merged 21 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
368e3b2
Add Dockerfiles for the 17 sample MCP servers
slimslenderslacks Dec 10, 2024
9ff603a
Update dockerfiles for npx versions, gdrive env credential paths
ColinMcNeil Dec 17, 2024
4e8a8d2
Split production node_modules
ColinMcNeil Dec 17, 2024
bb0adaa
Allow filesystem to accept `DOCKER_ROOT_WORKSPACE`
ColinMcNeil Dec 17, 2024
308b71c
Remove env from postgres server
slimslenderslacks Dec 18, 2024
c64f8de
Config tweaks for docker
ColinMcNeil Dec 18, 2024
5865afb
Fix puppeteer docker container hanging
ColinMcNeil Dec 19, 2024
4034df7
Switch puppeteer stdin close from `process.exit` to `server.close`
ColinMcNeil Dec 19, 2024
0b36cb4
Revert filesystem back to original cli arg sandboxing
ColinMcNeil Dec 19, 2024
5451033
Update filesystem config for Docker
ColinMcNeil Dec 19, 2024
4904415
Update readmes to use new `mcp` namespace
ColinMcNeil Dec 19, 2024
70e19c4
Migrate python servers to mcp namespace
slimslenderslacks Dec 19, 2024
066426c
Fix git and brave-search typos in README.md
slimslenderslacks Dec 19, 2024
e4ef637
fix indentation
slimslenderslacks Dec 19, 2024
2b0b8af
Update src/puppeteer/README.md
slimslenderslacks Dec 19, 2024
38c88d9
Bump puppeteer bullseye to bookworm
ColinMcNeil Dec 19, 2024
f630294
Get gdrive working in Docker
ColinMcNeil Dec 19, 2024
4fa1c47
Update fetch Docker to not have ux in final stage
slimslenderslacks Dec 20, 2024
621919a
Switch to uv-less final stages
slimslenderslacks Dec 20, 2024
071f41d
Remove step 6 for gdrive
ColinMcNeil Dec 20, 2024
ddd4860
Emit gdrive log on stderr to prevent rpc errors in claude desktop
ColinMcNeil Dec 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions src/aws-kb-retrieval-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM node:22.12-alpine as builder

COPY src/aws-kb-retrieval-server /app
COPY tsconfig.json /tsconfig.json

WORKDIR /app

RUN --mount=type=cache,target=/root/.npm npm install

FROM node:22-alpine AS release

WORKDIR /app

COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json

ENV NODE_ENV=production

RUN npm ci --ignore-scripts --omit-dev

ENTRYPOINT ["node", "dist/index.js"]
26 changes: 26 additions & 0 deletions src/aws-kb-retrieval-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,24 @@ An MCP server implementation for retrieving information from the AWS Knowledge B

Add this to your `claude_desktop_config.json`:

#### Docker

```json
{
"mcpServers": {
"aws-kb-retrieval": {
"command": "docker",
"args": [ "run", "-i", "--rm", "-e", "AWS_ACCESS_KEY_ID", "-e", "AWS_SECRET_ACCESS_KEY", "-e", "AWS_REGION", "mcp/aws-kb-retrieval-server" ],
"env": {
"AWS_ACCESS_KEY_ID": "YOUR_ACCESS_KEY_HERE",
"AWS_SECRET_ACCESS_KEY": "YOUR_SECRET_ACCESS_KEY_HERE",
"AWS_REGION": "YOUR_AWS_REGION_HERE"
}
}
}
}
```

```json
{
"mcpServers": {
Expand All @@ -46,6 +64,14 @@ Add this to your `claude_desktop_config.json`:
}
```

## Building

Docker:

```sh
docker build -t mcp/aws-kb-retrieval -f src/aws-kb-retrieval-server/Dockerfile .
```

## License

This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
Expand Down
4 changes: 2 additions & 2 deletions src/aws-kb-retrieval-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"@aws-sdk/client-bedrock-agent-runtime": "^3.0.0"
},
"devDependencies": {
"@types/node": "^20.10.0",
"@types/node": "^22",
"shx": "^0.3.4",
"typescript": "^5.6.2"
}
}
}
23 changes: 23 additions & 0 deletions src/brave-search/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM node:22.12-alpine as builder

# Must be entire project because `prepare` script is run during `npm install` and requires all files.
COPY src/brave-search /app
COPY tsconfig.json /tsconfig.json

WORKDIR /app

RUN --mount=type=cache,target=/root/.npm npm install

FROM node:22-alpine AS release

WORKDIR /app

COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json

ENV NODE_ENV=production

RUN npm ci --ignore-scripts --omit-dev

ENTRYPOINT ["node", "dist/index.js"]
34 changes: 34 additions & 0 deletions src/brave-search/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,31 @@ An MCP server implementation that integrates the Brave Search API, providing bot
### Usage with Claude Desktop
Add this to your `claude_desktop_config.json`:

### Docker

```json
{
"mcpServers": {
"brave-search": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"BRAVE_API_KEY",
"mcp/brave-search"
],
"env": {
"BRAVE_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}
```

### NPX

```json
{
"mcpServers": {
Expand All @@ -53,6 +78,15 @@ Add this to your `claude_desktop_config.json`:
}
```


## Build

Docker build:

```bash
docker build -t mcp/brave-search:latest -f src/brave-search/Dockerfile .
```

## License

This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
2 changes: 1 addition & 1 deletion src/brave-search/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@modelcontextprotocol/sdk": "1.0.1"
},
"devDependencies": {
"@types/node": "^20.10.0",
"@types/node": "^22",
"shx": "^0.3.4",
"typescript": "^5.6.2"
}
Expand Down
24 changes: 24 additions & 0 deletions src/everart/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM node:22.12-alpine as builder

COPY src/everart /app
COPY tsconfig.json /tsconfig.json

WORKDIR /app

RUN --mount=type=cache,target=/root/.npm npm install

FROM node:22-alpine AS release

WORKDIR /app

COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json

ENV NODE_ENV=production

RUN npm ci --ignore-scripts --omit-dev

ENTRYPOINT ["node", "dist/index.js"]

CMD ["node", "dist/index.js"]
24 changes: 24 additions & 0 deletions src/everart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@ export EVERART_API_KEY=your_key_here

## Config
Add to Claude Desktop config:

### Docker
```json
{
"mcpServers": {
"everart": {
"command": "docker",
"args": ["run", "-i", "--rm", "-e", "EVERART_API_KEY", "mcp/everart"],
"env": {
"EVERART_API_KEY": "your_key_here"
}
}
}
}
```

### NPX

```json
{
"mcpServers": {
Expand Down Expand Up @@ -71,3 +89,9 @@ Generation details:

You can also click the URL above to view the image again.
```

## Building w/ Docker

```sh
docker build -t mcp/everart -f src/everart/Dockerfile .
```
2 changes: 1 addition & 1 deletion src/everart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"open": "^9.1.0"
},
"devDependencies": {
"@types/node": "^20.11.0",
"@types/node": "^22",
"shx": "^0.3.4",
"typescript": "^5.3.3"
}
Expand Down
22 changes: 22 additions & 0 deletions src/everything/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM node:22.12-alpine as builder

COPY src/everything /app
COPY tsconfig.json /tsconfig.json

WORKDIR /app

RUN --mount=type=cache,target=/root/.npm npm install

FROM node:22-alpine AS release

WORKDIR /app

COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json

ENV NODE_ENV=production

RUN npm ci --ignore-scripts --omit-dev

CMD ["node", "dist/index.js"]
36 changes: 36 additions & 0 deletions src/fetch/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Use a Python image with uv pre-installed
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS uv

# Install the project into `/app`
WORKDIR /app

# Enable bytecode compilation
ENV UV_COMPILE_BYTECODE=1

# Copy from the cache instead of linking since it's a mounted volume
ENV UV_LINK_MODE=copy

# Install the project's dependencies using the lockfile and settings
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --frozen --no-install-project --no-dev --no-editable

# Then, add the rest of the project source code and install it
# Installing separately from its dependencies allows optimal layer caching
ADD . /app
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev --no-editable

FROM python:3.12-slim-bookworm

WORKDIR /app

COPY --from=uv /root/.local /root/.local
COPY --from=uv --chown=app:app /app/.venv /app/.venv

# Place executables in the environment at the front of the path
ENV PATH="/app/.venv/bin:$PATH"

# when running the container, add --db-path and a bind mount to the host's db file
ENTRYPOINT ["mcp-server-fetch"]
Loading