Skip to content

Tell self-hosters to set APP_URL, because email and connected-app links use it #337

Description

@HMarzban

Parent

#328. Related: #230

What to build

The server builds public links from APP_URL. Today that covers digest and notice emails, the create_document link, and the MCP server's websiteUrl. A self-host that leaves APP_URL unset sends all of them to https://docs.plus. The self-hosting docs do not say this.

Already done in cdb222d40 and 0dacee392: one trimmed APP_URL with a fallback, and appUrl in the MCP deps. The shared link helpers move to #343, their first user.

Acceptance criteria

  • docs/self-hosting/configuration.md §Turn on the MCP connector says: "Set APP_URL to your webapp address. Connected apps and emails build links from it. If it is unset, those links point at https://docs.plus."
  • The APP_URL row in docs/self-hosting/install.md reads "Your editor domain, used in email and connected-app links". The table stays aligned.
  • No code change.

Blocked by

None — can start now.

Agent brief

Type: AFK — docs only.

  • apps/hocuspocus.server/ENV.md already states the trim, the fallback and the link uses. It needs no change.
  • Prose follows .cursor/skills/tech-writer/SKILL.md §Simplified English (house standard).
  • Verify: bun run format passes at the repo root.

Out of scope

Activity

  1. HMarzban commented on Sep 28, 2026

    @HMarzban
    CollaboratorAuthor

    Part of this issue is covered by two commits on main. They are committed locally and go up with the next push.

    Done

    • One clean APP_URL (cdb222d40, fix(hocuspocus): read APP_URL once, without a trailing slash).
      • config/env.ts now computes (env.APP_URL || 'https://docs.plus').replace(/\/+$/, '') once.
      • config.email.appUrl and the CORS fallback both use it. So a blank APP_URL= no longer gives '', and a trailing / is removed.
      • The email sender, the new-document notice and api/email.ts read config.email.appUrl instead of process.env.APP_URL. So the digest path through pgmqConsumer.ts gets the clean value too.
      • apps/hocuspocus.server/ENV.md describes the trim and the fallback.
    • MCP gets the app URL (0dacee392, feat(hocuspocus): add the create_document MCP tool).
      • MCP InitDeps and ServerFactoryDeps carry appUrl, and src/index.ts passes config.email.appUrl.
      • One tool output uses it already: the new create_document returns <appUrl>/<slug>. No existing tool output changed.

    Still open in this issue

    • The shared buildDocumentUrl / buildHeadingUrl helper, and deleting the digest's private sectionUrl. It is still in digestContentChanges.ts.
    • docs/self-hosting/configuration.md: telling operators to set APP_URL.
    • docs/self-hosting/install.md:66: the APP_URL row still says "used in email links" only.

    So acceptance items 3 and 4 are met. Items 1, 2, 6 and 7 remain.

  2. changed the title [-]Give the MCP module the app URL and one server heading-link helper[/-] [+]Tell self-hosters to set APP_URL, because email and connected-app links use it[/+] on Sep 29, 2026
  3. HMarzban commented on Oct 7, 2026

    @HMarzban
    CollaboratorAuthor

    One more env value for this issue: PUBLIC_RESTAPI_URL also sets the MCP resource URL (apps/hocuspocus.server/src/index.ts:134, src/modules/mcp/http/controller.ts:23-24). When it is unset, the URL falls back to the request origin, so a self-hoster behind a proxy must set it. Please document it in apps/hocuspocus.server/ENV.md (which today says only two conversion paths read it) and in docs/self-hosting/configuration.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions