Skip to content

Add Model Context Protocol (MCP) server for Allure Docker Service - #292

Open
matanbaruch wants to merge 2 commits into
fescobar:masterfrom
matanbaruch:feat/mcp-server
Open

Add Model Context Protocol (MCP) server for Allure Docker Service#292
matanbaruch wants to merge 2 commits into
fescobar:masterfrom
matanbaruch:feat/mcp-server

Conversation

@matanbaruch

Copy link
Copy Markdown

Summary

Adds a Model Context Protocol (MCP) server (allure-docker-mcp/) that exposes a running allure-docker-service instance as tools an LLM agent can call — from Claude Desktop, Claude Code, or any MCP host. It lets an assistant manage projects, send results, and generate/export Allure reports through natural language, e.g.:

"Create a project regression-suite, send the results from ./allure-results, generate a report, and give me the URL."

The server is a client of the existing REST API — it does not modify the service.

Closes #291

What's included

  • 16 tools, one per REST endpoint: get_version, get_config, list_projects, get_project, search_projects, create_project, delete_project, send_results, send_results_from_directory, generate_report, get_latest_report, clean_results, clean_history, export_report, export_emailable_report, render_emailable_report.
  • Security mode support: JWT-cookie login + X-CSRF-TOKEN on mutating requests, with a single 401 re-auth retry.
  • stdio, streamable-http, and sse transports; Dockerfile; pyproject.toml; .env.example.
  • Unit tests (respx-mocked) and a README with client-config examples.

Design / hardening notes

A few items came out of review + testing against a real instance:

  • Export confinementexport_* tools write only inside ALLURE_OUTPUT_DIR and reject path escapes (no arbitrary-file overwrite from an agent-chosen path).
  • Symlinks skipped in send_results_from_directory so it can't be pointed at a symlink resolving outside the directory.
  • Non-blocking tools — tool bodies run off the event loop (anyio.to_thread) so the HTTP transports stay responsive; client auth is lock-guarded for concurrent callers.
  • HTTP bind fixmain() applies FASTMCP_HOST/FASTMCP_PORT to the live settings (FastMCP otherwise ignores them, so streamable-http never bound the requested port). Verified the server now binds the requested host/port.
  • Clear endpoint errors — if ALLURE_ENDPOINT points at the web UI instead of the API base, tools return an actionable error instead of opaque HTML.

Testing

  • pytest — 24 tests pass (client auth/CSRF/401-retry, endpoint mapping, path confinement, symlink skip, transport config).
  • Live integration against frankescobar/allure-docker-service (v2.38.1), driven through the real MCP tool dispatch:
    • non-secure: full lifecycle create → send → generate → latest-report → export → delete.
    • security mode (SECURITY_ENABLED=1): same lifecycle, exercising login + CSRF.
    • export confinement rejecting an out-of-root path; streamable-http real bind test on a non-default port.

Notes for maintainers

  • Scoped entirely to a new allure-docker-mcp/ directory; no changes to allure-docker-api or the image.
  • Requires Python 3.10+. Apache-2.0, same as the project.
  • The HTTP transports are unauthenticated (documented in the package README) — intended to run locally or behind an authenticating proxy; stdio has no network surface.

🤖 Generated with Claude Code

matanbaruch and others added 2 commits June 10, 2026 15:41
Adds a self-contained `allure-docker-mcp/` package that exposes a running
allure-docker-service instance as MCP tools, so LLM agents (Claude Desktop,
Claude Code, any MCP host) can manage projects, send results, and
generate/export Allure reports through natural-language tool calls.

The server is a client of the existing REST API — it does not modify the
service. Highlights:

- 16 tools, one per REST endpoint (version, config, projects CRUD + search,
  send-results, generate-report, latest-report, clean-results/history,
  export report/emailable, render emailable).
- Transparent support for the optional security mode: JWT cookie login +
  X-CSRF-TOKEN on mutating requests, with a single 401 re-auth retry.
- stdio, streamable-http, and sse transports; Dockerfile; pyproject; tests.

Hardening (from review + live testing against a real instance):
- Export tools confine writes to ALLURE_OUTPUT_DIR and reject path escapes.
- send_results_from_directory skips symlinks.
- Tool bodies run off the event loop (anyio.to_thread) so HTTP transports
  stay responsive; client auth is guarded by a lock for concurrent callers.
- main() applies FASTMCP_HOST/FASTMCP_PORT to the live settings (FastMCP
  otherwise ignores them, so streamable-http never bound the requested port).
- request_json fails loudly when ALLURE_ENDPOINT points at the web UI.

Closes fescobar#291

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds .github/workflows/allure-mcp.yml so the MCP server image is published
alongside the service:

- pull requests touching allure-docker-mcp/ -> build only (validation);
- push to master/main (e.g. when this is merged) -> publish :edge;
- release tags v* -> publish <version> + :latest.

Publishing reuses the repo's existing DOCKER_HUB_USER / DOCKER_HUB_PASS and is
guarded to the upstream repository, so it never runs from a fork. Documents the
prebuilt frankescobar/allure-docker-mcp image in the package README.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Model Context Protocol (MCP) server for Allure Docker Service

1 participant