← Back to Pull requests

Serve /mcp without the trailing slash in place, not by redirect #2

Open
adriangb opened this pull request with 38 lines diff across 4 files
View on GitHub
adriangb adriangb commented on Oct 09, 2026 04:25 UTC
Author

Problem

A user cannot add OpenArtifact as a connector in Claude Desktop. Sign-in with Google completes, then Claude shows "Couldn't connect" with the error McpServerError.

Claude stores the connector URL as https://openartifact.dev/mcp, without the trailing slash, also when the user types the slash. The server answers that URL with a redirect, and Claude does not follow it.

Reproduction

curl -si -X POST https://openartifact.dev/mcp | grep -iE '^(HTTP|location)'

HTTP/2 307
location: http://openartifact.dev/mcp/

The Location also uses http, not https.

Logfire shows the failed attempt on 2026-10-09 (UTC):

| Time | Request | Status |
|---|---|---|
| 04:10:52.05 | GET /auth/callback | 302 |
| 04:10:52.89 | POST /token | 200 |
| 04:10:53.56 to 04:11:05.02 | POST /mcp, 8 times | 307 each time |

No POST /mcp/ arrived from Claude and the server recorded no exception.

Change

  • backend/server.py: the SlashlessMcp ASGI middleware rewrites /mcp to /mcp/ and /.well-known/oauth-protected-resource/mcp to its slashed path before routing. The server answers these paths directly, with no redirect.

  • render.yaml: FORWARDED_ALLOW_IPS='*' makes uvicorn trust the X-Forwarded-Proto header from Render's proxy, so other redirects that the app builds use https.

  • tests/test_server.py: a test that /mcp gives the same answer as /mcp/ and that neither path redirects.
  • Verification

  • ruff and basedpyright pass. The frontend lint did not run: node_modules is not installed in the worktree.

  • pytest: all tests pass except test_runtime_js and test_favicon. These two need the frontend build, which is absent in the worktree. They are not related to this change.

  • Not verified against Claude: the connector flow can only be tested after deployment.
  • 🤖 Generated with Claude Code

    Diff: 38 lines (+37 / -1) across 4 files Reviewer: samuelcolvin Review duration: 14954m
    All Vouch review confidence checks passed
    Residual risk 0.05 = Change Risk (0.34) × (1 − Review Confidence (0.87)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.34 · 38 lines diff across 4 files
    0.34
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.89 · 2 substantive comment(s)
    0.89
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    86%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.219
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    3 items
    samuelcolvin samuelcolvin commented on code on Oct 10, 2026 14:49 UTC
    Code Review
    backend/server.py:1
    @@ -658,6 +659,27 @@ async def artifact_upload(artifact_id: str, path: str, request: Request, token:
         return {'path': path, 'size': size, 'sha256': hashlib.sha256(body).hexdigest()}
     
     
    +# The MCP endpoint and its resource metadata as a client reaches them when the URL was entered without the trailing

    shouldn't e just add an extra fastapi decorator to each one?

    adriangb adriangb commented on code on Oct 10, 2026 15:32 UTC
    Code Review
    backend/server.py:1
    @@ -658,6 +659,27 @@ async def artifact_upload(artifact_id: str, path: str, request: Request, token:
         return {'path': path, 'size': size, 'sha256': hashlib.sha256(body).hexdigest()}
     
     
    +# The MCP endpoint and its resource metadata as a client reaches them when the URL was entered without the trailing

    yeah that sounds much better!

    Reviewers
    Assignees
    adriangb adriangb
    Labels
    risk: low confidence: 86.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 34.3% (LOW) · Higher = larger blast radius
    34.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 86.9% · Lower = rushed or shallow review
    86.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 4.5% · Safe to merge
    4.5%