No description
  • Kotlin 94.3%
  • Shell 3.6%
  • Go Template 1.2%
  • Dockerfile 0.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nikolay Groznykh 4b63bc4eb1 Release v0.4.0.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-13 16:45:46 +03:00
.github/workflows ci: fix tool install steps (PATH applies only to later steps) 2026-09-24 13:00:46 +03:00
charts/warchi-mcp Release v0.4.0. 2026-10-13 16:45:46 +03:00
docs Document hide-in-tree and update_model tools. 2026-10-13 16:34:15 +03:00
gradle Refactor build tooling and add GitHub Actions CI. (#1) 2026-09-01 21:32:28 +03:00
scripts Release v0.3.4. 2026-09-24 12:36:28 +03:00
src Add LMRU hide-in-tree and update_model MCP tools. 2026-10-13 15:12:52 +03:00
.env.example feat: initial wArchi MCP server with Helm deploy 2026-08-04 11:07:16 +03:00
.gitignore feat: initial wArchi MCP server with Helm deploy 2026-08-04 11:07:16 +03:00
AGENTS.md Switch license to MIT 2026-09-24 12:27:12 +03:00
build.gradle.kts Release v0.4.0. 2026-10-13 16:45:46 +03:00
CODE_OF_CONDUCT.md feat: initial wArchi MCP server with Helm deploy 2026-08-04 11:07:16 +03:00
CODE_OF_CONDUCT.ru.md feat: initial wArchi MCP server with Helm deploy 2026-08-04 11:07:16 +03:00
CONTRIBUTING.md docs: add landscape happy-path recipe and sync tool lists (#2) 2026-09-02 09:38:42 +03:00
CONTRIBUTING.ru.md docs: add landscape happy-path recipe and sync tool lists (#2) 2026-09-02 09:38:42 +03:00
Dockerfile feat: initial wArchi MCP server with Helm deploy 2026-08-04 11:07:16 +03:00
gradlew feat: initial wArchi MCP server with Helm deploy 2026-08-04 11:07:16 +03:00
gradlew.bat feat: initial wArchi MCP server with Helm deploy 2026-08-04 11:07:16 +03:00
LICENSE Switch license to MIT 2026-09-24 12:27:12 +03:00
LICENSE.ru.md Switch license to MIT 2026-09-24 12:27:12 +03:00
README.md Document hide-in-tree and update_model tools. 2026-10-13 16:34:15 +03:00
README.ru.md Document hide-in-tree and update_model tools. 2026-10-13 16:34:15 +03:00
SECURITY.md docs: API key mode and per-model grants 2026-08-06 13:10:18 +03:00
SECURITY.ru.md docs: API key mode and per-model grants 2026-08-06 13:10:18 +03:00
settings.gradle.kts Refactor build tooling and add GitHub Actions CI. (#1) 2026-09-01 21:32:28 +03:00

warchi-mcp

Remote Model Context Protocol server for wArchi. It exposes architectural models, diagrams, nodes, and links as MCP tools over Streamable HTTP, authenticated with personal API keys created in the wArchi profile.

Русская версия: README.ru.md

The project is built with Kotlin + Spring Boot and Spring AI MCP. It has no database of its own: API keys and authorization live in arepos-server; this service only exchanges keys for short-lived JWTs and proxies curated tool calls to the REST API.

Features

  • Remote MCP server (Streamable HTTP) for Cursor and other MCP clients
  • Personal API key auth (warchi_ak_…) with mode=all (global scopes) or mode=grants (per-model read/write)
  • One key per agent — mixed model rights via grants, not multiple secrets
  • Short-lived JWT exchange (tokenType=mcp_access) — keys are not sent on every REST call
  • Curated read/write tools for models, diagrams, nodes, links, and notation summaries
  • Structured tool errors for LOCKED_BY_OTHER, BATCH_SAVE_CONFLICT, missing_scope, model_not_allowed
  • Health endpoint via Spring Actuator
  • Dockerfile for container deployment

Tech Stack

  • Kotlin 2.2.x
  • Spring Boot 3.5.x
  • Spring AI 1.1.x (spring-ai-starter-mcp-server-webmvc)
  • JDK 24/25
  • Gradle (Kotlin DSL)

Project Structure

src/main/kotlin/ru/kavader/warchimcp/
  auth/       # API key request context + filter
  client/     # arepos RestClient, exchange, JWT cache
  config/     # configuration properties
  tools/      # MCP tool definitions (read/write)

src/main/resources/
  application.yaml

docs/         # auth, tools, landscape recipe documentation

Requirements

  • JDK 24 or 25
  • Running arepos-server with API keys support (migration 050-api-keys or later)
  • Docker (optional, for image build)

Local Development

1) Configure environment

Defaults are in src/main/resources/application.yaml. See also .env.example.

Variable Default Description
AREPOS_BASE_URL http://localhost:8080 Base URL of arepos-server
PORT 8090 HTTP listen port
AREPOS_CONNECT_TIMEOUT 5s Connect timeout to arepos
AREPOS_READ_TIMEOUT 60s Read timeout to arepos

2) Build and run

export AREPOS_BASE_URL=http://localhost:8080
./gradlew build
./gradlew bootRun

3) Run tests

./gradlew test

Build Commands

./gradlew build       # full build + tests
./gradlew test        # unit tests
./gradlew bootJar     # fat JAR
./gradlew bootRun     # local run
docker build -t warchi-mcp:0.2.0 .

MCP Endpoint

  • Protocol: Streamable HTTP (spring.ai.mcp.server.protocol=STREAMABLE)
  • Default path: /mcp
  • Health: GET /actuator/health

Client configuration (Cursor example)

{
  "mcpServers": {
    "warchi": {
      "url": "https://mcp.warchi.ru/mcp",
      "headers": {
        "Authorization": "Bearer warchi_ak_YOUR_KEY"
      }
    }
  }
}

Create the key in wArchi → Profile → API keys. The plaintext secret is shown once at creation.

Also accepted: X-Api-Key: warchi_ak_….

Auth Flow

  1. User creates an API key in wArchi (mode=all or mode=grants with per-model scopes).
  2. MCP client sends the key to warchi-mcp.
  3. Server calls POST /api/v1/auth/api-keys/exchange on arepos.
  4. Tools call arepos /api/v1/* with the short-lived JWT.
  5. Revoking the key in Profile immediately blocks further exchanges.

Details: docs/auth.md.

Tools (v1)

Read (models:read): search_catalog, search_model, search_notation, list_models, get_model, list_diagrams, get_diagram, list_nodes, get_node, list_links, get_link, list_notations, get_notation_summary, list_wiki, get_wiki, get_node_type_hide_in_tree

Write (models:write): create_node, ensure_node, update_node, delete_node, create_link, ensure_link, update_link, delete_link, create_diagram, ensure_diagram, add_diagram_instances, update_diagram, update_model, batch_save_model, create_wiki, ensure_wiki, update_wiki, ensure_custom_properties, set_node_type_hide_in_tree

Tool catalogue: docs/tools.md.
Landscape happy-path: docs/landscape-recipe.md.

Kubernetes (local / cluster)

# lint
./scripts/helmCheck.sh

# build image + helm upgrade into namespace arch
SKIP_CONFIRM=true ./scripts/deploy.sh

# point at arepos in-cluster (default)
# AREPOS_BASE_URL=http://arepos-server:8080 SKIP_CONFIRM=true ./scripts/deploy.sh

Chart: charts/warchi-mcp/. After deploy:

kubectl -n arch port-forward svc/warchi-mcp 8090:8090
# MCP: http://127.0.0.1:8090/mcp

Deployment

Typical production layout:

  1. Deploy arepos-server with API keys enabled.
  2. Deploy wArchi with Profile → API keys UI.
  3. Run warchi-mcp with AREPOS_BASE_URL pointing at arepos.
  4. Terminate TLS at reverse proxy / ingress (https://mcp.example.com → container :8090).
  5. Forward Authorization / X-Api-Key headers to the app.
  6. Never log API keys or JWTs.

Docker

docker build -t warchi-mcp:0.2.0 .
docker run --rm -p 8090:8090 \
  -e AREPOS_BASE_URL=https://api.example.com \
  warchi-mcp:0.2.0

Smoke checklist

  • POST /api/v1/auth/api-keys/exchange works against arepos with a test key
  • MCP client can call list_models
  • Revoked key → exchange returns 401
  • Write without models:write on the target model → missing_scope
  • mode=grants key cannot access non-granted models → model_not_allowed

Open Source Guide

Contributing

Please read CONTRIBUTING.md before opening a pull request.

Security

Please read SECURITY.md for reporting vulnerabilities.

License

This project is licensed under the MIT License.

Previously it was dual-licensed under AGPL-3.0-or-later with a commercial option; since 2026-09-24 the project is MIT.

See:

  • LICENSE
  • Licensing questions: nikolay@groznykh.ru