Skip to content

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

Open

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 and icon (apps/hocuspocus.server/src/modules/mcp/http/serverFactory.ts). A self-host that leaves APP_URL unset sends all of them to https://docs.plus. So a self-host connector shows the docs.plus website and icon inside Claude or ChatGPT. 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.

Open: criterion 1 only. PUBLIC_RESTAPI_URL for MCP is done (ENV.md §Public origin, configuration.md §Turn on the MCP connector). The link helper belongs to #343.

Benchmark

Field Value
Metric (1) Lines in docs/self-hosting/configuration.md §Turn on the MCP connector that name APP_URL (exact count). (2) Connector outputs that point at the self-host when APP_URL is set: the create_document link, the server websiteUrl and the server icon (exact, of 3).
Before (1) 0 on 2026-11-11 at 0b302b222, with the command below. (2) not measured yet: the builder reads it before the docs edit, on a local stack with APP_URL unset.
After not measured yet
Condition Local stack at the commit that closes this issue. Name the date and the commit.
How to run (1) sed -n '/^## Turn on the MCP connector/,/^## Turn on Google/p' docs/self-hosting/configuration.md | grep -c APP_URL. (2) Start the local stack with APP_URL=http://localhost:3000. Read websiteUrl and icons from the MCP initialize result, and the link from one create_document reply. Repeat with APP_URL unset for the before.
Pass rule (1) 1 or more. (2) 3 of 3 point at http://localhost:3000 when it is set. If (2) is below 3 of 3, stop: that is a code bug, so file it under #343 and do not close this issue on docs alone.
Guard bun run format and bun run check:agent-docs pass. No code change.
Owner agent in the repo writes the sentence and runs both checks; maintainer reviews
Claim None. This is an internal docs fix.

Acceptance criteria

  • docs/self-hosting/configuration.md §Turn on the MCP connector says: "Set APP_URL to your webapp address. Emails, the create_document link, and the connector's website and icon use it. If it is unset, they point at https://docs.plus."
  • The APP_URL row in docs/self-hosting/install.md keeps its ENV.md link. That ENV.md section already names MCP links. No change.
  • 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 .agents/skills/tech-writer/SKILL.md §Simplified English (house standard).
  • Verify: sed -n '/^## Turn on the MCP connector/,/^## Turn on Google/p' docs/self-hosting/configuration.md | grep -c APP_URL prints 1 or more. Then bun run format and bun run check:agent-docs pass at the repo root.
  • Owner: an agent writes the sentence. The maintainer reviews it.

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.

  4. added this to the v2.4.0 milestone on Oct 24, 2026
  5. modified the milestones: v2.4.0, v2.3.6 on Nov 9, 2026
  6. HMarzban commented on Nov 11, 2026

    @HMarzban
    CollaboratorAuthor

    Moved to v2.4.0, 2026-11-11

    Maintainer ruling, 2026-11-11: this issue moves to milestone v2.4.0, beside #343. It came into v2.3.6 in a bulk move on 2026-11-09, with no reason given. It is a one-sentence docs fix, with no speed effect.

    Body changes, checked at 0b302b222:

    • Only criterion 1 is open. The install.md row already links to ENV.md §Email, and ENV.md names MCP links. So criterion 2 needs no change.
    • The PUBLIC_RESTAPI_URL ask from 2026-10-07 is done: ENV.md §Public origin and configuration.md §Turn on the MCP connector.
    • The 2026-09-28 note "Items 1, 2, 6 and 7 remain" is stale. The link helper went to Add links and Comment quotes to MCP reads #343.
    • Criterion 1 now names the connector's website and icon too (serverFactory.ts).
    • The skill path is now .agents/skills/tech-writer/SKILL.md.
    • New §Benchmark. Today §Turn on the MCP connector names APP_URL 0 times.
  7. modified the milestones: v2.3.6, v2.4.0 on Nov 11, 2026
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions