Skip to content

Commit

Permalink
Merge pull request #368 from docker/docker/servers
Browse files Browse the repository at this point in the history
Add Docker support for sample mcp servers
  • Loading branch information
dsp-ant authored Dec 20, 2024
2 parents ea35591 + ddd4860 commit d5b6b4c
Show file tree
Hide file tree
Showing 50 changed files with 1,108 additions and 47 deletions.
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

0 comments on commit d5b6b4c

Please sign in to comment.