mcpField
C
Cratis Chronicle

Cratis Chronicle

本地服务
cratis.io数据库03 天前更新

关于 Cratis Chronicle

Cratis Chronicle 是面向运行中 Chronicle 事件溯源数据库的 MCP 服务,供使用事件溯源系统的团队和 Agent 探索与操作数据。它结合实时存储检查和基于实际架构的设计工具,默认禁用变更操作。

主要功能

  1. 01检查事件存储、事件、观察器和读模型
  2. 02查看作业与失败的观察器分区
  3. 03生成基于架构的 Chronicle 工件
  4. 04追踪事件历史并审计事件消费者
  5. 05通过授权变更权限控制作业

适用场景

  1. 01探索 Chronicle 存储及其事件类型
  2. 02排查失败分区或作业状态
  3. 03根据现有事件架构起草读模型
  4. 04追踪实体达到当前状态的原因

MCP 相关

通过 stdio 将 MCP 客户端连接到运行中的 Chronicle 服务。它提供检查和设计工具及提示词;作业变更需要 Mutation 配置文件和授权许可。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"cratis-chronicle": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"Cratis__Chronicle__Mcp__Profile",
"-e",
"Cratis__Chronicle__Mcp__ConnectionString",
"-e",
"Cratis__Chronicle__Mcp__ClientId",
"-e",
"Cratis__Chronicle__Mcp__ClientSecret",
"-e",
"Cratis__Chronicle__Mcp__ApiKey",
"-e",
"Cratis__Chronicle__Mcp__EventStore",
"-e",
"Cratis__Chronicle__Mcp__Namespace",
"docker.io/cratis/chronicle-mcp:2.0.0"
],
"env": {
"Cratis__Chronicle__Mcp__Profile": "<Cratis__Chronicle__Mcp__Profile>",
"Cratis__Chronicle__Mcp__ConnectionString": "<Cratis__Chronicle__Mcp__ConnectionString>",
"Cratis__Chronicle__Mcp__ClientId": "<Cratis__Chronicle__Mcp__ClientId>",
"Cratis__Chronicle__Mcp__ClientSecret": "<Cratis__Chronicle__Mcp__ClientSecret>",
"Cratis__Chronicle__Mcp__ApiKey": "<Cratis__Chronicle__Mcp__ApiKey>",
"Cratis__Chronicle__Mcp__EventStore": "<Cratis__Chronicle__Mcp__EventStore>",
"Cratis__Chronicle__Mcp__Namespace": "<Cratis__Chronicle__Mcp__Namespace>"
}
}
}
}
启动命令docker run -i --rm -e Cratis__Chronicle__Mcp__Profile -e Cratis__Chronicle__Mcp__ConnectionString -e Cratis__Chronicle__Mcp__ClientId -e Cratis__Chronicle__Mcp__ClientSecret -e Cratis__Chronicle__Mcp__ApiKey -e Cratis__Chronicle__Mcp__EventStore -e Cratis__Chronicle__Mcp__Namespace docker.io/cratis/chronicle-mcp:2.0.0
需要配置的环境变量
Cratis__Chronicle__Mcp__ProfileDeployment profile. ReadOnly (default) registers inspection tools only. Mutation also needs an Authorization policy: https://www.cratis.io/chronicle-mcp/deployment-profiles/
Cratis__Chronicle__Mcp__ConnectionStringChronicle endpoint reachable from the container; host.docker.internal reaches the host on macOS/Windows.
Cratis__Chronicle__Mcp__ClientIdOAuth client ID; set together with ClientSecret to override development credentials.
Cratis__Chronicle__Mcp__ClientSecret密钥OAuth client secret; set together with ClientId to override development credentials.
Cratis__Chronicle__Mcp__ApiKey密钥API key for authentication, as an alternative to client credentials.
Cratis__Chronicle__Mcp__EventStoreDefault event store used by tools when none is specified.
Cratis__Chronicle__Mcp__NamespaceDefault namespace used by tools when none is specified.

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
ocidocker.io/cratis/chronicle-mcp:2.0.0

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

README 原文English

来自项目 README

README 暂无中文译文,以下为英文原文;中文介绍见上方。

Chronicle.MCP

Discord Docker Build Publish License: MIT

The Chronicle MCP server connects an AI agent to a running Cratis Chronicle event-sourcing database over the Model Context Protocol. Point your agent at a Chronicle server and it can explore the domain, operate observers and jobs, and turn plain-language requests into Chronicle artifacts — always grounded in the store's real schema.

Because the server talks to Chronicle directly, it works no matter which Chronicle client language your application uses — .NET, TypeScript, Kotlin/Java, or Elixir. Any MCP-capable tool can use it. See the Documentation for the full guide.

Using

The Chronicle MCP server leverages Stdio and is packaged as a container. In your tool, configure it using that.

Releases are also listed in the official MCP Registry as io.github.Cratis/chronicle-mcp, using the same versioned Docker Hub image. The listing starts the server in the read-only profile; job control needs the Mutation profile and an authorization policy.

Note: You must have a Chronicle server running.

Example: VSCode

In VSCode you would do this by adding a tool to your agent. This can done either by adding it to the global user settings or through an mcp.json file in the .vscode folder of your project.

For the global user settings, you simply do the following:

"mcp": {
    "servers": {
        "Chronicle": {
            "type": "stdio",
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "-eCratis__Chronicle__Mcp__ConnectionString=chronicle://host.docker.internal:35000",
                "cratis/chronicle-mcp"
            ]
        }
    }
}

Note: To configure the connection string for Chronicle you pass it an environment variable; Cratis__Chronicle__Mcp__ConnectionString running locally - on MacOS and Windows the host machine is found at host.docker.internal.

For a local mcp.json file, its almost the same:

{
    "servers": {
        "Chronicle": {
            "type": "stdio",
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "-eCratis__Chronicle__Mcp__ConnectionString=chronicle://host.docker.internal:35000",
                "cratis/chronicle-mcp"
            ]
        }
    }
}

You can see this in action in the mcp.json in this repository.

Note: The cratis/chronicle-mcp is a multi CPU architecture image supporting both x64 and arm64 automatically.

Configuration

Configuration is optional. The MCP server works out of the box with sensible defaults suitable for local development:

  • Connection String: chronicle://host.docker.internal:35000
  • Credentials: Development client ID (chronicle-dev-client) and secret (chronicle-dev-secret)
  • Profile: ReadOnly — mutating tools are not listed or callable.

If you need to customize any settings, the MCP server can be configured entirely on its own and is also compatible with the Cratis CLI. For any value you do not set explicitly, the server resolves it in this order:

  1. Explicit MCP options (environment variables / appsettings.json).
  2. The CHRONICLE_CONNECTION_STRING environment variable.
  3. The active context in the CLI configuration at ~/.cratis/config.json.
  4. Built-in development defaults.

When client credentials are used, the server obtains and caches OAuth tokens in ~/.cratis/tokens, the same location used by the CLI, so tokens are shared between the two.

All options live under the Cratis:Chronicle:Mcp configuration section. As environment variables they use the Cratis__Chronicle__Mcp__ prefix:

OptionEnvironment variableDescription
ProfileCratis__Chronicle__Mcp__ProfileReadOnly (default) or Mutation; unknown values prevent startup.
AuthorizationCratis__Chronicle__Mcp__Authorization__...Mutation policy: principal, expiration, revoked principals, and scoped grants. See Deployment profiles.
ConnectionStringCratis__Chronicle__Mcp__ConnectionStringThe Chronicle connection string. Defaults to chronicle://localhost:35000.
ContextCratis__Chronicle__Mcp__ContextThe CLI context to read connection details from (defaults to the active context).
UseCliConfigurationCratis__Chronicle__Mcp__UseCliConfigurationSet to false to ignore ~/.cratis/config.json entirely.
ClientId / ClientSecretCratis__Chronicle__Mcp__ClientId / ...__ClientSecretClient credentials for authentication. Defaults to development credentials if not specified.
ApiKeyCratis__Chronicle__Mcp__ApiKeyAn API key to authenticate with, as an alternative to client credentials.
EventStoreCratis__Chronicle__Mcp__EventStoreThe default event store used by tools when none is specified. Defaults to default.
NamespaceCratis__Chronicle__Mcp__NamespaceThe default namespace used by tools when none is specified. Defaults to Default.

Job control requires the Mutation profile and a matching grant for the deployment principal, store, namespace, operation, and job ID. A connection string or Chronicle credentials alone never enable mutations. Keep credentials in environment variables or a secret store, never in server.json or a committed appsettings.json. See Deployment profiles for policy examples and denial codes.

Prompts / Tools

The server exposes the following tools. Every tool defaults the event store and namespace to the configured defaults when you do not specify them, so you can ask high-level questions and only mention a store or namespace when you need a specific one.

The tools come in two complementary sets: operate-side tools for inspecting and operating a live store, and design-time tools that turn natural language into Chronicle artifacts grounded in the store's real schema. See the Documentation folder for a full guide, and How it works for the split.

Operate-side
ToolDescription
list_event_storesList all event stores on the server.
list_namespacesList namespaces within an event store.
list_event_typesList registered event types.
list_observersList observers (reactors, reducers, projections), optionally filtered by type.
get_observerShow detailed information about a specific observer.
list_failed_partitionsList observer partitions that have failed and are paused.
list_projectionsList projection definitions.
list_read_modelsList read model definitions.
get_read_model_instancesList the current instances of a read model (paged).
get_eventsRead events from an event sequence, with optional filtering.
get_tail_sequence_numberGet the highest used sequence number (tail) in an event sequence.
list_recommendationsList active maintenance recommendations.
get_server_versionGet version info from the server (also a connectivity check).
list_jobsList all jobs in a namespace, optionally filtered by job status.
get_jobGet a specific job by ID, including full details and status changes.
get_job_stepsGet the job steps for a specific job, optionally filtered by step status.
stop_jobMutation profile: stop a specific job (transitions to Stopped status).
resume_jobMutation profile: resume a specific stopped job.
delete_jobMutation profile: irreversibly delete a specific job (transitions to Removing status). Clients should ask for confirmation; the server does not prompt.
Design-time
ToolDescription
describe_systemDeduce what the system in an event store is and is for — entities, lifecycles, read surfaces, automations — with narrative guidance for telling its story.
suggest_next_event_typesFind lifecycle gaps and suggest the event types to introduce next, each grounded in the gap it closes.
run_ad_hoc_projectionFold events into per-event-source instances on demand (AutoMap semantics) — answer "show all X with all details" without registering anything.
describe_event_typeDescribe an event type's real schema — every property with its JSON and suggested C# type. The grounding primitive for the others.
scaffold_read_modelGenerate a reviewable read model + model-bound projection from one or more event types, grounded in their schema.
audit_unconsumed_event_typesReport event types nothing reads, plus consumers that reference an event type id that no longer exists.
generate_event_catalogProduce a living data dictionary — every event type, its fields, and its consumers.
explain_causal_traceRead an event source's ordered history with correlation and causation, to narrate what happened and why.

The server also exposes MCP prompts — describe_system, suggest_next_event_types, and query_system — that package these workflows for clients that surface prompts (for example as slash commands).

You can ask it things like:

  • List all event stores
  • List all event types in the [put name here] event store
  • List all observers in the [put name here] event store and namespace [put namespace here]
  • Show me the events in the [put name here] event store
  • Are there any failed partitions?
  • What observers in the [put event store name here] use event type [put event type name]
  • List all jobs in the [put event store name here] event store
  • Show me job [put job id here] in the [put namespace name here] namespace
  • What steps does job [put job id here] have?
  • Stop / Resume / Delete job [put job id here] (requires an authorized Mutation deployment)

And design-time questions like:

  • Describe the system in [put event store here] — and tell me its story
  • What event types should I introduce next for the system in [put event store here]?
  • Show all [put concept here] with all details (runs an ad-hoc projection)
  • Show me all the [put concept here] registered (scaffolds a read model + projection)
  • What fields does the [put event type here] event have?
  • What events are we writing that nothing reads?
  • Give me a catalog of our [put area here] events and who reads them
  • Why does [put entity here] show as [put state here]?

Local development

Using VSCode, the mcp.json in the .vscode folder of this repository is automatically supported. Local development defaults to ReadOnly. Open it and click the Start button:

README 配图

During development, compile and click the Restart button when having the mcp.json open:

README 配图

Chronicle

To get Chronicle running, there is a docker-compose.yml file in the Source folder. Simply do docker compose up -d and you'll have a Chronicle instance running.

If you want some data, we recommend using our samples and specifically the console to initialize it with some data.

The Cratis ecosystem

This project is part of Cratis — free, MIT-licensed tools for building event-sourced and CQRS applications.

  • Chronicle — event-sourcing database and runtime. Orleans-based kernel, pluggable storage (MongoDB default; PostgreSQL, SQL Server, SQLite, in-memory), language-agnostic gRPC contracts. Docs
  • Chronicle clients — first-class .NET SDK, plus TypeScript, Kotlin/Java, and Elixir; Python coming soon (pre-alpha). AI agents connect through the Chronicle MCP server (this repository).
  • Arc — opinionated CQRS framework for ASP.NET Core with commands, queries, validation, authorization, and TypeScript proxy generation. Works without event sourcing. Docs
  • Components — React components aligned with Arc patterns. Docs
  • CLI + Workbench — inspect and diagnose Chronicle from the terminal or the browser. Docs
  • Model-first layer (experimental) — Studio, Screenplay, Stage, Scene, Prologue
  • Supporting — Fundamentals, Specifications, Synopsis, Lens, Narrator, and free AI tooling (preview); Ensemble coming soon (pre-release)
  • Samples — runnable event sourcing and CQRS samples for the whole stack

Everything Cratis publishes today is MIT licensed and free to use.

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。