
Evolith Architecture Governance
io.github.beyondnetcodePublished by GitHub account beyondnetcodev1.3.3Updated Oct 24, 2026
Executable architecture governance: an unevaluated rule is reported as a failure, never a pass.
Overview
Lets an assistant validate repositories against Evolith architecture governance rules, inspect topologies, patterns, ADRs and SDLC gates, and apply approved…
- What you can do
- Exposes 55 tools, 12+ resources and 8 prompts for architecture governance. Read tools validate a repository against GOV, INH, ACL and OCB rules, detect architecture drift, evaluate SDLC phase gates, list topologies, patterns and ADRs, and search the architecture knowledge corpus. Around 20 mutative tools write files: scaffolding, ADR creation, MoSCoW matrices, agent install/upgrade/remove, satellite creation on GitHub, config changes, upgrades and automatic fixes.
- When to use it
- Use it when an assistant should check a codebase against Evolith governance and architecture rules, review SDLC phase readiness, or scaffold and upgrade Evolith satellites. It fits teams already using the Evolith Core and its rulesets rather than general-purpose code review.
- Requirements
- Local Node.js process run via npx from the npm package @beyondnet/evolith-mcp, stdio by default. An HTTP transport is available with TRANSPORT, PORT and MCP_HTTP_HOST. Optional settings include EVOLITH_API_KEY, JWT_SECRET, REDIS_URL for the resource cache, and OpenTelemetry variables. No credentials are declared in the manifest.
Installation
In SourceWeft
- Open Evolith Architecture Governance in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
@beyondnet/evolith-mcp
Evolith MCP Gateway — First-Class Model Context Protocol Server
Bilingual navigation: Versión en Español
Decouples the MCP server from the CLI. It is a first-class product that exposes the MCP tools as a Gateway talking to @beyondnet/evolith-core (the reusable business-logic layer), instead of shelling out to CLI subprocesses.
Table of contents
- Architecture diagram
- Transports
- Installation and configuration
- Authentication
- Available tools (55)
- Available resources (12 + dynamic)
- Available prompts (8)
- Mutative operations
- Internal architecture
- Agent use cases
- Client configuration
- SmartCLI integration
- Extension guide
- Observability
- Good practices
- Troubleshooting
Architecture diagram
Transports
The default port is
3000(main.ts: envPORTor--port, falling back to3000). The49100used in the examples is an arbitrary value, not the default.Logs are always written to stderr (Pino), because stdout is reserved for the JSON-RPC stream of the stdio transport.
Installation and configuration
Installation
Usage
Environment variables
The binary also accepts the flags
--transport/-t,--port/-p,--api-keyand--allow-no-auth(HTTP only), as well as theevolith-mcp versionsubcommand.
Authentication
stdio transport
No request authentication is required: the process is local, single-user, and the agent runs it directly. The transport establishes an explicit local session principal (id=local-stdio-session, role=local-session, roles=[local-session, operator], scopes=[read, write]) that is recorded in the audit trail of every call (GT-572).
This is not an authorization bypass: ABAC (native + OPA) is still evaluated on every tools/call with that identity, the deploy tools are still denied in production (they require architect), and every mutative tool still demands the HITL gate { apply, approvalToken }. --allow-no-auth / EVOLITH_MCP_ALLOW_NO_AUTH do not apply to stdio (there is no request authentication to skip); if they are passed together with --transport stdio, the server warns about it on stderr at startup.
HTTP transport
In production (NODE_ENV=production), authentication is mandatory: validateAuth() ignores EVOLITH_MCP_ALLOW_NO_AUTH and rejects every request without a valid credential (401). The value of EVOLITH_API_KEY is an arbitrary secret (any string; no prefix required) compared by equality. It is accepted in either of these two headers:
/health is public (a liveness probe) and requires no credential.
When an OAuth issuer is configured, /.well-known/oauth-protected-resource (and the path-inserted /.well-known/oauth-protected-resource/<path>) is also public: it is the RFC 9728 document an unauthenticated client reads to discover which authorization server to go to, so gating it behind the credential it is trying to obtain would make discovery impossible. It carries no MCP data — only the issuer, the resource identifier and the scope names. A 401 from a protected resource additionally carries a WWW-Authenticate: Bearer resource_metadata="…", scope="…" challenge, which is the discovery mechanism MCP clients must prefer. Without an issuer the endpoint returns 404 rather than publishing a document with an empty authorization_servers.
Client registration never flows through this server: it is a resource server, and the 2026-07-28 revision has clients obtain a client_id from a Client ID Metadata Document (or pre-registration) at the authorization server. Dynamic Client Registration is deprecated and is not implemented here; protected-resource-metadata.spec.ts fails the build if a registration endpoint is ever introduced.
Protocol revisions
The server answers two protocol revisions on the same HTTP endpoint:
Both revisions run through one dispatch, so ABAC (native + OPA), the scope gate, the approval gate and the audit trail are the same code on either path. The 2025-11-25 path is retained because the published SDK still declares it as its latest revision; it is not an alternative design.
On the 2026-07-28 path a state-changing tool answers resultType: "input_required" with an elicitation/create request and an opaque requestState. The client gathers the human's approval and retries the original call — new JSON-RPC id, same parameters, plus requestState and inputResponses. The requestState is sealed with AES-256-GCM and bound to the principal, the tenant, the originating call and a short TTL, so it cannot be replayed across users, calls or time. A caller that already holds an approval may still pass { apply: true, approvalToken } inline and skip the round trip, exactly as on the 2025-11-25 path.
The
ApiKeyProvisioningService(below) is an advanced and optional mechanism for issuing keys with anevk_prefix, a SHA-256 hash and a TTL. It is independent of the startupEVOLITH_API_KEYdescribed here.
API key provisioning
The ApiKeyProvisioningService manages the lifecycle of the keys:
Keys carry scopes: read, write, admin. They are bound to a tenant.
ABAC model
The AbacEvaluator controls which tools each user may invoke, based on their roles:
ABAC codes:
Tool classification (substring heuristic). The internal role sets are DEVELOPER = {developer, qa}, OPERATOR = {operator, sre} and ARCHITECT = {architect, admin}. The read/write/deploy classification of each tool is a heuristic over its name (abac-evaluator.ts): it counts as read if the name contains read/list/get (or does not begin with evolith-); as write if it contains write/replace/run/fix/advance; as deploy if it contains deploy/publish/merge. Because of that heuristic, evolith-phase-advance is classified as write (the advance substring), even though it only proposes the transition. A tool that fits no group is rejected with ABAC-03.
Authentication precedence (HTTP). The guard (mcp-server-auth.ts) evaluates the API key first: if the Authorization: Bearer <token> or the x-api-key header matches EVOLITH_API_KEY, it grants an admin context (role admin, every tool allowed). Only if the key does not match and JWT_SECRET is defined does it try to validate the Bearer as a JWT HS256; in that case the roles in the JWT payload are what feed ABAC. /health is public. In production, auth is mandatory (it ignores EVOLITH_MCP_ALLOW_NO_AUTH).
Available tools (55)
The tools are obtained at runtime via tools/list. All of them return raw data, which the Gateway wraps in a SuccessEnvelope or an ErrorEnvelope.
The count is derived from the registration sources by the generated Product Surface Inventory (
tools/*.ts,resources.service.ts,prompts.service.ts); the tables below name every tool, grouped by area. When they disagree,tools/listand the inventory win.
Validation
evolith-composable-validate schema:
Modes are enabled by combining fields. Several of them can be used in a single call.
Evaluation (ADR-0101)
Architecture
Patterns
Topologies
evolith-topology-list schema:
evolith-topology-get schema:
Available topologies: modular-monolith, distributed-modules, microservices, serverless, edge-computing, event-driven, data-mesh, agentic-ai
SDLC gates
¹
evolith-phase-advanceonly proposes the transition — it does not execute it. Executing it is the responsibility of the operator or of the Tracker.
SDLC
MoSCoW
² The three MoSCoW tools that write to
.evolith/moscow/{phase}.json(create,update,remove) declaremutative: trueinmoscow.tools.tssince 2026-07-11, so the dispatcher demandsapply/approvalTokenfor them;load,list,validateandreportare reads.
ADRs
Agents
Satellites
Scaffolding and initialization
Upgrades
Knowledge
Remediation
Configuration
Observability
CLI parity reads (GT-682)
Three CLI commands that had no MCP counterpart, ported as read-only tools over the CLI's own readers in core-domain. Their write modes (history --clear/--replay, profile create/switch/delete, standards --init/--validate/--export) stay on the CLI.
Available resources (12 + dynamic)
Resources are obtained via resources/list and read via resources/read.
Static resources (resources/list)
Dynamic URIs (reachable via resources/read)
Available prompts (8)
Prompts are obtained via prompts/list and invoked via prompts/get.
Mutative operations
Tools marked as mutative (mutative: true) require explicit approval in order to prevent accidental changes. The dispatcher (mcp-tool-dispatch.ts:137) rejects the call with FORBIDDEN unless the request carries both fields:
applymust be exactlytrue.approvalTokenmust be a non-empty string. The server never logs it in the clear: it reduces it to asha256:…fingerprint before auditing it.
The
approvalTokenis the approval contract at the protocol level. Some tool schemas still declare aconfirmfield, and the helperisMutationAllowed()exists (it readsmcp.allowMutationsfromevolith.yaml), but the guard that actually blocks execution inhandleCallToolisapply+approvalToken— neitherconfirmnormcp.allowMutationsreplaces it.
Mutative tools
Exactly 20 tools declare
mutative: truein the code (2026-09-20; the other 35 are reads). The set is what the dispatcher protects by construction — a tool is guarded because it is mutative, not because it is listed here.evolith-upgrade-planandevolith-phase-advanceare deliberately reads: they compute and propose, they do not write.
Internal architecture
The Gateway is a NestJS application (modules + dependency injection).
WatcherService
WatcherService watches workspace files (e.g. evolith.yaml) in order to invalidate caches or trigger re-validations when the user edits the configuration while the Gateway is running. It is enabled automatically on the long-lived stdio transport.
CorpusResourceHandler
Handles access to documentary corpus resources (ADRs, playbooks, specs) so that agents can read structured architectural context without invoking mutative tools.
Agent use cases
1. Repository validation from Claude Desktop
The prompt guides the agent to use evolith-validate and to report the blocking violations.
2. Agent onboarding from Cursor
The agent will invoke evolith-agent-install and evolith-agent-validate in sequence.
3. Automated architecture review
Combines SDLC and Architecture validation in a single call.
4. A full SDLC cycle with MoSCoW + gate check
5. Querying the topologies before validating
Client configuration
Cursor (~/.cursor/config.json)
Claude Desktop (claude_desktop_config.json)
Custom agent (HTTP transport)
SmartCLI integration
Migration plan away from evolith-cli mcp
Phase 1 — Coexistence (current): evolith-cli mcp keeps working. evolith-mcp serve is the new entry point.
Phase 2 — Deprecation: evolith-cli mcp will emit a console.warn. Migrate the Cursor / Claude Desktop configurations to evolith-mcp.
Phase 3 — Removal: Drop the MCP code from @beyondnet/evolith-cli in a major version bump. The CLI keeps its validation commands.
Behavioural differences
Extension guide
To add a new tool:
- Create
src/tools/my-tool.tool.tsimplementingMcpTool(schema,execute; addreadonly mutative = trueif it changes state). - Inject whichever domain service it needs (from
@beyondnet/evolith-core). - Return raw data —
McpServerServicewraps it automatically in aSuccessEnvelopeand captures errors into anErrorEnvelope. - Register the tool in
tools.module.ts: add the provider and include it in theMCP_TOOLSfactory.
For mutative tools, add readonly mutative = true. The dispatcher will then demand { "apply": true, "approvalToken": "..." } in the request before it runs the tool.
Observability
Pino logs → stderr
Every log goes to stderr (never stdout). Structured JSON format with correlationId, tool, duration and success.
evolith-metrics tool
Returns the internal metrics of the Gateway:
OpenTelemetry
Audit Logger
Every tool call is recorded with: toolName, userId, tenant, environment, allowed (ABAC), durationMs and correlationId. The records go to stderr in JSON format.
Good practices
- Use prompts as the entry point for agent workflows — they spare the agent from having to reason out the sequence of tools.
- Do not confirm mutative calls in bulk without first validating with the equivalent read-only tools.
- Run
evolith-validatebeforeevolith-auto-fixso you know the real scope of the changes. - On production HTTP, rotate the API keys every 90 days and restrict scopes to the minimum needed.
- Redis is optional but recommended on long-lived installations, to avoid repeated filesystem reads in
resources/read. - Use
evolith-composable-validateinstead of separate calls when several modes are needed — it cuts latency and correlates the results.
Troubleshooting
stdio: logs appear interleaved with the MCP response
Logs go to stderr. If the client merges stdout and stderr, separate the streams:
stdio: Refusing to start the MCP stdio transport (GT-572)
Under NODE_ENV=production, the stdio transport does not receive the local-session principal implicitly: it demands the same configured credential as any other production surface. Without it the server does not start — it fails loudly at startup on stderr and exits with code 78 (EX_CONFIG), instead of advertising all of its tools and then denying every tools/call with FORBIDDEN.
Fixes (any one of them):
--allow-no-auth / EVOLITH_MCP_ALLOW_NO_AUTH is an HTTP-only development switch and deliberately does not stand in for the production credential.
HTTP: 401 Unauthorized
Check that EVOLITH_API_KEY is configured on the server and that the request sends the same value in Authorization: Bearer <key> or x-api-key: <key>. The value is compared for exact equality (no evk_ prefix required). Under NODE_ENV=production, auth is mandatory even with EVOLITH_MCP_ALLOW_NO_AUTH=true.
Tool not found (Tool not found in registry)
The tool may not be registered in tools.module.ts. Check that the provider has been added and that the name in schema.name matches exactly the one being invoked.
ABAC-02: No roles present
The user context (mcp-user-context) carries no roles. On the HTTP transport, check that the JWT or the user context carries the role claims correctly.
Redis unavailable
The cache degrades gracefully. Resources are served straight from the filesystem with no cache, and a warning is emitted in the logs.
OPA: policy.wasm not found
The OPA evaluator requires sdk/cli/rulesets/opa/policy.wasm under CORE_PATH. The behaviour when a policy is missing is fail-closed (GT-348/349), not fail-open: if the file does not exist and NODE_ENV === "production", the evaluator returns allowed: false with the ABAC_POLICY_MISSING violation (a hard denial). Only in non-production environments does the OPA evaluator abstain, returning allowed: true so that the native policy decides. An error inside the OPA engine always denies. To force native evaluation, do not specify engine: "opa".
License
ISC — Beyondnet
Source: src/packages/mcp-server/README.md at commit 2d396da
Tools
0Version history
1- v1.3.3LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts