fix(mcp-server): let a deployed standalone server know its public url - #1832
Merged
Conversation
Scra3
force-pushed
the
fix/mcp-standalone-public-url
branch
from
August 17, 2026 13:26
b68627b to
e59196d
Compare
|
Coverage Impact This PR will not change total coverage. Modified Files with Diff Coverage (1)
🛟 Help
|
Scra3
force-pushed
the
fix/mcp-standalone-public-url
branch
2 times, most recently
from
August 17, 2026 13:35
3d38b02 to
029f626
Compare
1 new issue
|
Scra3
force-pushed
the
fix/mcp-standalone-public-url
branch
3 times, most recently
from
August 17, 2026 14:24
e6b0a5b to
4d627f5
Compare
Scra3
force-pushed
the
fix/mcp-standalone-public-url
branch
from
August 17, 2026 14:49
4d627f5 to
61dd1d9
Compare
hercemer42
requested changes
Aug 18, 2026
Scra3
force-pushed
the
fix/mcp-standalone-public-url
branch
3 times, most recently
from
August 18, 2026 08:03
f8225f8 to
4edd242
Compare
Scra3
force-pushed
the
fix/mcp-standalone-public-url
branch
from
August 18, 2026 08:08
4edd242 to
a2e357d
Compare
Scra3
force-pushed
the
fix/mcp-standalone-public-url
branch
from
August 18, 2026 08:14
a2e357d to
beda2fb
Compare
run() hardcoded baseUrl to http://localhost:<port>, and that explicit value wins over the environment's api_endpoint. A process cannot derive its own public url — dns, proxy and tls termination live outside it — so a deployed standalone server advertised localhost as its OAuth issuer, and on the in-memory store minted localhost upload urls no remote client can reach. FOREST_MCP_SERVER_URL, when set, becomes the base url and fixes both at once. Unset, nothing changes. The value must be an http(s) origin with no path, query, fragment or credentials, enforced at startup: the OAuth endpoints are concatenated onto the href and the uploads base resolves against the origin, so anything else advertises broken urls that only fail once a client follows them. The rejection reports the parsed origin rather than the raw value, so credentials this check exists to withhold do not end up in the logs instead. MCP_SERVER_PORT is validated on its own rather than as a side effect of parsing the default url, which a configured FOREST_MCP_SERVER_URL replaces: listen() would otherwise reject a bad port with a bare RangeError, after the schema fetch and the OAuth initialization, and not at all in the configuration this option adds. The startup line reports both facts now that they can differ — the port the socket bound, and the url clients are told — and warns when a server is left on the localhost default, which is the only runtime chance to catch it.
Scra3
force-pushed
the
fix/mcp-standalone-public-url
branch
from
August 18, 2026 08:15
beda2fb to
059365a
Compare
hercemer42
approved these changes
Aug 18, 2026
forest-bot
added a commit
that referenced
this pull request
Aug 18, 2026
## @forestadmin/mcp-server [1.22.1](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/mcp-server@1.22.0...@forestadmin/mcp-server@1.22.1) (2026-08-18) ### Bug Fixes * **mcp-server:** let a deployed standalone server know its public url ([#1832](#1832)) ([e83a3f4](e83a3f4))
christophebrun-forest
added a commit
that referenced
this pull request
Aug 18, 2026
…-workflow-tools-in-forest-mcp-server #1832 added requestActionFileUpload to the same four tool lists this branch extends with the workflow tools, so every conflict was additive: both sides are kept. The workflow tools stay unconditional and the file upload tool keeps its fileUploads gate; the imports keep import/order. Without this the PR could not be checked at all - GitHub skips pull_request workflows on a conflicting PR, so no run was triggered. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Follow-up to #1815, which shipped in
@forestadmin/mcp-server@1.22.0.run()hardcodesbaseUrl = http://localhost:<port>, and that explicit value wins over the environment'sapi_endpoint. A process cannot derive its own public URL — DNS, proxy and TLS termination live outside it — so a deployed standalone server today:localhostas its OAuth issuer and endpoints (pre-existing, not introduced by feat: upload files through the MCP server for action File fields #1815),localhostupload URLs no remote client can reach.Nobody had seen it because every standalone test so far ran locally. A standalone deployment with a configured storage backend is unaffected — the upload URL comes from the backend.
FOREST_MCP_SERVER_URLis the public URL the server is reachable at. Set, it becomes the base URL, fixing the issuer and the upload URLs in one move; unset, behavior is unchanged. A value that does not parse as a URL fails at startup, like every other option.Verified by test through the real HTTP server
run()starts: the advertised issuer is the configured URL. The suite's globalfetchis the Forest mock, so the test reaches it with the keptoriginalFetch.🤖 Generated with Claude Code
Note
Let a deployed MCP server advertise its public URL via
FOREST_MCP_SERVER_URLFOREST_MCP_SERVER_URLenv var to server.ts that sets the public http(s) origin used for OAuth metadata and file upload URLs; defaults tohttp://localhost:<port>when unset.FOREST_MCP_SERVER_URLis a bare origin (no path, query, fragment, or credentials), failing startup with a clear error on invalid input.MCP_SERVER_PORTparsing to require an integer in [0, 65535]; rejectsMCP_SERVER_PORT=0unlessFOREST_MCP_SERVER_URLis set, since the ephemeral port can't be advertised without a known public URL.FOREST_MCP_SERVER_URLis unset.FOREST_MCP_SERVER_URL; omitting it causes advertised endpoints to resolve to localhost.Macroscope summarized 059365a.