Skip to content

Chore/add dockerfile #7

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
npm-debug.log
Dockerfile
.dockerignore
.git
.gitignore
README.md
build
*.env
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:20 AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM node:20-slim AS final
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY --from=builder /app/build ./build
CMD ["node", "build/index.js"]
108 changes: 92 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,59 @@ export KONNECT_ACCESS_TOKEN=kpat_api_key_here
export KONNECT_REGION=us
```

## Running with Docker (Alternative)

You can also build and run this server using Docker.

### Building the Docker Image

```bash
docker build -t kong-konnect-mcp .
```

### Running the Docker Container (Manual / Standalone)

This command runs the Docker container directly from your terminal. This is useful for:
* **Testing:** Verifying that the image builds and the server starts correctly.
* **Standalone Use:** Running the server independently if needed for other purposes or if you prefer managing it separately.

**Note:** This is *different* from the configuration used by Claude Desktop (see `Usage with Claude` section below). Claude Desktop will manage starting and stopping the container itself based on its configuration.

To run manually:
```bash
docker run --rm -i --name kong-mcp-manual \
-e KONNECT_ACCESS_TOKEN="kpat_api_key_here" \
-e KONNECT_REGION="us" \
kong-konnect-mcp
```

* `--rm`: Automatically remove the container when it exits.
* `-i`: Keep STDIN open even if not attached (necessary for MCP over stdio).
* `--name kong-mcp-manual`: Assigns a specific name to the container, making it easier to stop later.
* `-e KONNECT_ACCESS_TOKEN="..."`: Sets the required API key.
* `-e KONNECT_REGION="..."`: Sets the region (optional, defaults to `us`).
* `kong-konnect-mcp`: The name of the image you built.

**Stopping the Manually Run Container:**

If you started the container manually with the `--name` flag as shown above, you can stop it using:

```bash
docker stop kong-mcp-manual
```

If you didn't use `--name`, you can list running containers to find its ID or name:

```bash
docker ps
```

Then stop it using its Container ID or Name:

```bash
docker stop <CONTAINER_ID_OR_NAME>
```

## Available Tools

The server provides tools organized in three categories:
Expand Down Expand Up @@ -210,24 +263,47 @@ To use this MCP server with Claude for Desktop:
- MacOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`

3. Add the following configuration:

```json
{
"mcpServers": {
"kong-konnect": {
"command": "node",
"args": [
"/absolute/path/to/mcp-konnect/build/index.js"
],
"env": {
"KONNECT_ACCESS_TOKEN": "kpat_api_key_here",
"KONNECT_REGION": "us"
3. Add **one** of the following configurations, depending on whether you run the server directly with Node or via Docker:

**Option A: Running directly with Node (after `npm install` and `npm run build`)**

```json
{
"mcpServers": {
"kong-konnect": {
"command": "node",
"args": [
"/absolute/path/to/mcp-konnect/build/index.js"
],
"env": {
"KONNECT_ACCESS_TOKEN": "kpat_api_key_here",
"KONNECT_REGION": "us"
}
}
}
}
}
}
```
```
*Ensure you replace `/absolute/path/to/mcp-konnect` with the correct path on your system.*

**Option B: Running with Docker (after `docker build`)**

```json
{
"mcpServers": {
"kong-konnect": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "KONNECT_ACCESS_TOKEN=kpat_api_key_here",
"-e", "KONNECT_REGION=us",
"kong-konnect-mcp"
],
"env": {}
}
}
}
```
*Ensure your `KONNECT_ACCESS_TOKEN` is correctly set within the `args` array.*

4. Restart Claude for Desktop
5. The Kong Konnect tools will now be available for Claude to use
Expand Down