McAgent Documentation

Complete Technical Guide & Step-by-Step Configuration
No matching section. Try a config key such as apr.enable or an error such as STALE_BUILD.
1

Step 1: Verify System Requirements

Before installing McAgent, verify that your server environment meets all mandatory prerequisites:

  • Paper Server: Compatible with Minecraft api-version: 1.18 or higher.
  • Java Runtime Environment: Java 17 minimum. Always use the Java release required by your active Paper build.
  • LLM Provider: An AI model capable of reliable Tool/Function Calling (e.g. Claude 3.5 Sonnet, GPT-4o, DeepSeek-V3).
  • Docker Runtime: Docker Desktop (Windows/macOS) or Docker Engine (Linux) is required only if the APR Programs feature is enabled.
2

Step 2: Installation Process

  1. Gracefully shutdown your Paper Minecraft server.
  2. Copy the compiled McAgent.jar binary into your server's plugins/ folder.
  3. Start the server once. McAgent will populate its workspace directory at plugins/McAgent/.
  4. The workspace contains config.yml, the providers/ directory, APR resources, and internal storage stores.
  5. Stop the server, edit config.yml with your credentials, and restart the server.
Note on Command Structure: McAgent does not register in-game /commands. Management is conducted through the dedicated Web UI console hosted by default at http://127.0.0.1:8765.
3

Step 3: Environment Secrets Setup

To avoid committing sensitive credentials into Git or configuration files, declare secrets in your operating system environment:

api-key: "ENV:OPENAI_API_KEY"
web:
  auth:
    token: "ENV:MCAGENT_WEB_TOKEN"

Example launching via PowerShell in the same session:

$env:OPENAI_API_KEY = "sk-your-actual-api-key"
$env:MCAGENT_WEB_TOKEN = "your-long-random-secure-web-token"
java -Xms2G -Xmx4G -jar paper.jar nogui
Environment Scope: Environment variables declared in a separate window will not propagate to the running Java process. If using a service runner, declare environment variables in the service specification.
4

Step 4: Primary Configuration (config.yml)

Below is the complete, non-truncated baseline configuration for production usage:

provider: local-gateway
model: ag/claude-sonnet-4-6
api-key: "ENV:OPENAI_API_KEY"
base-url: "http://127.0.0.1:20128/v1"

web:
  host: "127.0.0.1"
  port: 8765
  public-url: ""
  auth:
    enabled: true
    token: "ENV:MCAGENT_WEB_TOKEN"
    session-timeout-minutes: 480

agent:
  task-timeout-seconds: 7200
  max-steps: 160
  max-tool-calls: 320
  max-ask-user-per-task: 10
  max-compactions-per-task: 2147483647
  active-recovery-reserve-tokens: 8192
  verification-reserve-tokens: 4096
  tool-result-reserve-tokens: 4096

approval:
  timeout-seconds: 600
  file-read: ask
  file-write: ask
  minecraft-write: ask

filesystem:
  root: "."
  sensitive-name-patterns: []

memory:
  max-recent-turns: 80
  max-tasks: 500
  max-facts: 500
  consolidation:
    interval-hours: 24
    min-age-days: 7
    similarity-threshold: 0.8

embedding:
  model: "multilingual-e5-small"
  quantization: "int8"
  custom-model-path: ""
  custom-tokenizer-path: ""
  custom-dimension: 384

apr:
  enable: true
  runtime-image: "dungnice/mcagent-runtime@sha256:f202985b0607c9be395a5f691837a2d1301cbc393c4adede1aea4f1524c8decd"
  builder-image: "dungnice/mcagent-builder@sha256:3a0b3d0d4e1236a96bc3aec62b0c81ca08eb34db44829e78d0d874e2ed18b309"
  max-live-executions: 4
  total-cpu-percent: 200
  total-memory-mib: 2048
  total-pids: 96

self-healing:
  max-attempts: 3
  time-budget-seconds: 90
  circuit-breaker-threshold: 3
5

Step 5: Post-Boot Verification

Inspect server console logs immediately after startup to ensure initialization was clean:

Model context budget: window=..., outputReserve=..., source=...
Enabled at http://127.0.0.1:8765

Log in to the Web UI using your secret token and send a read-only test prompt:

Inspect the server version, loaded plugins and current world state. Do not modify anything.
6

Step 6: Providers Architecture & Profiles

McAgent abstracts LLM protocols into declarative YAML profiles stored in plugins/McAgent/providers/<provider-id>.yml. The provider key in config.yml matches the filename without the .yml extension.

Built-in Provider IDs:

Provider IDDefault EndpointNotes
local-gateway${config.base-url}/chat/completionsOpenAI-compatible gateway (9Router, LiteLLM, etc.).
openrouterhttps://openrouter.ai/api/v1/chat/completionsOpenRouter AI aggregator.
openaihttps://api.openai.com/v1/chat/completionsOfficial OpenAI Chat Completions API.
deepseekhttps://api.deepseek.com/chat/completionsDeepSeek official API.
groqhttps://api.groq.com/openai/v1/chat/completionsGroq LPU inference endpoint.

Full Provider Profile YAML Schema

Provider profiles are the complete declarative specification McAgent uses to communicate with an LLM API. Below is the full schema with every supported field.

Metadata & Connection block:

schema-version: 1
display-name: "Example Provider"
connection:
  transport: HTTP_JSON
  method: POST
  url: "https://api.example.com/v1/chat/completions"
  connect-timeout-ms: 10000
  request-timeout-ms: 180000
  stream-idle-timeout-ms: 60000
  follow-redirects: false
  headers:
    Content-Type: "application/json"
    Authorization: "Bearer ${config.api-key}"
FieldConstraintDescription
schema-versionMust be 1Identifies profile schema revision.
connection.transportHTTP_JSONOnly supported transport type.
connection.methodPOSTHTTP method.
connection.urlValid URI after bindingThe full LLM API chat completion endpoint URL.
connection.connect-timeout-ms100-300000 msTCP connection handshake timeout.
connection.request-timeout-ms100-900000 msFull response receive timeout.
connection.stream-idle-timeout-ms100-300000 msIdle period before SSE stream declared dead.
connection.follow-redirectsfalse (default)The field is parsed, but the current chat and model-discovery clients do not enable redirects from it. Redirects remain disabled. Keep it false for forward-compatible safe behavior.

Supported config bindings in profile YAML:

${config.model}
${config.api-key}
${config.base-url}
${config.streaming}
${config.provider-options.<key>}
${ENV:ENV_VAR_NAME}

Request mapping block:

request:
  body:
    model: "${config.model}"
    messages: "${mcagent.messages}"
    tools: "${mcagent.tools}"
    tool_choice: "${mcagent.tool-choice}"
    stream: true
    max_tokens: "${mcagent.output-limit}"
Note: mcagent.* placeholders are runtime-injected. Do not replace them with literal JSON values.

Response mapping block:

response:
  text-pointer: "/choices/0/message/content"
  finish-reason-pointer: "/choices/0/finish_reason"
  tool-calls:
    array-pointer: "/choices/0/message/tool_calls"
    id-pointer: "/id"
    name-pointer: "/function/name"
    arguments-pointer: "/function/arguments"
  usage:
    input-tokens-pointer: "/usage/prompt_tokens"
    output-tokens-pointer: "/usage/completion_tokens"
    total-tokens-pointer: "/usage/total_tokens"

Streaming (SSE) block:

stream:
  transport: SSE
  data-prefix: "data:"
  done-value: "[DONE]"
  text-delta-pointer: "/choices/0/delta/content"
  finish-reason-pointer: "/choices/0/finish_reason"
  tool-call-delta:
    array-pointer: "/choices/0/delta/tool_calls"
    index-pointer: "/index"
    id-pointer: "/id"
    name-pointer: "/function/name"
    arguments-delta-pointer: "/function/arguments"

Capabilities block:

capabilities:
  streaming: true
  tool-calling: true
  parallel-tool-calls: false
  vision-input: false
  usage-reporting: true
  system-message: true
Note: McAgent requires tool-calling: true and system-message: true. Use parallel-tool-calls: false for safer sequential mutation execution.

Error mapping block:

errors:
  message-pointers:
    - "/error/message"
    - "/message"
  retryable-status:
    - 408
    - 429
    - 500
    - 502
    - 503
    - 504
Do not add 400/401/403 to retryable-status. Retrying them cannot fix a bad request or invalid credential.

Model Discovery & Context Defaults

Provider profiles can declare an optional model discovery block. McAgent uses it to auto-detect context window limits for the selected model:

model-discovery:
  enabled: true
  url: "https://openrouter.ai/api/v1/models"
  timeout-ms: 5000
  items-pointer: "/data"
  id-pointer: "/id"
  context-window-pointers:
    - "/context_length"
  max-output-pointers:
    - "/top_provider/max_completion_tokens"

context-defaults:
  context-window-tokens: 32768
  max-output-tokens: 4096

Context resolution priority order:

  1. Query discovery endpoint; find item with exact id match against configured model.
  2. Read first positive integer from context-window-pointers / max-output-pointers.
  3. Fall back to context-defaults in provider profile.
  4. Fall back to McAgent internal built-in conservative fallback.
console source= valueMeaning
provider_apiLimits fetched live from model discovery API.
provider_profileUsing context-defaults from provider YAML.
built_in_fallbackMcAgent internal fallback values applied.
7

Step 7: APR (Agent Programmable Runtime), Complete Configuration

APR allows the Agent to create and manage programs with their own source, manifest, build, logs, and lifecycle. APR does not turn the Web UI into a general IDE. It provides a controlled environment for Agent-authored programs serving specific tasks.

APR config block in config.yml:

apr:
  enable: true
  runtime-image: "dungnice/mcagent-runtime@sha256:f202985b0607c9be395a5f691837a2d1301cbc393c4adede1aea4f1524c8decd"
  builder-image: "dungnice/mcagent-builder@sha256:3a0b3d0d4e1236a96bc3aec62b0c81ca08eb34db44829e78d0d874e2ed18b309"
  max-live-executions: 4
  total-cpu-percent: 200
  total-memory-mib: 2048
  total-pids: 96
When apr.enable: false: No APR runtime is initialized, Docker images are not pulled, APR capabilities are not registered for the Agent, APR API returns unavailable, and the Programs button is hidden from the Web UI.

APR Docker prerequisites:

  • Docker Engine must be running and the server process must have permission to call Docker CLI/daemon.
  • Server must be able to reach Docker Hub to pull images on first launch.
  • Images must be pinned by digest. Do not use :latest in config.

Manually verify Docker before starting the server:

docker info
docker pull dungnice/mcagent-runtime@sha256:f202985b0607c9be395a5f691837a2d1301cbc393c4adede1aea4f1524c8decd
docker pull dungnice/mcagent-builder@sha256:3a0b3d0d4e1236a96bc3aec62b0c81ca08eb34db44829e78d0d874e2ed18b309

Program Workspace Structure:

Portable user workspace (can be exported/imported):

programs/<definition-id>/
├── program.json
├── src/
│   ├── Main.java | main.py | index.js
│   ├── requirements.txt
│   ├── package.json
│   └── package-lock.json
├── resources/
└── modules/

Runtime-owned data (not exportable) lives in apr-runtime/runtime/programs/<id>/:

build/
state/
logs/
artifacts/
tmp/
Editing source while a Program is running does not affect the current execution. You must BUILD again, then RUN/START the new revision.

Execution Type & Placement Matrix:

Execution TypePlacementUse Case
ONE_SHOTDETACHEDPython/JS/Java script that runs to completion and returns output.
LONG_RUNNINGDETACHEDIsolated long-running Docker process. Subject to program/task wall-time policy. Cannot access Bukkit/Paper API directly.
ONE_SHOTPRODUCTION_CURRENT_SERVERDeclared-contract Java callable executed in-server with approval/verification.
LONG_RUNNINGPRODUCTION_CURRENT_SERVEREvent listener/integration running alongside the live Paper server runtime.
Mandatory Rules:
  • Any code listening to Minecraft/Paper events or using live Bukkit API must be LONG_RUNNING + PRODUCTION_CURRENT_SERVER.
  • Do not run event listeners as DETACHED.
  • After START of a Production program, Agent verifies STATUS=RUNNING once and ends the task. Do not poll to keep listener alive.
  • LONG_RUNNING + DETACHED is a Docker-isolated process. It is not a Production listener and has a wall-time budget.

Standard Program Lifecycle:

  1. CATALOG: Search for reusable existing programs.
  2. INSPECT: Check metadata, revision, and build status.
  3. CREATE: Create workspace if it does not exist.
  4. WRITE: Write source files and program manifest.
  5. DEFINE: Define the program entry point.
  6. BUILD: Compile and install dependencies; verify output.
  7. RUN / CALL / START: Execute based on type.
  8. Verify result via independent state read-back when mutation occurred.
  9. STOP for long-running programs; DESTROY only on explicit admin request.

Portable program.json Reference

The manifest is administrator-owned and portable. Runtime state, build output, approvals, and restoration authority are stored separately and are never granted by importing a manifest.

{
  "schemaVersion": 1,
  "id": "daily-report",
  "name": "Daily Report",
  "version": "1.0.0",
  "description": "Generate one bounded report.",
  "executionType": "ONE_SHOT",
  "kind": "PYTHON_PROGRAM",
  "buildProfile": "PYTHON_VALIDATE",
  "entrypoint": "main.py",
  "argv": ["python3", "main.py"],
  "workingDirectory": "lab",
  "placement": "DETACHED",
  "optionalApiDependencies": [],
  "modules": [],
  "callable": null,
  "operations": {}
}
Manifest fieldConstraintRuntime meaning
schemaVersionExactly 1Portable manifest schema. Other values fail with PROGRAM_SCHEMA_UNSUPPORTED.
id[a-z0-9][a-z0-9._:-]{0,95}Canonical directory and destructive identity. A display name cannot replace it.
nameUp to 120 charactersHuman-readable label only.
versionUp to 48 charactersAuthor label. It does not replace source, artifact, environment, and Module hashes.
descriptionUp to 320 charactersUsed by CATALOG relevance. State the purpose and side effects clearly.
executionTypeONE_SHOT or LONG_RUNNINGForeground bounded job or asynchronous lifecycle.
kindJava, Python, or JavaScript ProgramSelects source/runtime semantics.
buildProfileMust match kindJAVA_JAVAC_JAR, PYTHON_VALIDATE, JAVASCRIPT_VALIDATE, or NONE.
entrypointRequired, max 200File path for Python/JS or class identity for Java.
argvMax 32 items, max 512 characters eachDirect process arguments. No shell expansion. Shell, Docker, sudo, SSH, and mount executables are rejected.
workingDirectoryDefault labRelative execution directory inside the isolated runtime.
placementDetached or current serverDETACHED uses Docker. Live Bukkit/Paper code requires PRODUCTION_CURRENT_SERVER.
optionalApiDependenciesMax 16 IDsCompile metadata only. It does not install packages or grant server authority.
modulesMax 32 exact referencesImmutable qualified Module revisions. Floating or latest references do not exist.
callableJava ONE_SHOT onlyDeclares a bounded JSON input/output capability.
operationsEvery callable actionDeclares READ, MUTATION, or RECEIPT_ONLY effect policy.
No portable auto-start flag: automatic is not a supported field in program.json. The public Agent API currently defines Programs with runtime automatic=false. A durable restart grant alone does not switch on restoration.

Callable Java Contract and Verification

A callable is an explicit ONE_SHOT Java Program exposing public static String invoke(String). Input and output are validated with a closed JSON schema subset.

"callable": {
  "enabled": true,
  "name": "player_food_status",
  "description": "Read or set one online player's food level.",
  "inputSchema": {
    "type": "OBJECT",
    "properties": {
      "action": {"type": "STRING"},
      "target": {"type": "STRING"},
      "value": {"type": "INTEGER"}
    },
    "required": ["action", "target"],
    "additionalProperties": false
  },
  "outputSchema": {
    "type": "OBJECT",
    "properties": {
      "ok": {"type": "BOOLEAN"},
      "result": {"type": "STRING"}
    },
    "required": ["ok", "result"],
    "additionalProperties": false
  },
  "entryClass": "apr.generated.food.Main",
  "entryContract": "public_static_string_invoke_string_v1"
}
Operation effectRequired policyCompletion rule
READNo verifier or justificationCode execution approval still applies in Production, but no mutation read-back is created.
MUTATIONTarget fields plus an allowed native verifierThe Agent cannot finish until independent native read-back verifies the exact target.
RECEIPT_ONLYNon-empty justificationCurrently fails closed when runtime receipt support is unavailable.
Callable schema limits
  • Types: OBJECT, STRING, BOOLEAN, INTEGER, NUMBER, ARRAY, NULL.
  • Maximum 32 object properties; required fields must exist in properties.
  • ARRAY requires items. Non-array types cannot declare items.
  • Maximum schema/value depth is 8; maximum total nodes is 512.
  • maxLength is 1-4096; maxItems is 1-128.
  • Callable result text is limited to 65,536 characters.
Allowed native mutation verifiers

get_player, get_player_inventory, get_player_status, list_online_players, list_worlds, get_world_settings, get_block_info, get_world_entity_summary, list_scoreboard_state, and get_plugin_details.

The Program's own ok=true, logs, and inspect action are never mutation proof.

Python Package Configuration (requirements.txt):

Declare exact versions in src/requirements.txt:

pymongo==4.13.2
requests==2.32.4
Format requirement: Only package-name==exact.version is accepted. Range specifiers (>=, ~=), Git URLs, and pip options are not supported. Packages must have a binary wheel. Source distributions are not built on the fly. Builder uses:

pip install --only-binary=:all: --requirement ... --target ...

npm Package Configuration (package.json):

{
  "name": "my-program",
  "private": true,
  "dependencies": {
    "discord.js": "14.22.1",
    "mongodb": "6.17.0"
  }
}
Format requirement: Versions must be exact SemVer strings (e.g. 14.22.1). Do not use ^, ~, latest, URL references, or workspace references.

If package-lock.json is present, builder uses npm ci; otherwise uses npm install --save-exact. All builds include: --ignore-scripts --no-audit --no-fund --no-bin-links. Lifecycle scripts are never executed.

Program Dependencies and Reusable APR Modules

These are separate mechanisms. A normal package belongs to one Program build. An APR Module is an immutable, qualified revision intentionally shared by multiple Programs.

RequirementUseDo not use
One JS Program needs discord.js or mongodbsrc/package.jsonA global Module
One Python Program needs pymongo or requestssrc/requirements.txtA global Module
Several Programs share administrator-owned Java utility codeJAVA_SOURCE ModuleCopying mutable source into every Program
Install a Bukkit/Paper pluginThe normal plugin administration workflowAPR Module
CATALOG>ACQUIRE>STAGED>QUALIFY>QUALIFIED>PROMOTE>PIN_PROGRAM>BUILD
Module operationWhat it doesImportant boundary
ACQUIREDownloads an exact public HTTPS archive or imports an APR artifact.Acquisition records provenance; it does not establish trust.
PROMOTE_FROM_PROGRAMCaptures an explicit Java source selection from a Program.Only selected paths are captured.
QUALIFYInspects or compiles a staged revision and records hashes/API.Promotion is forbidden before qualification succeeds.
PROMOTEMoves the logical module's promoted pointer.Existing Programs do not change automatically.
PIN_PROGRAMWrites an exact immutable ModuleReference into a Program.The Program becomes stale and must be built again.
ROLLBACKMoves the promoted pointer to an older qualified revision.Pin and build again to move an existing Program.
REVOKERevokes a compromised revision and removes its promoted pointer.Programs pinned to it fail closed.
INSPECT_APIDisplays statically indexed symbols.Inspection never grants execution authority.
Supported Module kinds and validation
  • JAVA_SOURCE: Java plus safe resource files. Plugin descriptors and protected namespaces such as org.bukkit, io.papermc.paper, net.minecraft, and java are rejected.
  • JAVA_LIBRARY_JAR: Must contain valid classes and no agent manifest, plugin descriptor, duplicate class, shadowed class, or reserved namespace.
  • PYTHON_WHEEL: Pure Python wheel only. Native files such as .so, .pyd, .dll, and .exe are rejected.
  • NPM_PACKAGE: Standard npm .tgz with package.json. Install scripts are never executed.
Remote acquisition limits

Public HTTPS only, no automatic retry, at most 3 redirects, 10-second connect timeout, 30-second request timeout, and 16 MiB download size. Archives are limited to 2,048 entries, 64 MiB extracted, and 8 MiB per entry. Traversal, absolute paths, duplicate entries, symlinks, hardlinks, and special files are rejected.

Exact pinning: A ModuleReference contains module ID, revision ID, content SHA-256, artifact SHA-256, and kind. Do not hand-write it. Use PROMOTE then PIN_PROGRAM. A later promotion cannot silently alter a pinned Program.

APR Error Code Reference:

Error CodeResolution
BACKEND_UNAVAILABLEStart Docker, verify with docker info, check daemon permissions.
PACKAGE_BUILDER_IMAGE_NOT_CONFIGUREDSet apr.builder-image to a valid digest string.
PYTHON_DEPENDENCY_VERSION_NOT_EXACTChange requirements.txt to name==version format only.
NPM_DEPENDENCY_VERSION_NOT_EXACTRemove ^, ~, latest; use exact SemVer.
BUILD_REQUIRED / STALE_BUILDRebuild after source/manifest/module changes or server API changes.
PROGRAM_NOT_FOUNDUse CATALOG to find the correct definition ID, or create the program.
PROGRAM_OPERATION_POLICY_REQUIREDDeclare a security policy for all callable actions.
VERIFICATION_REQUIREDRun the designated native verifier before proceeding.
WRONG_PLACEMENTBukkit/Paper/event code must use PRODUCTION_CURRENT_SERVER placement.
8

Step 8: Local Vector Embedding Engine

McAgent runs local ONNX embeddings for semantic memory ranking and skill search without sending vector data to a model provider. The embedding model is independent from the chat model selected under provider.

embedding:
  model: "multilingual-e5-small"
  quantization: "int8"
  custom-model-path: ""
  custom-tokenizer-path: ""
  custom-dimension: 384

Supported Built-in Models:

Model Name Dimension Source Model
multilingual-e5-small 384 Xenova/multilingual-e5-small (Recommended)
multilingual-e5-base 768 Xenova/multilingual-e5-base
qwen3-embedding-0.6b 1024 onnx-community/Qwen3-Embedding-0.6B-ONNX
bge-m3 1024 Xenova/bge-m3
KeyBehaviorOperational warning
embedding.modelSelects a built-in model when no custom ONNX path is set.A model name is not a provider model ID.
embedding.quantizationint8 is the compact default. float32 is normalized to fp32.Unsupported values fall back to int8.
embedding.custom-model-pathRelative or absolute ONNX model path. A non-empty value overrides the built-in model asset.Relative paths resolve from the server working directory.
embedding.custom-tokenizer-pathOptional tokenizer path.When empty, McAgent searches for tokenizer.json beside the custom ONNX file.
embedding.custom-dimensionVector width for a custom model.It does not override the known dimension of a built-in model.
Changing embedding space: A different model or dimension makes existing vectors incompatible. Back up plugins/McAgent/, restart, and rebuild or re-index memory as required. Never mix vectors from two dimensions in one store.
Custom ONNX validation checklist
  1. Place the ONNX model and tokenizer in a stable server-owned directory.
  2. Set both paths explicitly when the tokenizer is not beside the model.
  3. Set custom-dimension to the exact output width documented by the model.
  4. Restart Paper and confirm the embedding engine initializes without tensor shape or tokenizer errors.
  5. Test semantic retrieval with two paraphrased facts before migrating production memory.
9

Step 9: Operations & Troubleshooting Guide

Data Storage Map:

Path / File Purpose
plugins/McAgent/config.yml Primary plugin configuration file.
plugins/McAgent/providers/ Provider YAML profiles.
plugins/McAgent/agent-memory.json Canonical long-term memory store.
plugins/McAgent/agent-runtime-snapshots.json Task execution snapshots for resumption.
plugins/McAgent/apr-runtime/ APR program source code, logs, builds, and artifacts.
Important Distinction: Reset History clears local Web chat timeline logs without deleting long-term memory. Reset Memory permanently wipes canonical semantic and episodic memories.
OperationDeletedPreservedSafe procedure
Reset HistoryWeb timeline and local conversation history.Canonical facts, task memories, Program source, builds, and configuration.Use when the UI timeline is no longer useful. Confirm a known fact can still be recalled afterward.
Reset MemoryCanonical semantic and episodic memory after exact approval.History is not implicitly reset; APR data and config remain separate.Stop active tasks, back up the data folder, approve the exact operation, then verify the memory store was reinitialized.
Delete a ProgramExact APR Program subject selected by a destructive operation.Other Programs, global Modules, memory, and history.Use exact definition ID/current revision. A display name is not sufficient authority.

Restart, Reload, and Backup Rules

  • Restart after changing provider, model, environment secrets, embedding engine, APR enable state, or Docker image digests.
  • Do not assume a Bukkit reload recreates Docker, HTTP, embedding, or provider runtime cleanly. Prefer a controlled server restart.
  • Back up the entire plugins/McAgent/ directory while the server is stopped for a consistent recovery point.
  • Redact api-key, Web token, provider headers, external credentials, and terminal secrets before sharing diagnostics.

Minimal Incident Capture

McAgent JAR SHA-256:
Java / Paper version:
Provider ID / model ID:
Context source from startup log:
APR enabled / Docker image digests:
Exact task text:
Final status and first error code:
Redacted server log / APR terminal excerpt:

Exhaustive config.yml Parameter Tables

1. Model & Provider Settings

Config Key Default Detailed Description
provider local-gateway Profile ID matching file in providers/ without .yml extension.
model gpt-4o-mini Exact model string sent verbatim to provider endpoint.
api-key ENV:OPENAI_API_KEY Secret key string or environment variable syntax (ENV:KEY_NAME).
base-url http://127.0.0.1:8080/v1 Base URL used by profiles such as local-gateway. Supply the API base, not a duplicated /chat/completions endpoint.
request-timeout-seconds 300 Timeout in seconds for HTTP model responses (>0).

2. Web UI Server (web)

Config Key Default Detailed Description
web.host 127.0.0.1 Network interface binding. Use 0.0.0.0 for public access.
web.port 8765 TCP listener port (1 - 65535).
web.public-url (empty) Public URL when hosted behind reverse proxies (e.g. https://mc.example.com).
web.auth.enabled true Enforces token authentication for Web UI.
web.auth.token ENV:MCAGENT_WEB_TOKEN Authentication secret token.
web.auth.session-timeout-minutes 480 Session token lifetime limit in minutes (>0).

3. Agent Context & Execution (agent)

Config Key Default Detailed Description
agent.task-timeout-seconds 7200 Wall-clock timeout per Agent task (300 - 86400s).
agent.max-steps 160 Maximum reasoning step loop ceiling (10 - 500).
agent.max-tool-calls 320 Maximum tool invocations per task (20 - 1000).
agent.max-ask-user-per-task 10 Maximum user question prompts per task (2 - 20).
agent.max-compactions-per-task 2147483647 Maximum context compaction limit (>0).
agent.active-recovery-reserve-tokens 8192 Token reserve allocated for self-recovery context.
agent.verification-reserve-tokens 4096 Token reserve allocated for post-mutation verification.
agent.tool-result-reserve-tokens 4096 Input space reserved for tool results. All three reserves are clamped against usable model input and do not increase the model context window.

4. Security Approval Policy (approval)

Config Key Default Allowed Values & Description
approval.timeout-seconds 600 Pending approval web request expiration timeout in seconds.
approval.file-read ask ask (prompt admin) or auto for filesystem reads.
approval.file-write ask ask or auto for filesystem modifications.
approval.minecraft-write ask ask or auto for in-game Minecraft mutations.

5. Filesystem Boundary (filesystem)

Config KeyDefaultDetailed Description
filesystem.root.Capability boundary resolved from the server working directory when relative. Path traversal and symlinks do not grant access outside it.
filesystem.sensitive-name-patterns[]Java regular expressions applied to sensitive names. An invalid regex fails configuration loading.
filesystem:
  root: "."
  sensitive-name-patterns:
    - "(?i).*\\.(pem|key|p12)$"
    - "(?i)^(secrets?|credentials?)\\..*$"

6. Memory Capacity and Consolidation (memory)

Config KeyDefaultDetailed Description
memory.max-recent-turns80Stored recent-turn capacity. It does not mean every turn is copied verbatim into each prompt.
memory.max-tasks500Maximum episodic task records retained by the canonical memory store.
memory.max-facts500Maximum durable fact records retained.
memory.consolidation.interval-hours24Consolidation interval. Runtime enforces a minimum of one hour.
memory.consolidation.min-age-days7Only sufficiently old memory is consolidated. Runtime enforces a minimum of one day.
memory.consolidation.similarity-threshold0.8Similarity threshold for grouping related memory. Lower values merge more aggressively.

7. Local Embedding Engine (embedding)

Config KeyDefaultDetailed Description
embedding.modelmultilingual-e5-smallBuilt-in semantic embedding model name.
embedding.quantizationint8Inference representation. float32 is normalized to fp32.
embedding.custom-model-path(empty)Optional custom ONNX path that overrides the built-in asset.
embedding.custom-tokenizer-path(empty)Optional tokenizer path; otherwise tokenizer.json is searched beside the model.
embedding.custom-dimension384Exact vector width for a custom model.

8. APR Resource Limits (apr)

Config Key Default Detailed Description
apr.enable true Master toggle for APR Docker runtime and Programs UI.
apr.runtime-image (sha256 digest) Docker execution runtime image pinned by SHA256 digest.
apr.builder-image (sha256 digest) Docker build image pinned by SHA256 digest.
apr.max-live-executions 4 Maximum concurrent container instances (1 - 32).
apr.total-cpu-percent 200 Aggregate CPU cap across containers (100 = 1 CPU Core).
apr.total-memory-mib 2048 Aggregate RAM limit across containers in MiB (32 - 65536).
apr.total-pids 96 Aggregate PIDs limit across containers (1 - 4096).

9. Self-Healing Subsystem (self-healing)

Config Key Default Detailed Description
self-healing.max-attempts 3 Maximum automated repair retries (1 - 5).
self-healing.time-budget-seconds 90 Time budget allocated for recovery (30 - 300s).
self-healing.circuit-breaker-threshold 3 Consecutive failure count before tripping circuit breaker (1 - 10).
A

Enable, Disable, Empty, and Value Behavior

This section explains what changes at runtime when a switch is enabled or disabled. YAML booleans must be unquoted true or false. Values such as "false", yes, and 0 are not interchangeable with a strict boolean.

web.auth.enabled

Enabled: recommended
web:
  host: "127.0.0.1"
  auth:
    enabled: true
    token: "ENV:MCAGENT_WEB_TOKEN"
  • Login requires the configured Web token.
  • McAgent creates an expiring session and checks CSRF state.
  • Startup fails when the token cannot be resolved.
  • This is mandatory for proxy, LAN, or public access.
Disabled: loopback development only
web:
  host: "127.0.0.1"
  auth:
    enabled: false
  • API authentication and CSRF checks are bypassed.
  • McAgent permits this only on localhost, 127.x.x.x, or IPv6 loopback.
  • Using 0.0.0.0 with auth disabled fails startup.
  • Any local process able to reach the port can operate the UI.
Unsafe example: host: "0.0.0.0" together with enabled: false is rejected. Do not work around this guard with a proxy that exposes an unauthenticated loopback service.

apr.enable

Enabled: APR is requested
apr:
  enable: true
  runtime-image: "repository@sha256:<64-hex>"
  builder-image: "repository@sha256:<64-hex>"
  • Docker readiness and exact image digests are checked.
  • Missing images may be pulled from the registry.
  • APR Agent capabilities, API routes, and Programs UI become available when readiness succeeds.
  • A Docker failure leaves APR unavailable. It never falls back to executing untrusted code on the host.
Disabled: APR is removed
apr:
  enable: false
  • No Docker runtime is initialized and no image is pulled.
  • APR tools are not exposed to the Agent.
  • APR API returns unavailable and Programs is hidden.
  • Existing Program files remain on disk, but cannot execute through McAgent.
Changing apr.enable requires a controlled server restart. It is not a live pause switch for already running external Docker processes; stop active Programs before disabling APR.

Approval modes are choices, not feature switches

ask: administrator decision
approval:
  file-read: ask
  file-write: ask
  minecraft-write: ask

The operation waits for an approval associated with the exact subject and arguments. A changed revision or target requires a new decision.

auto: baseline action may proceed
approval:
  file-read: auto
  file-write: auto
  minecraft-write: ask

Eligible baseline actions may proceed automatically. Code execution, Production placement, destructive actions, and exact mutation verification can still require stronger authority. auto is not an unrestricted mode.

Provider connection and discovery switches

SwitchWhen trueWhen falseRecommended use
connection.follow-redirectsCurrently parsed but does not turn redirects on. The active HTTP clients still do not follow them.Redirects are not followed, so a moved endpoint fails visibly.Keep false. Do not rely on true; point connection.url directly at the final endpoint.
model-discovery.enabledAt startup, McAgent sends a bounded GET request, finds the exact model ID, and reads the configured token-limit pointers.No discovery request is sent. Resolution starts at context-defaults.Use true only when the provider exposes stable metadata. Always define fallback defaults.
Discovery enabled
model-discovery:
  enabled: true
  url: "${config.base-url}/models"
  timeout-ms: 5000
  items-pointer: "/data"
  id-pointer: "/id"
  context-window-pointers:
    - "/context_length"
context-defaults:
  context-window-tokens: 32768
  max-output-tokens: 4096

Success produces source=provider_api. Timeout, non-2xx, oversized response, wrong pointer, or no exact model match falls back without crashing.

Discovery disabled
model-discovery:
  enabled: false
context-defaults:
  context-window-tokens: 32768
  max-output-tokens: 4096

No /models request occurs. Valid defaults produce source=provider_profile. If defaults are also absent or invalid, McAgent uses its conservative built-in fallback.

Provider capability declarations

Capability values describe the provider protocol. They do not add support to a model that lacks it. The request/response mappings and the real endpoint must agree with every declaration.

CapabilitytruefalseFailure example
streamingProvider diagnostics exercise SSE/NDJSON deltas using the stream mappings.Streaming conformance test is skipped. This declaration alone does not rewrite the request body.Declaring true while mapping the wrong delta pointer produces empty or broken streamed text.
tool-callingProvider is eligible for McAgent tool workflows and tool conformance testing.Capability health reports tool calling unsupported; the model cannot safely operate McAgent as an agent.A chat-only fallback model may answer fluently but never call a server tool.
parallel-tool-callsRecords that the API understands parallel calls.Records sequential support.This is descriptive in the current runtime. McAgent forces a mapped parallel_tool_calls request field to false so mutations are serialized safely.
vision-inputImage parts may be mapped as provider input.The provider reports that image input is unsupported.Do not mark true merely because the model name has a vision variant.
usage-reportingDeclares that usage counts are supported.Declares that usage is unavailable.This declaration is descriptive in the current runtime; configured usage pointers are still parsed and diagnostics still report PASS or ABSENT.
system-messageDeclares compatibility with McAgent's system-role instruction contract.Declares incompatibility with that contract.This declaration does not transform messages. McAgent still emits a system-role message, so the real endpoint must support it.
Do not disable only one side of streaming: setting capabilities.streaming: false does not rewrite request.body.stream or remove stream pointers. A custom non-streaming profile must have internally consistent request handling and must pass the provider test.

Callable Program switch

callable.enabled: true
"callable": {
  "enabled": true,
  "name": "player_status",
  "entryClass": "apr.example.Main",
  "entryContract": "public_static_string_invoke_string_v1"
}

A Java ONE_SHOT Program can expose CALL after schema, operation policy, build, placement, and approval checks succeed.

callable.enabled: false or no callable
"callable": null,
"operations": {}

The Program may still BUILD and use its normal RUN/START lifecycle, but it does not expose a named JSON callable contract.

Empty values and empty lists

SettingEmpty value meansConfigured example
base-url: ""Acceptable only when the selected provider profile does not reference ${config.base-url}.local-gateway needs an API base such as http://127.0.0.1:20128/v1.
web.public-url: ""No separate public canonical URL. Bind host and port still control the listener.Set https://agent.example.com behind a reverse proxy.
sensitive-name-patterns: []No administrator-added filename regex. Filesystem root, path, approval, and secret guards still apply.Add (?i).*\.(pem|key|p12)$ to protect private-key filenames.
custom-model-path: ""Use the selected built-in embedding model.Set an ONNX path plus exact dimension for a custom model.
custom-tokenizer-path: ""Look for tokenizer.json beside the custom model.Set the path when tokenizer assets live elsewhere.
modules: []The Program has no pinned global APR Modules.Use PIN_PROGRAM to write exact references instead of editing them manually.
optionalApiDependencies: []No optional compile metadata is declared.Adding an ID does not install a package or grant Production authority.

Practical value examples

SettingLower or zero exampleHigher exampleWhat it does not do
agent.task-timeout-seconds300 ends slow Agent tasks sooner.7200 supports long investigations.It does not define the lifetime of a successfully started Production listener.
Agent token reserves0 reserves no dedicated space for that phase.4096 or 8192 protects recovery, verification, or tool output room.It does not increase the model's context window.
similarity-threshold0.6 consolidates more aggressively and risks merging loosely related facts.0.95 requires very close similarity and retains more separate records.It does not control chat-model creativity.
apr.max-live-executions1 serializes execution reservations.8 allows more concurrency if total CPU, RAM, and PID pools can support it.It does not multiply the aggregate resource pool.
self-healing.max-attempts1 stops after one recovery attempt.5 permits more bounded attempts.It never bypasses approval, isolation, or policy failures.

Switch verification cases

IDSetupActionExpected result
SW-01Auth enabled with a resolved token.Login once with a wrong token, then with the correct token.Wrong token creates no session. Correct token creates an expiring session.
SW-02Auth disabled on 127.0.0.1.Start Paper and call a read-only Web API locally.Startup succeeds and local API access does not require a normal session.
SW-03Auth disabled on 0.0.0.0.Start Paper.Startup rejects the configuration before exposing the UI.
SW-04apr.enable: false.Restart and inspect UI, Agent capabilities, API, Docker logs, and existing Program files.APR surfaces are unavailable, no image pull occurs, and existing files are preserved.
SW-05apr.enable: true with Docker stopped.Restart Paper.APR reports unavailable and no host execution fallback occurs.
SW-06Discovery enabled with an exact model item.Restart and inspect context startup log.source=provider_api and resolved limits match the discovered item.
SW-07Discovery disabled with valid defaults.Restart while monitoring the model endpoint.No models request is sent and source=provider_profile is logged.
SW-08tool-calling: false in a disposable provider profile.Run the provider diagnostic and inspect capability health.Tool conformance is not accepted and Agent capability health reports the incompatibility.
SW-09A built Program with no callable contract.Attempt CALL, then use its supported normal lifecycle.CALL is unavailable; valid RUN/START behavior remains based on Program type.
B

Configuration Scenarios

Start from the baseline in Step 4, then apply only the delta for the environment below.

Local gatewayKeep Web bound to loopback and set the gateway base URL explicitly.
No DockerSet apr.enable: false; no APR tool or UI surface remains active.
Reverse proxyKeep the plugin private; terminate HTTPS and access control at the proxy.
Production APRUse immutable image digests, bounded pools, and explicit approvals.
9Router or another local OpenAI-compatible gateway
provider: local-gateway
model: ag/claude-sonnet-4-6
api-key: "ENV:OPENAI_API_KEY"
base-url: "http://127.0.0.1:20128/v1"

Verify GET http://127.0.0.1:20128/v1/models contains the exact model ID. Configure the router to fail fast or fall back only to a model with equivalent tool calling. If it silently routes to a weaker model under the same ID, McAgent cannot reliably detect the substitution.

Server without Docker or with APR intentionally disabled
apr:
  enable: false

Restart after the change. PASS means no image pull, no APR runtime initialization, no APR Agent capability, APR API reports unavailable, and Programs is absent from the Web UI.

Web UI behind an HTTPS reverse proxy
web:
  host: "127.0.0.1"
  port: 8765
  public-url: "https://agent.example.com"
  auth:
    enabled: true
    token: "ENV:MCAGENT_WEB_TOKEN"
    session-timeout-minutes: 240

public-url is canonical display metadata, not a bind address. Keep the backend on loopback when the proxy runs on the same host. Forward WebSocket/streaming traffic, set request limits, and never expose a no-auth listener to the Internet.

Conservative production safety profile

Keep all three approval policies on ask, restrict filesystem.root, add secret filename patterns, pin both Docker images by digest, and measure real workload before increasing Agent or APR limits. More steps, retries, CPU, or memory cannot compensate for a non-compliant model.

C

Test Case Matrix

Run mutation cases on a disposable Paper fixture. Record the McAgent JAR hash, Java/Paper versions, redacted config, provider/model, context source, image digests, exact task, approval decision, and terminal excerpt.

IDActionPASS condition
CFG-01Boot with valid baseline config and secrets already present in the Java process.Plugin enables, provider is ready, Web URL is logged, and no config exception occurs.
CFG-02On a fixture, set apr.enable: "false" as a string.Strict validation rejects it. Boolean false succeeds.
PRV-01Expose exact selected model in the discovery endpoint and restart.Startup log reports source=provider_api with correct limits.
PRV-02Make discovery unavailable while chat remains reachable.Provider remains usable and reports source=provider_profile.
PRV-03Ask for players, plugin inspection, and a no-mutation Plan Mode task.Model uses correct read tools, never fabricates authority, and Plan Mode does not mutate.
WEB-01Test correct token, incorrect token, and session expiry.Only correct unexpired session authenticates; secrets never appear in responses.
MEM-01Store a known fact, create timeline messages, then Reset History.Timeline clears and the fact remains retrievable.
MEM-02Back up, approve exact Reset Memory, then inspect both stores.Canonical memory is reinitialized; History is not falsely reported as reset.
APR-01Start with APR enabled on a clean Docker image cache.Exact digest images are pulled; failure never falls back to host execution or latest.
APR-P01CATALOG, CREATE, WRITE, DEFINE, BUILD, RUN a ONE_SHOT Program.Every state transition succeeds and output belongs to the built revision.
APR-P02Edit source after BUILD, then RUN without rebuilding.BUILD_REQUIRED or STALE_BUILD is returned.
APR-P03START a Production listener, verify RUNNING once, then let the Agent task end.Listener stays running until STOP; the task does not poll indefinitely.
APR-P04Call a MUTATION operation that returns ok=true.Task still performs the declared native verifier against the exact target.
APR-M01Build exact pip/npm dependencies, then RUN again.Install occurs only during BUILD; RUN has no package-network step.
APR-M02Promote revision B after a Program pinned revision A.The Program remains on A until PIN_PROGRAM and BUILD.
SH-01Return one transient provider error, then recover.Recovery stays within budget and does not duplicate a mutation.
Evidence rule: A model statement, Program log, or self-reported ok=true is not proof of a mutation. PASS requires independent read-back from the proper native authority.
D

Symptom Diagnostics

SymptomInspect firstCorrect response
Agent chats but does not use toolsActual router fallback model and provider tool capability.Use a tool-capable model or fail-fast route. Do not raise step limits first.
Context is smaller than model marketing claimsStartup source=, discovery JSON pointers, exact model ID.Fix provider discovery or context-defaults, not config.yml.
Web UI does not openBind host, port ownership, firewall, reverse proxy.Correct networking; keep authentication enabled.
Login returns 401Web token environment variable in the running Java process.Use the Web token, not the model API key, then restart if the environment changed.
Programs button is absentapr.enable, restart, Docker readiness, image digest.Enable APR with a real boolean and repair Docker/image availability.
pip/npm BUILD failsExact version, registry access, builder terminal.Fix dependency declarations; never install on host or during RUN.
RUN reports staleSource, manifest, Module projection, environment revision.BUILD the current revision.
Bukkit import fails in DETACHEDPlacement and execution type.Use the appropriate Production Java contract; detached containers cannot access live Paper API.
Production listener stops with Agent taskWhether it was actually LONG_RUNNING + PRODUCTION_CURRENT_SERVER.Use the Production listener lifecycle and STOP explicitly.
Listener does not auto-restoreRuntime automatic state and durable grant.Current public Agent DEFINE sets automatic=false; a grant alone is not an auto-start switch.
Mutation says success but task remains activeVerification state and operation policy.Run the declared native verifier against the exact target.
Module cannot promote or pinRevision state, hashes, kind, revocation.QUALIFY or select another valid revision, then PIN_PROGRAM and BUILD.
Approval remains pendingPending approval subject and expiry.Approve or deny the exact operation. Do not submit duplicate tasks.
Release readiness checklist
  • Unit tests and package build pass; JAR runs on a clean supported Paper fixture.
  • Provider discovery and provider-profile fallback both pass.
  • Secrets are absent from console, trace, terminal, export, and screenshots.
  • Reset History and Reset Memory pass independently for approve and deny paths.
  • apr.enable=false removes the entire APR surface.
  • Runtime and builder image digests pull on a clean Docker host.
  • ONE_SHOT, detached long-running, Production callable, and Production listener have separate tests.
  • Exact pip/npm dependency builds pass and RUN performs no install.
  • Module acquire, qualify, promote, pin, rollback, and revoke fail closed.
  • A stopped-server backup and restore drill succeeds.