How ibm/ibm-openpages-mcp-server works
Purpose and Entry Points
GRC MCP Server is a Python 3.12+ Model Context Protocol adapter between AI agents and IBM OpenPages GRC. It exposes OpenPages object operations, query execution, schemas, prompts, and health/metrics over either streamable HTTP or stdio. Runtime selection begins at main.py; local execution is implemented under src/app/mcp/local/runner.py, while remote HTTP serving is assembled through src/app/mcp/remote/server_instance.py.
Transport and MCP Dispatch
Remote clients call /mcp using JSON-RPC; local MCP clients communicate over process stdin/stdout. The transport boundary normalizes MCP requests before method routing, supporting tools, resources, prompts, initialization, and shutdown.
• src/app/mcp/mcp_server.py
• src/app/mcp/request_processor.py
• src/app/mcp/remote/http_router.py
Configuration-Driven Capability Model
Environment-backed settings establish connectivity, authentication mode, server behavior, and observability. The configured OpenPages object-type catalog determines the namespace, exposed tool mode (generic ontology-based, per-type, or both), resource field filtering, and schemas presented to agents. This is the primary boundary between deployment policy and runtime capabilities.
• src/app/config/settings.py
• src/app/config/object_types.json
• src/app/mcp/schema_builder.py
Tools and OpenPages Integration
Tool handlers translate MCP tool calls into object create/update, lookup/query, delete, and association operations. Generic and type-specific tool definitions are generated from configuration and validated against discovered schemas. The query path supports OpenPages SQL-like syntax independently of object CRUD tools. The OpenPages client is the external-service boundary for REST/API calls to the configured OpenPages instance.
• src/app/mcp/tool_handlers.py
• src/app/tools/generic_object_tools.py
• src/app/tools/query_tool.py
• src/app/core/openpages_client.py
Schema Resources and Agent Guidance
The server publishes ontology discovery resources: the object-type catalog, per-type schema, and query grammar; resource-compatible tools provide fallback access for limited MCP clients. Prompt handlers supply an agent usage guide. Schema construction filters and formats OpenPages metadata according to object-type configuration, so agents can discover valid fields before issuing mutations or queries.
• src/app/mcp/resource_handlers.py
• src/app/mcp/docs/documentation_resources.py
• src/app/mcp/prompt_handlers.py
• src/docs/MCP_SERVER_PROMPT.md
Authentication and Request Context
Authentication supports configured server credentials (basic or bearer variants including IBM IAM, MCSP, and CP4D) plus per-user credentials. In user mode, request authentication is resolved in priority order from HTTP bearer token, MCP context header, opaque ticket exchange, then configured API-key header; failures do not fall back to server credentials. Context extraction also carries user and view metadata into authorization and logging boundaries.
• src/app/auth/service.py
• src/app/auth/providers.py
• src/app/auth/token_exchange.py
• src/app/mcp/context.py
Cache, Synchronization, and Operations
Schema metadata is cached to reduce OpenPages calls and can be refreshed through RabbitMQ-driven invalidation/synchronization. Remote mode additionally exposes health, readiness/liveness/startup, cache statistics, and optional Prometheus metrics. Structured logs, OpenTelemetry tracing, and metrics instrument request paths. Container deployment uses Docker Compose, with optional NGINX and a separate Prometheus/Grafana/Jaeger/Loki monitoring stack.
• src/app/cache/schema_cache_manager.py
• src/app/cache/rabbitmq_client.py
• src/app/api/health.py
• src/app/observability/middleware.py
• docker-compose.yml
• monitoring/docker-compose.yml
Main entry points: http_router.py HTTP MCP router · request_processor.py Request processor · schema_builder.py Schema builder · generic_object_tools.py Generic object tools
Components 21
Runtime & Transport
- Runtime entry · Selects local stdio or remote HTTP mode.
main.py - Local stdio runner
src/app/mcp/local/runner.py - Remote server assembly
src/app/mcp/remote/server_instance.py - HTTP MCP router · Serves remote clients at /mcp.
src/app/mcp/remote/http_router.py - MCP server
src/app/mcp/mcp_server.py - Request processor · Normalizes requests and routes methods.
src/app/mcp/request_processor.py
Capabilities
- Settings & object catalog · Environment settings and configured object types define exposed capabilities.
src/app/config/settings.py - Object-type catalog
src/app/config/object_types.json - Schema builder · Filters OpenPages metadata into agent-visible schemas.
src/app/mcp/schema_builder.py - Tool handlers · Routes CRUD, association, lookup, and query calls.
src/app/mcp/tool_handlers.py - Generic object tools · Generates ontology-based and per-type tools.
src/app/tools/generic_object_tools.py - Query tool · Executes OpenPages SQL-like queries.
src/app/tools/query_tool.py - Schema resources · Publishes catalog, schemas, grammar, and fallback tools.
src/app/mcp/resource_handlers.py - Agent usage prompt
src/app/mcp/prompt_handlers.py
OpenPages Integration
- OpenPages client · REST/API boundary to the configured OpenPages instance.
src/app/core/openpages_client.py
Authentication
- Authentication service · Resolves server or per-user credentials without unsafe fallback.
src/app/auth/service.py - Request context · Carries user and view metadata into request boundaries.
src/app/mcp/context.py
Operations
- Schema cache manager
src/app/cache/schema_cache_manager.py - RabbitMQ synchronization · Refreshes cached schema metadata.
src/app/cache/rabbitmq_client.py - Health & metrics · Provides health checks, cache statistics, and optional metrics.
src/app/api/health.py - Observability middleware · Instruments requests with logs, traces, and metrics.
src/app/observability/middleware.py
Connections 25
- Runtime entry → Local stdio runner: local mode
- Runtime entry → Remote server assembly: remote mode
- Remote server assembly → HTTP MCP router: mounts
- Local stdio runner → MCP server: stdio
- HTTP MCP router → MCP server: JSON-RPC
- MCP server → Request processor: dispatches
- Request processor → Tool handlers: tool calls
- Request processor → Schema resources: resource calls
- Request processor → Agent usage prompt: prompt calls
- Settings & object catalog → Object-type catalog: loads
- Object-type catalog → Schema builder: filters metadata
- Settings & object catalog → Generic object tools: selects tool mode
- Schema builder → Generic object tools: validates schemas
- Tool handlers → Generic object tools: object operations
- Tool handlers → Query tool: queries
- Generic object tools → OpenPages client: CRUD & associations
- Query tool → OpenPages client: executes query
- Schema resources → Schema builder: publishes schemas
- Schema builder → Schema cache manager: caches metadata
- RabbitMQ synchronization → Schema cache manager: invalidates
- HTTP MCP router → Authentication service: authenticates
- Authentication service → Request context: establishes identity
- Authentication service → OpenPages client: supplies credentials
- Remote server assembly → Health & metrics: exposes operations
- HTTP MCP router → Observability middleware: instruments