Skip to content

Commit 0150947

Browse files
authored
Merge pull request #282 from yuchou87/mcp-tools-support
feat: Add mcp tools support
2 parents 475d8f9 + 4e348e3 commit 0150947

File tree

16 files changed

+2105
-62
lines changed

16 files changed

+2105
-62
lines changed

Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,44 @@ check: deps fmt vet test
204204
run: build
205205
@$(BUILD_DIR)/$(BINARY_NAME) $(ARGS)
206206

207+
## docker-build: Build Docker image (minimal Alpine-based)
208+
docker-build:
209+
@echo "Building minimal Docker image (Alpine-based)..."
210+
docker compose -f docker/docker-compose.yml build picoclaw-agent picoclaw-gateway
211+
212+
## docker-build-full: Build Docker image with full MCP support (Node.js 24)
213+
docker-build-full:
214+
@echo "Building full-featured Docker image (Node.js 24)..."
215+
docker compose -f docker/docker-compose.full.yml build picoclaw-agent picoclaw-gateway
216+
217+
## docker-test: Test MCP tools in Docker container
218+
docker-test:
219+
@echo "Testing MCP tools in Docker..."
220+
@chmod +x scripts/test-docker-mcp.sh
221+
@./scripts/test-docker-mcp.sh
222+
223+
## docker-run: Run picoclaw gateway in Docker (Alpine-based)
224+
docker-run:
225+
docker compose -f docker/docker-compose.yml --profile gateway up
226+
227+
## docker-run-full: Run picoclaw gateway in Docker (full-featured)
228+
docker-run-full:
229+
docker compose -f docker/docker-compose.full.yml --profile gateway up
230+
231+
## docker-run-agent: Run picoclaw agent in Docker (interactive, Alpine-based)
232+
docker-run-agent:
233+
docker compose -f docker/docker-compose.yml run --rm picoclaw-agent
234+
235+
## docker-run-agent-full: Run picoclaw agent in Docker (interactive, full-featured)
236+
docker-run-agent-full:
237+
docker compose -f docker/docker-compose.full.yml run --rm picoclaw-agent
238+
239+
## docker-clean: Clean Docker images and volumes
240+
docker-clean:
241+
docker compose -f docker/docker-compose.yml down -v
242+
docker compose -f docker/docker-compose.full.yml down -v
243+
docker rmi picoclaw:latest picoclaw:full 2>/dev/null || true
244+
207245
## help: Show this help message
208246
help:
209247
@echo "picoclaw Makefile"
@@ -219,6 +257,8 @@ help:
219257
@echo " make install # Install to ~/.local/bin"
220258
@echo " make uninstall # Remove from /usr/local/bin"
221259
@echo " make install-skills # Install skills to workspace"
260+
@echo " make docker-build # Build minimal Docker image"
261+
@echo " make docker-test # Test MCP tools in Docker"
222262
@echo ""
223263
@echo "Environment Variables:"
224264
@echo " INSTALL_PREFIX # Installation prefix (default: ~/.local)"

config/config.example.json

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,63 @@
243243
"cron": {
244244
"exec_timeout_minutes": 5
245245
},
246+
"mcp": {
247+
"enabled": false,
248+
"servers": {
249+
"filesystem": {
250+
"enabled": false,
251+
"command": "npx",
252+
"args": [
253+
"-y",
254+
"@modelcontextprotocol/server-filesystem",
255+
"/tmp"
256+
]
257+
},
258+
"github": {
259+
"enabled": false,
260+
"command": "npx",
261+
"args": [
262+
"-y",
263+
"@modelcontextprotocol/server-github"
264+
],
265+
"env": {
266+
"GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_GITHUB_TOKEN"
267+
}
268+
},
269+
"brave-search": {
270+
"enabled": false,
271+
"command": "npx",
272+
"args": [
273+
"-y",
274+
"@modelcontextprotocol/server-brave-search"
275+
],
276+
"env": {
277+
"BRAVE_API_KEY": "YOUR_BRAVE_API_KEY"
278+
}
279+
},
280+
"postgres": {
281+
"enabled": false,
282+
"command": "npx",
283+
"args": [
284+
"-y",
285+
"@modelcontextprotocol/server-postgres",
286+
"postgresql://user:password@localhost/dbname"
287+
]
288+
},
289+
"slack": {
290+
"enabled": false,
291+
"command": "npx",
292+
"args": [
293+
"-y",
294+
"@modelcontextprotocol/server-slack"
295+
],
296+
"env": {
297+
"SLACK_BOT_TOKEN": "YOUR_SLACK_BOT_TOKEN",
298+
"SLACK_TEAM_ID": "YOUR_SLACK_TEAM_ID"
299+
}
300+
}
301+
}
302+
},
246303
"exec": {
247304
"enable_deny_patterns": false,
248305
"custom_deny_patterns": []
@@ -271,4 +328,4 @@
271328
"host": "127.0.0.1",
272329
"port": 18790
273330
}
274-
}
331+
}

docker/Dockerfile.full

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# ============================================================
2+
# Stage 1: Build the picoclaw binary
3+
# ============================================================
4+
FROM golang:1.26.0-alpine AS builder
5+
6+
RUN apk add --no-cache git make
7+
8+
WORKDIR /src
9+
10+
# Cache dependencies
11+
COPY go.mod go.sum ./
12+
RUN go mod download
13+
14+
# Copy source and build
15+
COPY . .
16+
RUN make build
17+
18+
# ============================================================
19+
# Stage 2: Node.js-based runtime with full MCP support
20+
# ============================================================
21+
FROM node:24-alpine3.23
22+
23+
# Install runtime dependencies
24+
RUN apk add --no-cache \
25+
ca-certificates \
26+
curl \
27+
git \
28+
python3 \
29+
py3-pip
30+
31+
# Install uv and symlink to system path
32+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
33+
ln -s /root/.local/bin/uv /usr/local/bin/uv && \
34+
ln -s /root/.local/bin/uvx /usr/local/bin/uvx && \
35+
uv --version
36+
37+
# Copy binary
38+
COPY --from=builder /src/build/picoclaw /usr/local/bin/picoclaw
39+
40+
# Create picoclaw home directory
41+
RUN /usr/local/bin/picoclaw onboard
42+
43+
ENTRYPOINT ["picoclaw"]
44+
CMD ["gateway"]

docker/docker-compose.full.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
services:
2+
# ─────────────────────────────────────────────
3+
# PicoClaw Agent (one-shot query) - Full MCP Support
4+
# docker compose -f docker/docker-compose.full.yml run --rm picoclaw-agent -m "Hello"
5+
# ─────────────────────────────────────────────
6+
picoclaw-agent:
7+
build:
8+
context: ..
9+
dockerfile: docker/Dockerfile.full
10+
container_name: picoclaw-agent-full
11+
profiles:
12+
- agent
13+
volumes:
14+
- ../config/config.json:/root/.picoclaw/config.json:ro
15+
- picoclaw-workspace:/root/.picoclaw/workspace
16+
- picoclaw-npm-cache:/root/.npm # npm cache for faster MCP server installs
17+
entrypoint: ["picoclaw", "agent"]
18+
stdin_open: true
19+
tty: true
20+
21+
# ─────────────────────────────────────────────
22+
# PicoClaw Gateway (Long-running Bot) - Full MCP Support
23+
# docker compose -f docker/docker-compose.full.yml --profile gateway up
24+
# ─────────────────────────────────────────────
25+
picoclaw-gateway:
26+
build:
27+
context: ..
28+
dockerfile: docker/Dockerfile.full
29+
container_name: picoclaw-gateway-full
30+
restart: unless-stopped
31+
profiles:
32+
- gateway
33+
volumes:
34+
# Configuration file
35+
- ../config/config.json:/root/.picoclaw/config.json:ro
36+
# Persistent workspace (sessions, memory, logs)
37+
- picoclaw-workspace:/root/.picoclaw/workspace
38+
# NPM cache for faster MCP server installs
39+
- picoclaw-npm-cache:/root/.npm
40+
command: ["gateway"]
41+
42+
volumes:
43+
picoclaw-workspace:
44+
picoclaw-npm-cache: # Cache npm packages to speed up MCP server installations

0 commit comments

Comments
 (0)