Fix incorrect MapMcp default-path guidance in mcp-csharp-create - #937
Closed
leslierichardson95 wants to merge 1 commit into
Closed
Conversation
The HTTP transport example and "Key HTTP details" claimed plain
`app.MapMcp()` "defaults to /mcp". The C# MCP SDK signature is
`MapMcp(this IEndpointRouteBuilder endpoints, string pattern = "")`,
which maps at the root route ("/"), not "/mcp". This mismatch can
anchor models to generate `/mcp` client URLs against a root-mapped
server, producing 404s.
Map the endpoint explicitly with `app.MapMcp("/mcp")` and correct the
"Key HTTP details" text to describe the pattern argument accurately and
point clients at a matching URL. Aligns with references/transport-config.md,
which already documents the pattern as a custom path prefix.
Refs dotnet#889.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6a8ce111-58e5-48a7-9f7f-8de972bdc693
Contributor
There was a problem hiding this comment.
Pull request overview
This PR corrects the mcp-csharp-create skill’s HTTP transport guidance so the documented MCP endpoint path matches the actual behavior of MapMcp’s default route mapping, avoiding clients being pointed at a non-existent /mcp endpoint.
Changes:
- Update the HTTP
Program.csexample to explicitly map MCP at/mcpviaapp.MapMcp("/mcp"). - Rewrite the “Key HTTP details” section to explain how
MapMcp(pattern)determines the served path and to align client URL guidance accordingly.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ``` | ||
|
|
||
| **Key HTTP details:** `MapMcp()` defaults to `/mcp` path. For containers, set `ASPNETCORE_URLS=http://+:8080` and `EXPOSE 8080`. The MCP HTTP protocol uses Streamable HTTP — no special client config needed beyond the URL. | ||
| **Key HTTP details:** `MapMcp(pattern)` maps the endpoint at `pattern` — `MapMcp("/mcp")` serves at `/mcp`, while plain `MapMcp()` defaults to the root route (`/`). Pass the pattern explicitly and point clients at a matching URL (e.g. `http://localhost:<port>/mcp`). For containers, set `ASPNETCORE_URLS=http://+:8080` and `EXPOSE 8080`. The MCP HTTP protocol uses Streamable HTTP — no special client config needed beyond the URL. |
Contributor
Author
|
Superseded by #941, which moves this change to a branch on the primary dotnet/skills repo. Closing this fork PR. |
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.
Summary
Fixes factually incorrect HTTP-endpoint path guidance in
mcp-csharp-createthat could cause frontier models to emit/mcpclient URLs against a root-mapped server (404s). Part of the dotnet-ai skills-eval follow-up (#889); this is the "protect + surgical fix" action formcp-csharp-create, which is otherwise an efficient win on Sonnet/Haiku.What was wrong
The HTTP transport example and Key HTTP details claimed plain
app.MapMcp()"defaults to/mcp". Verified against the C# MCP SDK source (McpEndpointRouteBuilderExtensions.MapMcp):The default
pattern = ""maps the server at the root route (/), not/mcp. A client told to connect to/mcpagainst a default-mapped server gets a 404.Change
app.MapMcp();→app.MapMcp("/mcp");in the HTTPProgram.csexample (matches the inline comment's stated intent).patternargument accurately and tell clients to use a matching URL.Consistent with
references/transport-config.md, which already documentsMapMcp("/custom-mcp-path")as a custom path prefix. Surgical, 2-line change — no expansion of an already-winning skill.Refs #889.