forked from modelcontextprotocol/csharp-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIMcpServer.cs
More file actions
62 lines (55 loc) · 2.24 KB
/
IMcpServer.cs
File metadata and controls
62 lines (55 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using ModelContextProtocol.Protocol;
namespace ModelContextProtocol.Server;
/// <summary>
/// Represents an instance of a Model Context Protocol (MCP) server that connects to and communicates with an MCP client.
/// </summary>
public interface IMcpServer : IMcpEndpoint
{
/// <summary>
/// Gets the capabilities supported by the client.
/// </summary>
/// <remarks>
/// <para>
/// These capabilities are established during the initialization handshake and indicate
/// which features the client supports, such as sampling, roots, and other
/// protocol-specific functionality.
/// </para>
/// <para>
/// Server implementations can check these capabilities to determine which features
/// are available when interacting with the client.
/// </para>
/// </remarks>
ClientCapabilities? ClientCapabilities { get; }
/// <summary>
/// Gets the version and implementation information of the connected client.
/// </summary>
/// <remarks>
/// <para>
/// This property contains identification information about the client that has connected to this server,
/// including its name and version. This information is provided by the client during initialization.
/// </para>
/// <para>
/// Server implementations can use this information for logging, tracking client versions,
/// or implementing client-specific behaviors.
/// </para>
/// </remarks>
Implementation? ClientInfo { get; }
/// <summary>
/// Gets the options used to construct this server.
/// </summary>
/// <remarks>
/// These options define the server's capabilities, protocol version, and other configuration
/// settings that were used to initialize the server.
/// </remarks>
McpServerOptions ServerOptions { get; }
/// <summary>
/// Gets the service provider for the server.
/// </summary>
IServiceProvider? Services { get; }
/// <summary>Gets the last logging level set by the client, or <see langword="null"/> if it's never been set.</summary>
LoggingLevel? LoggingLevel { get; }
/// <summary>
/// Runs the server, listening for and handling client requests.
/// </summary>
Task RunAsync(CancellationToken cancellationToken = default);
}