{% from '_helpers.html' import render_checkbox_field, render_button %} {% from '_stab.html' import stab_shell, stab_pane %} {# The "MCP Server" part of /settings/ai/mcp, included by llm-settings.html (the wrapper with the tab rows and the scripts). Vertical sub-tabs (_stab.html) like the AI / LLM part, the on/off switch at the top of Overview; everything can be set up while the switch is off. One form with its Save button at the bottom; the access tokens are managed in an overlay after it (nested forms are invalid), with ajax (mcp-tokens.js). Requires template context: form (forms.globalMCPSettingsPageForm), token_form (forms.MCPTokenForm), mcp_disabled, mcp_enabled, mcp_url, mcp_tokens (see mcp_template_context()). #} {% macro copyable(text, id, block=False) -%} {%- if block -%}
{{ text }}
{%- else -%} {{ text }} {%- endif -%} {%- endmacro %} {% from '_mcp-permissions-grid.html' import permissions_grid %}
{% if mcp_disabled %}
{{ _('Connect AI assistants with MCP') }} {{ _('The MCP server is switched off on this installation.') }}
{% else %} {# Every sub-tab can be set up while the switch is off, so it's ready before anything can connect. "OAuth" is the protocol's name, not translated #} {% call stab_shell('mcp-settings', [ {'id': 'overview', 'label': _('Overview'), 'icon': 'info'}, {'id': 'tokens', 'label': _('Access tokens'), 'icon': 'key'}, {'id': 'connect', 'label': _('Connect: %(method)s', method=_('Token')), 'icon': 'link'}, {'id': 'oauth', 'label': _('Connect: %(method)s', method='OAuth'), 'icon': 'log-in'}, ]) %} {# ── Overview ──────────────────────────────────────────────────────────── #} {% call stab_pane('overview') %} MCP - A way for AI Assistants to interact with changedetection.io

{{ _('Connect AI assistants with MCP') }}

{{ _('MCP (Model Context Protocol) is an open standard that lets AI assistants such as Claude, ChatGPT, Cursor and VS Code use other applications as tools.') }}

{{ render_checkbox_field(form.enabled) }} {% if not mcp_enabled %} {{ _('Off: the MCP and OAuth endpoints are switched off and no assistant can connect. Everything here can still be set up first.') }} {% endif %}
{% if mcp_enabled %}{{ _('On') }}{% else %}{{ _('Off') }}{% endif %}
{# The tokens at a glance, or "Get started" until it's set up. Swapped after every token change (mcp-tokens.js) #}
{% include '_mcp-overview-status.html' %}
{{ _('Look') }}

{{ _('List monitors and groups, what changed between two dates, diffs, page snapshots, errors and what is being checked right now.') }}

{{ _('Change') }}

{{ _('Add monitors, change their settings, tag them, recheck them and set up notifications, as far as the permissions allow.') }}

{{ _('Safe by default') }}

{{ _('Text from monitored pages is passed on to the assistant as data. Notification URLs are never shown to it in full.') }}

{% endcall %} {# ── Connect ───────────────────────────────────────────────────────────── #} {% call stab_pane('connect') %}

{{ _('Server') }}

{{ _('Server address') }}
{{ copyable(mcp_url, 'mcp-url') }}
{{ _('MCP access token') }}

{{ _('Add a token for each assistant on the Access tokens sub-tab. It is shown once, when it is created.') }}

{{ _('Treat it like a password.') }} {{ _('It does not expire, and anyone who has it can use these tools and read what they return. Never paste it into a file you commit or share.') }}

{{ _('Most assistants below can read it from an environment variable, so it stays out of their config files. Set it once, for example in ~/.bashrc or ~/.zshrc:') }}

{{ copyable('export CDIO_MCP_TOKEN=YOUR_MCP_TOKEN', 'mcp-token-env', block=True) }}

Claude Code

{{ _('Run this in a terminal, then start a new Claude Code session and ask, for example, "Which of my monitors have errors?"') }}

{{ copyable('claude mcp add --transport http changedetection ' ~ mcp_url ~ ' --header "Authorization: Bearer $CDIO_MCP_TOKEN"', 'mcp-claude-code', block=True) }}

{{ _('To remove it again:') }} claude mcp remove changedetection

{# Claude Code expands ${VAR} in headers, so the project form stores a reference, never the token #}

{{ _('By default (--scope local) Claude Code saves this in ~/.claude.json, only for you and only in the current project. Add --scope user to have it in all your projects.') }}

{{ _('--scope project writes .mcp.json into the project, which is usually committed. Use this form there instead, it saves a reference to the environment variable, not the token:') }}

{{ copyable("claude mcp add --transport http --scope project changedetection " ~ mcp_url ~ " --header 'Authorization: Bearer ${CDIO_MCP_TOKEN}'", 'mcp-claude-code-project', block=True) }} {#- Config syntax checked against each client's own docs (2026-11-01). Where a client resolves environment variables in headers the token stays out of the file (CDIO_MCP_TOKEN); where it doesn't, it's inline and the file is the user's own settings, with a warning. See MCP-config.md. -#} {%- set token_in_file -%}

{{ _('This file contains the token: keep it in your own settings, not in anything you commit or share.') }}

{%- endset -%}

Cursor ~/.cursor/mcp.json

{{ copyable('{"mcpServers": {"changedetection": {"url": "' ~ mcp_url ~ '", "headers": {"Authorization": "Bearer ${env:CDIO_MCP_TOKEN}"}}}}', 'mcp-cursor', block=True) }}

VS Code / GitHub Copilot .vscode/mcp.json

{{ _('VS Code asks for the token once and stores it securely, so this file is safe to commit.') }}

{{ copyable('{"inputs": [{"type": "promptString", "id": "cdio-mcp-token", "description": "changedetection.io MCP access token", "password": true}], "servers": {"changedetection": {"type": "http", "url": "' ~ mcp_url ~ '", "headers": {"Authorization": "Bearer ${input:cdio-mcp-token}"}}}}', 'mcp-vscode', block=True) }}

OpenAI Codex ~/.codex/config.toml

{{ copyable('[mcp_servers.changedetection]\nurl = "' ~ mcp_url ~ '"\nbearer_token_env_var = "CDIO_MCP_TOKEN"', 'mcp-codex', block=True) }}

OpenCode opencode.json

{{ copyable('{"mcp": {"changedetection": {"type": "remote", "url": "' ~ mcp_url ~ '", "oauth": false, "headers": {"Authorization": "Bearer {env:CDIO_MCP_TOKEN}"}}}}', 'mcp-opencode', block=True) }}

Gemini CLI ~/.gemini/settings.json

{{ _('Uses httpUrl, not url (url means the older SSE transport).') }}

{{ copyable('{"mcpServers": {"changedetection": {"httpUrl": "' ~ mcp_url ~ '", "headers": {"Authorization": "Bearer YOUR_MCP_TOKEN"}}}}', 'mcp-gemini', block=True) }} {{ token_in_file }}

GitHub Copilot CLI ~/.copilot/mcp-config.json

{{ copyable('copilot mcp add --transport http --header "Authorization: Bearer $CDIO_MCP_TOKEN" changedetection ' ~ mcp_url, 'mcp-copilot-cli', block=True) }} {{ token_in_file }}

Zed settings.json

{{ copyable('{"context_servers": {"changedetection": {"url": "' ~ mcp_url ~ '", "headers": {"Authorization": "Bearer YOUR_MCP_TOKEN"}}}}', 'mcp-zed', block=True) }} {{ token_in_file }}

Claude Desktop claude_desktop_config.json

{{ _('Through the mcp-remote bridge (needs Node.js), since Claude Desktop connectors only support sign-in, not an access token.') }}

{{ copyable('{"mcpServers": {"changedetection": {"command": "npx", "args": ["-y", "mcp-remote", "' ~ mcp_url ~ '", "--header", "Authorization:${MCP_AUTH}"], "env": {"MCP_AUTH": "Bearer YOUR_MCP_TOKEN"}}}}', 'mcp-claude-desktop', block=True) }} {{ token_in_file }}

{{ _('Any other assistant (Windsurf, Devin and others)') }}

{{ _("Most assistants can run a local command: the same mcp-remote bridge (needs Node.js), in the format of that assistant's MCP settings.") }}

{{ copyable('{"command": "npx", "args": ["-y", "mcp-remote", "' ~ mcp_url ~ '", "--header", "Authorization:${MCP_AUTH}"], "env": {"MCP_AUTH": "Bearer YOUR_MCP_TOKEN"}}', 'mcp-other', block=True) }} {{ token_in_file }} {% endcall %} {# ── Access tokens ─────────────────────────────────────────────────────── #} {% call stab_pane('tokens') %}

{{ _('Access tokens') }}

{{ _('One for each assistant, each with its own permissions. Revoking one disconnects only that assistant.') }}

{% include '_mcp-tokens.html' %}

{{ _('Notifications are read-only by default. A page an assistant reads could try to get it to send your alerts, and the page text in them, somewhere else.') }}

{{ _('To make only one assistant read-only, use this address for it instead:') }}

{{ copyable(mcp_url ~ '?readonly=1', 'mcp-url-readonly') }} {% endcall %} {# ── OAuth connections ─────────────────────────────────────────────────── #} {% call stab_pane('oauth') %}

{{ _('OAuth connections') }}

{{ _('ChatGPT and claude.ai in the browser connect with sign-in (OAuth) instead of an access token: you log in here and choose what the assistant may do.') }}

{% if mcp_oauth_available %}

{{ _('Add this address as a custom connector in the assistant, it needs to be reachable over HTTPS://') }}

{{ copyable(mcp_url, 'mcp-oauth-url') }} {% elif not mcp_password_set %}
{# The link is put in by the template, translations only carry its placeholders, never HTML #}

{{ _('Sign-in needs a login to sit behind: %(link_start)sset a password%(link_end)s (Settings > General) to allow it.', link_start=''|format(url_for('settings.settings_page')|e), link_end='')|safe }}

{% else %}

{{ _('Switch on the MCP server (Overview) to allow sign-in.') }}

{% endif %} {#- Step by step for the two assistants people ask about. Menu names change, so the steps say where to look and link the assistant's own help. Links are put in by the template, translations only carry placeholders #} {%- set ext = '" target="_blank" rel="noopener">' -%}

Claude (claude.ai)

  1. {{ _('Open %(link_start)sCustomize > Connectors%(link_end)s on claude.ai.', link_start='
  2. {{ _('Give it a name, for example changedetection.io, and paste this as the remote MCP server URL:') }} {{ copyable(mcp_url, 'mcp-oauth-url-claude') }}
  3. {{ _('Leave the sign-in setting as Claude detects it, then click Add.') }}
  4. {{ _('Click Connect: you come here to log in, choose what Claude may do and click Allow, then you are sent back to Claude.') }}

{{ _('On Team and Enterprise plans an Owner adds it under Organization settings > Connectors, then each member clicks Connect.') }} {{ _('%(link_start)sClaude help: custom connectors%(link_end)s', link_start='ChatGPT (OpenAI)

  1. {{ _('In ChatGPT, open Settings > Apps & Connectors > Advanced settings and switch on Developer mode. On some accounts it is under Settings > Security.') }}
  2. {{ _('Back in Apps & Connectors, click Create (or "Add custom connector").') }}
  3. {{ _('Give it a name, paste this as the MCP server URL and choose OAuth as the authentication:') }} {{ copyable(mcp_url, 'mcp-oauth-url-chatgpt') }}
  4. {{ _('Confirm and click Create: you come here to log in, choose what ChatGPT may do and click Allow.') }}
  5. {{ _('In a chat, click +, choose Developer mode and pick the connector.') }}

{{ _('Custom connectors need a paid ChatGPT plan; on Business and Enterprise plans an admin may need to allow them first.') }}

{{ _('Signed in') }}

{% include '_mcp-oauth-grants.html' %}
{% endcall %} {% endcall %} {% endif %} {% if not mcp_disabled %}
{{ render_button(form.save_button) }}
{% endif %}
{% if not mcp_disabled %} {# Add / edit an access token, sent with ajax by mcp-tokens.js (X-CSRFToken header from csrf.js). After "Add" it shows the new token once #}
{% endif %}