Skip to content

Commit e2c3c82

Browse files
committed
fix(docker): suppress all stdout output for MCP compatibility
1 parent 503f1a8 commit e2c3c82

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

.env.example

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
APP_NAME="Forge MCP"
2-
APP_ENV=local
2+
APP_ENV=production
33
APP_KEY=
4-
APP_DEBUG=true
4+
APP_DEBUG=false
55
APP_URL=http://localhost
66

7-
LOG_CHANNEL=stack
8-
LOG_LEVEL=debug
7+
LOG_CHANNEL=stderr
8+
LOG_LEVEL=error
99

1010
FILESYSTEM_DISK=local
1111

Dockerfile

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ RUN apk add --no-cache \
99
unzip \
1010
&& rm -rf /var/cache/apk/*
1111

12-
# Configure PHP for MCP (disable display_errors to prevent stdout pollution)
12+
# Configure PHP for MCP (disable ALL output to stdout)
1313
RUN echo "display_errors = Off" >> /usr/local/etc/php/conf.d/mcp.ini && \
14+
echo "display_startup_errors = Off" >> /usr/local/etc/php/conf.d/mcp.ini && \
1415
echo "log_errors = On" >> /usr/local/etc/php/conf.d/mcp.ini && \
15-
echo "error_log = /dev/stderr" >> /usr/local/etc/php/conf.d/mcp.ini
16+
echo "error_log = /dev/stderr" >> /usr/local/etc/php/conf.d/mcp.ini && \
17+
echo "error_reporting = 0" >> /usr/local/etc/php/conf.d/mcp.ini && \
18+
echo "opcache.enable = 1" >> /usr/local/etc/php/conf.d/mcp.ini && \
19+
echo "opcache.enable_cli = 0" >> /usr/local/etc/php/conf.d/mcp.ini
1620

1721
# Install Composer
1822
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
@@ -54,5 +58,11 @@ USER www-data
5458
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
5559
CMD php artisan --version || exit 1
5660

57-
# Run MCP server on stdin/stdout
58-
CMD ["php", "artisan", "mcp:start", "forge"]
61+
# Environment for MCP (no stdout pollution)
62+
ENV APP_ENV=production
63+
ENV APP_DEBUG=false
64+
ENV LOG_CHANNEL=stderr
65+
ENV LOG_LEVEL=error
66+
67+
# Run MCP server on stdin/stdout (stderr for any errors)
68+
CMD ["php", "-d", "display_errors=Off", "-d", "error_reporting=0", "artisan", "mcp:start", "forge"]

0 commit comments

Comments
 (0)