Add stateless doc, prefer stateless mode and disable legacy SSE by default (#1468)
This commit is contained in:
parent
49bf17077d
commit
8eb4023c20
2 changed files with 1440 additions and 73 deletions
|
|
@ -172,7 +172,7 @@ Here's an example implementation of how a console application might handle elici
|
|||
|
||||
### URL Elicitation Required Error
|
||||
|
||||
When a tool cannot proceed without first completing a URL-mode elicitation (for example, when third-party OAuth authorization is needed), and calling `ElicitAsync` is not practical (for example in <xref: ModelContextProtocol.AspNetCore.HttpServerTransportOptions.Stateless> is enabled disabling server-to-client requests), the server may throw a <xref:ModelContextProtocol.UrlElicitationRequiredException>. This is a specialized error (JSON-RPC error code `-32042`) that signals to the client that one or more URL-mode elicitations must be completed before the original request can be retried.
|
||||
When a tool cannot proceed without first completing a URL-mode elicitation (for example, when third-party OAuth authorization is needed), and calling `ElicitAsync` is not practical (for example in [stateless](xref:stateless) mode where server-to-client requests are disabled), the server may throw a <xref:ModelContextProtocol.UrlElicitationRequiredException>. This is a specialized error (JSON-RPC error code `-32042`) that signals to the client that one or more URL-mode elicitations must be completed before the original request can be retried.
|
||||
|
||||
#### Throwing UrlElicitationRequiredException on the Server
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,11 @@ var builder = WebApplication.CreateBuilder(args);
|
|||
|
||||
builder.Services.AddMcpServer()
|
||||
.WithHttpTransport(options =>
|
||||
options.IdleTimeout = Timeout.InfiniteTimeSpan // Never timeout
|
||||
)
|
||||
{
|
||||
// Elicitation requires stateful mode because it sends server-to-client requests.
|
||||
// Set Stateless = false explicitly for forward compatibility in case the default changes.
|
||||
options.Stateless = false;
|
||||
})
|
||||
.WithTools<InteractiveTools>();
|
||||
|
||||
builder.Logging.AddConsole(options =>
|
||||
|
|
|
|||
Loading…
Reference in a new issue