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.
This commit is contained in:
parent
1b9c1f2423
commit
8f00082c6a
6 changed files with 30 additions and 18 deletions
|
|
@ -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 |
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue