From 1b9c1f24230bda8e9c9cae20cf5ed8411818e37c Mon Sep 17 00:00:00 2001 From: Andreas Hilbig Date: Fri, 13 Feb 2026 09:09:43 +0100 Subject: [PATCH 1/2] refactor: rename `postgres-server` to `zabbix-db` in Docker Compose and documentation - Renamed `postgres-server` service to `zabbix-db` for consistency across services. - Updated references in `docker-compose.yml` and local development guide to reflect the change. --- docker-compose.yml | 10 +++++----- docs/howtos/local_development.md | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c938d1f..51f2228 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,7 +43,7 @@ services: - mcp-shared:/mcp-data command: sh -c "cat /schema/*.graphql > /mcp-data/schema.graphql" - postgres-server: + zabbix-db: image: postgres:16-alpine profiles: - zabbix-local @@ -61,13 +61,13 @@ services: ports: - "10051:10051" environment: - - DB_SERVER_HOST=postgres-server + - DB_SERVER_HOST=zabbix-db - POSTGRES_USER=zabbix - POSTGRES_PASSWORD=zabbix - POSTGRES_DB=zabbix - ZBX_ALLOWUNSUPPORTEDDBVERSIONS=1 depends_on: - - postgres-server + - zabbix-db zabbix-web: image: zabbix/zabbix-web-nginx-pgsql:${ZABBIX_VERSION:-alpine-7.0-latest} @@ -77,14 +77,14 @@ services: - "8080:8080" environment: - ZBX_SERVER_HOST=zabbix-server - - DB_SERVER_HOST=postgres-server + - DB_SERVER_HOST=zabbix-db - POSTGRES_USER=zabbix - POSTGRES_PASSWORD=zabbix - POSTGRES_DB=zabbix - PHP_TZ=UTC - ZBX_ALLOWUNSUPPORTEDDBVERSIONS=1 depends_on: - - postgres-server + - zabbix-db - zabbix-server volumes: diff --git a/docs/howtos/local_development.md b/docs/howtos/local_development.md index 99bc147..4c9bf96 100644 --- a/docs/howtos/local_development.md +++ b/docs/howtos/local_development.md @@ -8,7 +8,7 @@ The project includes a Docker Compose profile that launches a complete Zabbix st ### Included Services - **`zabbix-graphql-api`**: The main GraphQL server. - **`apollo-mcp-server`**: The Model Context Protocol server for AI integration. -- **`postgres-server`**: PostgreSQL 16 database for Zabbix. +- **`zabbix-db`**: PostgreSQL 16 database for Zabbix. - **`zabbix-server`**: Zabbix Server (PostgreSQL version). - **`zabbix-web`**: Zabbix Web interface (Nginx/PostgreSQL). From 8f00082c6a26b5cf7b09df4a2a452c4acb287e77 Mon Sep 17 00:00:00 2001 From: Andreas Hilbig Date: Sat, 14 Feb 2026 13:24:19 +0100 Subject: [PATCH 2/2] chore: pin `apollo-mcp-server` version and improve API logging configuration - Pin `apollo-mcp-server` image to v1.7.0 and make version configurable via `APOLLO_MCP_SERVER_VERSION`. - Refactor API logging: rename `MCP_LOG_*` variables to `VERBOSITY_*` for clarity and deprecate unsupported fields. - Ensure v1.7.0 compatibility by updating `mcp-config.yaml` and removing obsolete fields. - Update documentation and configuration files to reflect these changes. --- README.md | 9 ++++++--- docker-compose.yml | 10 ++++++---- docs/howtos/mcp.md | 16 ++++++++++------ mcp-config.yaml | 4 +--- src/api/start.ts | 7 +++++-- src/common_utils.ts | 2 ++ 6 files changed, 30 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index c28277e..b20297d 100644 --- a/README.md +++ b/README.md @@ -115,9 +115,12 @@ The API is configured via environment variables. Create a `.env` file or set the | `ADDITIONAL_RESOLVERS` | Comma-separated list of resolver types to generate | - | No | | `LOG_LEVELS` | Comma-separated list of log levels to enable (e.g. `DEBUG,INFO,ERROR`) | - | No | | `VERBOSITY` | Verbosity level for GraphQL logging (0=off, 1=parameters, 2=parameters+responses) | `0` | No | -| `MCP_LOG_LEVEL` | Log level for the MCP server | `info` | No | -| `MCP_LOG_PARAMETERS` | Whether to log parameters of MCP calls | `false` | No | -| `MCP_LOG_RESPONSES` | Whether to log responses of MCP calls | `false` | No | +| `VERBOSITY_PARAMETERS` | Enable detailed logging of parameters for GraphQL requests | `0` | No | +| `VERBOSITY_RESPONSES` | Enable detailed logging of responses for GraphQL requests | `0` | No | +| `MCP_LOG_LEVEL` | Log level for the MCP server (`trace`, `debug`, `info`, `warn`, `error`) | `info` | No | +| `APOLLO_MCP_SERVER_VERSION` | Version tag for the Apollo MCP server Docker image (minimum recommended and tested with: `v1.7.0`) | `v1.7.0` | No | +| `MCP_LOG_PARAMETERS` | **(Deprecated)** Use `VERBOSITY_PARAMETERS` instead. | `false` | No | +| `MCP_LOG_RESPONSES` | **(Deprecated)** Use `VERBOSITY_RESPONSES` instead. | `false` | No | | `HOST_TYPE_FILTER_DEFAULT` | Default filter for host types | - | No | | `HOST_GROUP_FILTER_DEFAULT` | Default filter for host groups | - | No | diff --git a/docker-compose.yml b/docker-compose.yml index 51f2228..b667ccd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,14 +12,16 @@ services: - SCHEMA_PATH=/usr/app/dist/schema/ - ZABBIX_DEVELOPMENT_TOKEN=${ZABBIX_DEVELOPMENT_TOKEN} - VERBOSITY=${VERBOSITY:-0} + - VERBOSITY_PARAMETERS=${VERBOSITY_PARAMETERS:-0} + - VERBOSITY_RESPONSES=${VERBOSITY_RESPONSES:-0} - LOG_LEVELS=${LOG_LEVELS:-INFO} volumes: - ./samples:/usr/app/dist/samples apollo-mcp-server: - image: ghcr.io/apollographql/apollo-mcp-server:latest + image: ghcr.io/apollographql/apollo-mcp-server:${APOLLO_MCP_SERVER_VERSION:-v1.7.0} ports: - - "3000:8000" + - "3000:3000" volumes: - ./mcp-config.yaml:/mcp-config.yaml - mcp-shared:/mcp-data:ro @@ -28,8 +30,8 @@ services: environment: - APOLLO_GRAPH_REF=local@main - MCP_LOG_LEVEL=${MCP_LOG_LEVEL:-info} - - MCP_LOG_PARAMETERS=${MCP_LOG_PARAMETERS:-false} - - MCP_LOG_RESPONSES=${MCP_LOG_RESPONSES:-false} + # Note: MCP_LOG_PARAMETERS and MCP_LOG_RESPONSES are deprecated and not supported by apollo-mcp-server v1.7.0+ + # Detailed logging is handled by the zabbix-graphql-api service via the VERBOSITY variable. depends_on: schema-gen: condition: service_completed_successfully diff --git a/docs/howtos/mcp.md b/docs/howtos/mcp.md index 1c3752f..7124f08 100644 --- a/docs/howtos/mcp.md +++ b/docs/howtos/mcp.md @@ -13,7 +13,7 @@ By leveraging GraphQL, the API provides a strongly-typed and introspectable inte You can start both the Zabbix GraphQL API and the Apollo MCP Server using Docker Compose. This setup uses a local `mcp-config.yaml` and a generated `schema.graphql`. -- **Prerequisites**: Ensure you have a `.env` file with the required Zabbix connection details. +- **Prerequisites**: Ensure you have a `.env` file with the required Zabbix connection details and the `APOLLO_MCP_SERVER_VERSION` variable (minimum recommended and tested with: `v1.7.0`). - **Prepare Operations**: Create the operations directory if it doesn't exist: ```bash mkdir -p mcp/operations @@ -25,7 +25,7 @@ You can start both the Zabbix GraphQL API and the Apollo MCP Server using Docker This will: - Start the `zabbix-graphql-api` on `http://localhost:4001/graphql` (internal port 4000). -- Start the `apollo-mcp-server` on `http://localhost:3000/mcp` (mapped from internal port 8000), configured to connect to the local API via `mcp-config.yaml`. +- Start the `apollo-mcp-server` on `http://localhost:3000/mcp` (internal port 3000), configured to connect to the local API via `mcp-config.yaml`. ### Using with Claude Desktop @@ -50,7 +50,7 @@ To use this integration with Claude Desktop, add the following configuration to "-v", "/path/to/your/project/schema.graphql:/mcp-data/schema.graphql:ro", "-v", "/path/to/your/project/mcp/operations:/mcp/operations", "-e", "APOLLO_GRAPH_REF=local@main", - "ghcr.io/apollographql/apollo-mcp-server:latest", + "ghcr.io/apollographql/apollo-mcp-server:v1.7.0", "/mcp-config.yaml" ] } @@ -110,9 +110,13 @@ You can control the logging level and verbosity of both the GraphQL API and the - **GraphQL API Verbosity**: - `VERBOSITY=1`: Logs GraphQL operation names and parameters (variables). - `VERBOSITY=2`: Logs operation names, parameters, and the full response body. + - `VERBOSITY_PARAMETERS=1`: Specifically enable parameter logging (can be used independently of `VERBOSITY`). + - `VERBOSITY_RESPONSES=1`: Specifically enable response logging (can be used independently of `VERBOSITY`). - **MCP Server Logging**: - - `MCP_LOG_LEVEL`: Sets the log level for the Apollo MCP server (`debug`, `info`, `warn`, `error`). - - `MCP_LOG_PARAMETERS=true`: Enables logging of parameters in the MCP server. - - `MCP_LOG_RESPONSES=true`: Enables logging of responses in the MCP server. + - `MCP_LOG_LEVEL`: Sets the log level for the Apollo MCP server (`trace`, `debug`, `info`, `warn`, `error`). + - `debug`: Recommended for development as it provides a full configuration dump and detailed tool loading information. + - `trace`: extremely verbose, including periodic file system rescan events. + - `info`: Default level, provides a clean output while suppressing noisy internal library logs. + - *Note*: As of `apollo-mcp-server` v1.7.0, environment variable expansion in `mcp-config.yaml` requires the `env.` prefix (e.g. `${env.MCP_LOG_LEVEL:-info}`). Additionally, the previously used `MCP_LOG_PARAMETERS` and `MCP_LOG_RESPONSES` are **not supported** and will cause a startup failure if present in the config file. These have been replaced by API-level verbosity settings (`VERBOSITY_PARAMETERS` and `VERBOSITY_RESPONSES`). When running via Docker Compose, these can be set in your `.env` file. diff --git a/mcp-config.yaml b/mcp-config.yaml index 035c784..c900c32 100644 --- a/mcp-config.yaml +++ b/mcp-config.yaml @@ -19,6 +19,4 @@ introspection: search: enabled: true logging: - level: ${MCP_LOG_LEVEL:-info} - parameters: ${MCP_LOG_PARAMETERS:-false} - responses: ${MCP_LOG_RESPONSES:-false} + level: ${env.MCP_LOG_LEVEL:-info} diff --git a/src/api/start.ts b/src/api/start.ts index 7a4ac42..0dc5e19 100644 --- a/src/api/start.ts +++ b/src/api/start.ts @@ -63,7 +63,10 @@ async function startApolloServer() { // Request logging plugin { async requestDidStart(requestContext) { - if (Config.VERBOSITY > 0) { + const logParameters = Config.VERBOSITY > 0 || Config.VERBOSITY_PARAMETERS > 0; + const logResponses = Config.VERBOSITY > 1 || Config.VERBOSITY_RESPONSES > 0; + + if (logParameters) { logger.info(`GraphQL Request: ${requestContext.request.operationName || 'Unnamed Operation'}`); if (requestContext.request.variables) { logger.info(`Parameters: ${JSON.stringify(requestContext.request.variables, null, 2)}`); @@ -71,7 +74,7 @@ async function startApolloServer() { } return { async willSendResponse(requestContext) { - if (Config.VERBOSITY > 1) { + if (logResponses) { logger.info(`GraphQL Response for ${requestContext.request.operationName || 'Unnamed Operation'}:`); logger.info(JSON.stringify(requestContext.response.body, null, 2)); } diff --git a/src/common_utils.ts b/src/common_utils.ts index 0f9efdd..997027a 100644 --- a/src/common_utils.ts +++ b/src/common_utils.ts @@ -16,6 +16,8 @@ static readonly DRY_RUN = process.env.DRY_RUN static readonly ZABBIX_PERMISSION_TEMPLATE_GROUP_NAME_PREFIX = process.env.ZABBIX_PERMISSION_TEMPLATE_GROUP_NAME_PREFIX || "Permissions" static readonly LOG_LEVELS = process.env.LOG_LEVELS static readonly VERBOSITY = process.env.VERBOSITY ? parseInt(process.env.VERBOSITY) : 0 + static readonly VERBOSITY_PARAMETERS = process.env.VERBOSITY_PARAMETERS ? (parseInt(process.env.VERBOSITY_PARAMETERS) || (process.env.VERBOSITY_PARAMETERS === 'true' ? 1 : 0)) : 0 + static readonly VERBOSITY_RESPONSES = process.env.VERBOSITY_RESPONSES ? (parseInt(process.env.VERBOSITY_RESPONSES) || (process.env.VERBOSITY_RESPONSES === 'true' ? 1 : 0)) : 0 static readonly HOST_TYPE_FILTER_DEFAULT = process.env.HOST_TYPE_FILTER_DEFAULT; static readonly HOST_GROUP_FILTER_DEFAULT = process.env.HOST_GROUP_FILTER_DEFAULT; } \ No newline at end of file