Skip to content

Commit 92b264e

Browse files
committed
fix: translate Docker files to English, move bridge+docs to docker/
1 parent 66837e3 commit 92b264e

4 files changed

Lines changed: 31 additions & 37 deletions

File tree

Dockerfile

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ FROM node:20-alpine AS builder
33

44
WORKDIR /app
55

6-
# Copia solo i file di dipendenze prima (layer cache)
6+
# Copy dependency files first (layer cache)
77
COPY package*.json ./
88
RUN npm ci
99

10-
# Copia tutto il sorgente e compila
10+
# Copy source and build
1111
COPY . .
1212
RUN npm run build
1313

@@ -16,32 +16,29 @@ FROM node:20-alpine AS runtime
1616

1717
WORKDIR /app
1818

19-
# Installa solo le dipendenze di produzione
19+
# Install production dependencies only
2020
COPY package*.json ./
2121
RUN npm ci --omit=dev && npm cache clean --force
2222

23-
# Copia i file compilati dallo stage di build
23+
# Copy compiled files from build stage
2424
COPY --from=builder /app/dist ./dist
2525

26-
# Copia eventuali asset statici necessari a runtime (opzionale: il file potrebbe non esistere)
27-
COPY --from=builder /app/src/portals.jso[n] ./src/
28-
29-
# Variabili d'ambiente con valori di default
26+
# Default environment variables
3027
ENV NODE_ENV=production
3128
ENV TRANSPORT=http
3229
ENV PORT=3000
3330

34-
# Espone la porta HTTP del server MCP
31+
# Expose MCP HTTP server port
3532
EXPOSE 3000
3633

37-
# Healthcheck: verifica che il server risponda
34+
# Healthcheck: verify the server responds
3835
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
3936
CMD wget -qO- http://localhost:${PORT}/health 2>/dev/null || \
4037
curl -sf -X POST http://localhost:${PORT}/mcp \
4138
-H 'Content-Type: application/json' \
4239
-d '{"jsonrpc":"2.0","method":"ping","id":1}' || exit 1
4340

44-
# Utente non-root per sicurezza
41+
# Run as non-root user for security
4542
USER node
4643

4744
CMD ["node", "dist/index.js"]

docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ services:
1111
- "3000:3000"
1212

1313
environment:
14-
# Modalità di trasporto: "http" per server HTTP, "stdio" per pipe locale
14+
# Transport mode: "http" for HTTP server, "stdio" for local pipe
1515
TRANSPORT: http
1616
PORT: 3000
1717
NODE_ENV: production
1818

19-
# Opzionale: imposta un CKAN portal di default
19+
# Optional: set a default CKAN portal
2020
# CKAN_DEFAULT_SERVER_URL: https://www.dati.gov.it/opendata
2121

22-
# Limiti di risorse (opzionale, regola in base al tuo host)
22+
# Resource limits (optional, adjust to your host)
2323
deploy:
2424
resources:
2525
limits:
2626
memory: 256M
2727
cpus: "0.5"
2828

29-
# Log con rotazione automatica
29+
# Automatic log rotation
3030
logging:
3131
driver: "json-file"
3232
options:

DOCKER-README.md renamed to docker/README.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ These files allow you to run [ckan-mcp-server](https://github.com/ondata/ckan-mc
44

55
## File Structure
66

7-
Copy these three files into the root of the repo:
7+
The following files are included in the repo:
88

99
```
1010
ckan-mcp-server/
11-
├── Dockerfile ← multi-stage build (builder + runtime)
12-
├── docker-compose.yml ← orchestration with variables and healthcheck
13-
├── .dockerignore ← excludes node_modules, dist, docs, etc.
11+
├── Dockerfile ← multi-stage build (builder + runtime)
12+
├── docker-compose.yml ← orchestration with variables and healthcheck
13+
├── docker/
14+
│ ├── README.md ← this file
15+
│ └── ckan-mcp-bridge.js ← stdio bridge for Claude Desktop
1416
└── ... (rest of the repo)
1517
```
1618

@@ -21,10 +23,7 @@ ckan-mcp-server/
2123
git clone https://github.com/ondata/ckan-mcp-server.git
2224
cd ckan-mcp-server
2325

24-
# 2. Copy the Docker files into the repo root
25-
# (Dockerfile, docker-compose.yml, .dockerignore)
26-
27-
# 3. Build and start
26+
# 2. Build and start
2827
docker compose up --build -d
2928
```
3029

@@ -56,16 +55,15 @@ docker run -d \
5655

5756
## Configuring Claude Desktop with the Container
5857

59-
Save ckan-mcp-bridge.js (config your local IP if necessary instead localhost in row 14)
60-
61-
Once the container is running, add the following to `claude_desktop_config.json`:
58+
Once the container is running, add the following to `claude_desktop_config.json`.
59+
Set `MCP_URL` to point to your Docker host if running on a remote machine.
6260

6361
```json
6462
{
6563
"mcpServers": {
6664
"ckan": {
6765
"command": "node",
68-
"args": ["/usr/local/bin/ckan-mcp-bridge.js"],
66+
"args": ["/path/to/ckan-mcp-server/docker/ckan-mcp-bridge.js"],
6967
"env": {
7068
"MCP_URL": "http://localhost:3000/mcp"
7169
}
Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
#!/usr/bin/env node
22
/**
3-
* stdio-bridge.js
4-
* Wrapper che permette a Claude Desktop (stdio) di parlare
5-
* con il container ckan-mcp-server (HTTP/SSE).
3+
* ckan-mcp-bridge.js
4+
* Wrapper that allows Claude Desktop (stdio) to communicate
5+
* with the ckan-mcp-server container (HTTP/SSE).
66
*
7-
* Claude Desktop <--stdio--> questo script <--HTTP--> container Docker
7+
* Claude Desktop <--stdio--> this script <--HTTP--> Docker container
88
*/
99

1010
const http = require("http");
1111
const https = require("https");
1212

13-
/*CHANGE LOCALHOST WITH IP*/
1413
const MCP_URL = process.env.MCP_URL || "http://localhost:3000/mcp";
1514

1615
const url = new URL(MCP_URL);
@@ -35,7 +34,7 @@ function sendToServer(body) {
3534
let raw = "";
3635
res.on("data", (chunk) => (raw += chunk));
3736
res.on("end", () => {
38-
// Gestisce sia risposte JSON pure che SSE (data: {...})
37+
// Handle both plain JSON responses and SSE (data: {...})
3938
const lines = raw.split("\n");
4039
for (const line of lines) {
4140
const trimmed = line.trim();
@@ -54,7 +53,7 @@ function sendToServer(body) {
5453
} catch {}
5554
}
5655
}
57-
// Fallback: prova a parsare tutto il body
56+
// Fallback: try to parse the entire body
5857
try {
5958
resolve(JSON.parse(raw));
6059
} catch {
@@ -69,13 +68,13 @@ function sendToServer(body) {
6968
});
7069
}
7170

72-
// Legge messaggi JSON-RPC da stdin (uno per riga)
71+
// Read JSON-RPC messages from stdin (one per line)
7372
let buffer = "";
7473
process.stdin.setEncoding("utf8");
7574
process.stdin.on("data", async (chunk) => {
7675
buffer += chunk;
7776
const lines = buffer.split("\n");
78-
buffer = lines.pop(); // l'ultima riga potrebbe essere incompleta
77+
buffer = lines.pop(); // last line may be incomplete
7978

8079
for (const line of lines) {
8180
const trimmed = line.trim();
@@ -85,7 +84,7 @@ process.stdin.on("data", async (chunk) => {
8584
const response = await sendToServer(message);
8685
process.stdout.write(JSON.stringify(response) + "\n");
8786
} catch (err) {
88-
// Invia un errore JSON-RPC valido in caso di problema
87+
// Send a valid JSON-RPC error on failure
8988
const errResponse = {
9089
jsonrpc: "2.0",
9190
error: { code: -32603, message: err.message },

0 commit comments

Comments
 (0)