Skip to main content
Glama
OpsContext MCP Server

OpsContext MCP Server

by peymanpro
README.md
<p align="center">
  <a href="public/opscontext-flow.svg">
    <img src="public/opscontext-flow.gif" alt="Animated end-to-end architecture of OpsContext: MCP clients, transports, capabilities, public data providers, evidence normalization and incident brief." width="100%" />
  </a>
</p>

# OpsContext — Enterprise Operations Intelligence

[![CI](https://github.com/peymanpro/MCP-Ops-Intelligence-Platform/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/peymanpro/MCP-Ops-Intelligence-Platform/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

An evidence-first operations intelligence platform, beginning with an MCP server for operational incident triage over local stdio and stateless Streamable HTTP.

OpsContext combines public service-status information, GitHub repository activity, and GitHub Actions workflow outcomes, then exposes normalized operational evidence to MCP-compatible hosts through a small, read-only interface.

**Project status:** Active engineering preview. The MCP Server, reusable MCP Client, NestJS Host security baseline, four tools, two resources, one prompt, and stateless HTTP deployment adapter are implemented. The Host is not yet independently deployed; LLM incident analysis and the full management dashboard remain planned.


## Monorepo layout

The repository is organized as a pnpm workspace. The MCP Server and reusable MCP Client are implemented. A NestJS Host security baseline is present; its separate production deployment and end-to-end Host-to-Server verification are still in progress. The React Dashboard directory is currently a placeholder, not a completed application.

```text
apps/
  mcp-host/                  # NestJS API boundary, auth, authorization, audit and MCP orchestration
  dashboard/                 # Planned React operations dashboard
packages/
  mcp-client/                # Reusable official MCP SDK client wrapper
servers/
  opscontext-mcp-server/     # Existing operational evidence MCP server
api/                         # Vercel Streamable HTTP deployment adapter
public/                      # Interactive demo assets
docs/decisions/              # Architecture Decision Records
```

The root package coordinates workspace commands; the MCP Server owns its source, tests, configuration, and runbooks. The Vercel adapter remains at the repository root because it is a deployment entrypoint, not a separate business-logic layer.

## Why OpsContext?

During an incident, engineers often need to correlate information scattered across service-status pages and source repositories. OpsContext makes that context available to an AI application through the Model Context Protocol (MCP).

It does **not** diagnose an incident or establish causation. It returns traceable evidence, timestamps, source availability, and explicit limitations so an engineer or AI host can investigate responsibly.

## Live demo

The public demo uses a configured GitHub Platform example and public upstream data; no API keys are required.

- **Interactive demo:** [opscontext-mcp-server.vercel.app](https://opscontext-mcp-server.vercel.app/)
- **Remote MCP endpoint:** [https://opscontext-mcp-server.vercel.app/api/mcp](https://opscontext-mcp-server.vercel.app/api/mcp)
- **Transport:** stateless Streamable HTTP, compatible with MCP clients that support HTTP transport.

To connect an MCP client, use the deployed endpoint as its remote server URL:

```json
{
  "mcpServers": {
    "opscontext": {
      "url": "https://opscontext-mcp-server.vercel.app/api/mcp"
    }
  }
}
```

The endpoint is a public, read-only demonstration. It uses the checked-in demo registry, exposes no arbitrary provider URL input, and applies Host/Origin checks plus a best-effort per-instance request limit. That in-memory limit is not a distributed quota or an authentication mechanism. The NestJS Host is a separate trust boundary; its API-key and tool-allowlist guards do not automatically protect this public demo endpoint.

## MCP capabilities

### Tools

| Tool | Purpose |
| --- | --- |
| `get_service_health` | Read the configured service's public Statuspage status, components, and unresolved incidents. |
| `get_recent_changes` | Read recent published GitHub releases and commits for the configured repository. |
| `get_recent_workflow_runs` | Read recent GitHub Actions workflow run statuses and conclusions for the configured repository. |
| `build_incident_brief` | Combine Statuspage health, GitHub releases and commits, and GitHub Actions runs into one time-bounded evidence brief. |

All tools are read-only and accept a configured `serviceId`, never an arbitrary URL.

### Resources

| URI | Purpose |
| --- | --- |
| `opscontext://catalog/services` | Enumerate configured services and available providers. |
| `opscontext://runbooks/{serviceId}` | Read the runbook associated with a configured service. |

### Prompt

| Prompt | Purpose |
| --- | --- |
| `incident_triage` | Guide the host model through an evidence-based investigation. |

The prompt does not execute tools itself. The MCP host and model decide when to read resources and call tools.

## Design principles

1. **Evidence before inference.** Every factual signal points to a source.
2. **Temporal proximity is not causation.** A recent commit is not proof of deployment or incident cause.
3. **Partial results are useful.** A provider failure must not discard evidence successfully retrieved from another provider.
4. **Bounded inputs.** Model-supplied identifiers are validated and resolved through an explicit service registry.
5. **Explicit provenance.** Provider event time and OpsContext observation time are represented separately.
6. **Protocol-first.** MCP capabilities are separate from transport, application, and provider logic.
7. **Read-only by default.** The server does not deploy code or modify external systems.

## Architecture

```text
MCP Host / Interactive Demo
       |                         |
       | MCP over stdio          | Streamable HTTP
       v                         v
Local stdio entrypoint      Vercel Function (/api/mcp)
       |                         |
       +-----------+-------------+
                   |
              MCP Server
       |-- Tools   |-- Resources   |-- Prompts
                   |
          Application Service
       |-- Service health
       |-- Recent changes
       |-- Incident brief (Statuspage + GitHub + Actions)
                   |
             Domain contracts
       |-- Service catalog   |-- Evidence   |-- Provider state
                   |
             Provider adapters
       |-- Public Statuspage API
       |-- GitHub REST API (releases, commits, Actions runs)
```

The application composition is shared by both transports. The remote HTTP handler creates a fresh MCP server for each request and uses stateless operation, so it does not depend on in-memory session affinity across serverless invocations.

## Technology

- TypeScript
- Node.js 20+
- Official MCP TypeScript SDK v2
- Zod v4
- pnpm
- Vitest
- Vercel Node.js Functions

The implementation follows the official [MCP TypeScript SDK v2 documentation](https://ts.sdk.modelcontextprotocol.io/v2/).

## Data sources

- [Atlassian Statuspage API](https://developer.status.atlassian.com/api) — public status summaries, component states, and unresolved incidents.
- [GitHub REST API](https://docs.github.com/en/rest) — public repository releases, commits, and Actions workflow runs.

The initial implementation uses public read-only endpoints. Private Statuspage pages and authenticated management APIs are out of scope.

## Local setup

Requirements: Node.js 20 or newer and pnpm 10.

1. Install dependencies:

   `pnpm install`

2. Choose a service registry:

   **Run the public demo** (no API keys required):

   `cp servers/opscontext-mcp-server/config/services.demo.json servers/opscontext-mcp-server/config/services.json`

   The demo reads GitHub's public Statuspage feed and the public `github/docs` repository. It includes a dedicated runbook that explains the limits of this example.

   **Configure your own service:**

   `cp servers/opscontext-mcp-server/config/services.example.json servers/opscontext-mcp-server/config/services.json`

   Edit `servers/opscontext-mcp-server/config/services.json` and set a public Statuspage base URL and a public GitHub repository for each service. Statuspage base URLs must be HTTPS origins. The model never supplies these URLs.

3. Start the local stdio server:

   `pnpm dev`

For a compiled run:

- `pnpm build`
- `pnpm start`

The stdio transport reserves stdout for MCP messages. Startup diagnostics are written to stderr.

### Try it with MCP Inspector

With the demo registry copied to `servers/opscontext-mcp-server/config/services.json`, run:

```bash
pnpm inspect
```

This launches the official MCP Inspector, starts OpsContext over stdio, and opens a local browser UI. Select a tool and use `github-platform` as its `serviceId` to inspect the public demo data.

The Inspector currently requires Node.js 22.23.4+, 24.22.1+, or 26.12.1+. The OpsContext server itself supports Node.js 20+ when run without the Inspector.

### Run the Vercel app locally

Install or invoke the Vercel CLI, link the repository to your Vercel project, then run:

```bash
pnpm dlx vercel dev
```

This serves the browser demo from `public/` and the MCP HTTP handler at `/api/mcp`.

### Environment variables

| Variable | Description |
| --- | --- |
| `OPSCONTEXT_CONFIG_PATH` | Optional path to the service registry JSON file. |
| `OPSCONTEXT_RUNBOOKS_PATH` | Optional path to the runbooks directory. |
| `OPSCONTEXT_ALLOWED_HOSTS` | Optional comma-separated host allowlist for the remote MCP endpoint; Vercel deployment hostnames are included automatically. |

The Vercel Function defaults to the public demo registry. Use operator-controlled configuration paths for a custom deployment.

## Development commands

- `pnpm typecheck` — TypeScript validation, including the Vercel API entrypoint.
- `pnpm test` — unit, stdio protocol, and remote HTTP protocol tests.
- `pnpm build` — compile the MCP server into `servers/opscontext-mcp-server/dist/`.
- `pnpm check` — run typecheck, tests, and build.
- `pnpm inspect` — launch the MCP Inspector with the local stdio server.

## Security boundaries

- No arbitrary URL input from tools.
- Provider URLs are derived only from operator-controlled configuration.
- No write operations against providers.
- Public data sources do not require credentials.
- Provider-returned text is untrusted data and must never be treated as instructions.
- Runbook reads are restricted to configured Markdown filenames and checked against the resolved runbooks directory, including symlinks.
- Remote MCP requests are restricted to configured Host/Origin values and bounded request size.
- The demo includes a best-effort per-instance burst limit; use a distributed rate limiter and authentication before adapting this public sample for a production multi-tenant service.

## Evidence interpretation

The incident brief queries Statuspage health, repository changes, and workflow runs concurrently for the same time window. Its `sourceStatus` reports each provider independently (`statuspage`, `github`, and `githubActions`). `dataCompleteness` is `complete` only when all three providers are available, `partial` when one or more sources are unavailable or partial, and `unavailable` when all three are unavailable.

Workflow runs are exposed in `workflowRuns` and also represented as evidence items (`source: github_actions`, `kind: workflow_run`) with corresponding `workflow_run` signals. Each signal references evidence IDs so a host can trace every finding to its source.

Each evidence item records:

- `eventAt` — the provider-reported event timestamp.
- `observedAt` — when OpsContext received the information.
- `source` and `kind` — where the information came from and what it describes.
- `url` — a source link for verification.

A repository commit does not prove that the commit was deployed. A successful CI workflow run is not proof of deployment, and a failed workflow run is not proof that users are affected. Timestamp proximity does not establish causation. OpsContext reports evidence and limitations; it does not invent a root cause.

## License

MIT