#15644·AFFiNE

[Bug]: "Create credential" in MCP Server settings on self-hosted fails with generic "you are not allowed to perform this action" when Copilot is disabled (the default)

Author: zaakiyCreated Sep 25, 2026Updated Sep 25, 2026

What happened?

On a default self-hosted instance, creating an MCP credential from Settings → Integrations → MCP Server → Create credential fails with:

You are not allowed to perform this action.

No credential is created. The message reads like a workspace role/permission problem, but it is not one — the mutation only requires Workspace.Read. The actual cause is that MCP credential creation is gated behind copilot.enabled, which defaults to false on self-hosted, and nothing in the UI indicates this.

Steps to reproduce

  1. Deploy AFFiNE self-hosted with default configuration (Copilot/AI never enabled).
  2. Open a workspace → Settings → Integrations → MCP Server (the section is visible).
  3. Click "Create credential" → generic permission error.

Expected: the section is hidden/disabled with a hint that AI features must be enabled (with a docs link), or creation succeeds, or at minimum the error states the real cause.

Root cause (checked against 0.27.4 source, commit ca0ffc52f78187382928c90293cd487618f5f024):

typescript
export function assertCopilotEnabled(config: Config) {
  if (!config.copilot.enabled) {
    throw new ActionForbidden('Copilot is disabled.');
  }
}
  • copilot.enabled defaults to false — plugins/copilot/config.ts#L73-L81
  • The client shows the generic action_forbidden text (base/error/def.ts#L464-L469) and drops the specific "Copilot is disabled." message.
  • The frontend renders the MCP Server section even though serverConfig.features already reports whether Copilot is enabled, so the UI advertises a feature the backend will refuse.

Suggestions

  1. Hide/disable the MCP Server settings section when serverConfig.features lacks Copilot, with a hint + docs link.
  2. Surface the concrete error message ("Copilot is disabled") instead of the generic action_forbidden string.
  3. Consider decoupling read-only MCP (doc_search, read_document) from copilot.enabled — these tools don't need an LLM provider, but currently require enabling AI features.

Workaround (verified on 0.27.4): add to /root/.affine/config/config.json (host ./config/config.json in the official Docker Compose setup) and restart:

json
{ "copilot": { "enabled": true, "byok": { "enabled": true } } }

Distribution version

Not applicable — web, self-hosted

App Version

No response

What browsers are you seeing the problem on if you're using web version?

Not browser-specific — the failure is a server-side guard; verified via direct GraphQL queries against the server.

Are you self-hosting?

  • Yes

Self-hosting Version

0.27.4 (ghcr.io/toeverything/affine:stable, Docker Compose)

Relevant log output

bash
# Default config: "Create credential" in the UI fails with
#   "You are not allowed to perform this action."
# Server reports no Copilot feature:
$ curl -s http://localhost:3010/graphql -H 'Content-Type: application/json' \
  -d '{"query":"{ serverConfig { version features } }"}'
{"data":{"serverConfig":{"version":"0.27.4","features":["Comment","CopilotEmbedding","OAuth"]}}}

# After adding {"copilot":{"enabled":true,"byok":{"enabled":true}}} to
# /root/.affine/config/config.json and restarting the app container:
{"data":{"serverConfig":{"version":"0.27.4","features":["Comment","Copilot","CopilotEmbedding","OAuth"]}}}
# -> credential creation now succeeds

Anything else?

Related issues that are similar but different (not duplicates):

  • #15506 — AI chat failing with copilot_disabled (native runtime not reading config.json; different layer than the credential-creation guard)
  • #15112 — feature request for MCP write tools (this report is about the default read-only flow failing entirely)
  • #15567 — "Can't make MCP Write" (access-mode availability, not this permission error)

Is your content generated by AI?

  • I confirm that the content I submitted was not generated by AI / merely contained minimal AI edits.
  • It was created mostly by AI after thorough interactive Human + AI session for troubleshooting and diagnosis.