Skip to content

Commit 7a1279e

Browse files
Use "Name" for transport descriptors and "EndpointName" for MCP clients and servers.
1 parent b2e290f commit 7a1279e

18 files changed

Lines changed: 30 additions & 30 deletions

samples/ChatWithTools/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{
1111
Command = "npx",
1212
Arguments = ["-y", "--verbose", "@modelcontextprotocol/server-everything"],
13-
Description = "Everything",
13+
Name = "Everything",
1414
}));
1515

1616
// Get all available tools

samples/QuickstartClient/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
{
1818
Command = command,
1919
Arguments = arguments,
20-
Description = "Demo Server",
20+
Name = "Demo Server",
2121
}));
2222

2323
var tools = await mcpClient.ListToolsAsync();

src/ModelContextProtocol/Client/McpClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public McpClient(IClientTransport clientTransport, McpClientOptions? options, IL
4242
_clientTransport = clientTransport;
4343
_options = options;
4444

45-
EndpointName = clientTransport.EndpointName;
45+
EndpointName = clientTransport.Name;
4646

4747
if (options.Capabilities is { } capabilities)
4848
{

src/ModelContextProtocol/Client/McpClientFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static async Task<IMcpClient> CreateAsync(
3030
{
3131
Throw.IfNull(clientTransport);
3232

33-
string endpointName = clientTransport.EndpointName;
33+
string endpointName = clientTransport.Name;
3434
var logger = loggerFactory?.CreateLogger(typeof(McpClientFactory)) ?? NullLogger.Instance;
3535
logger.CreatingClient(endpointName);
3636

src/ModelContextProtocol/Protocol/Transport/IClientTransport.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
public interface IClientTransport
77
{
88
/// <summary>
9-
/// Gets a description of the endpoint the client is connecting to.
9+
/// Specifies a transport identifier used for logging purposes.
1010
/// </summary>
11-
string EndpointName { get; }
11+
string Name { get; }
1212

1313
/// <summary>
1414
/// Asynchronously establishes a transport session with an MCP server and returns an interface for the duplex JSON-RPC message stream.

src/ModelContextProtocol/Protocol/Transport/SseClientTransport.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ public SseClientTransport(SseClientTransportOptions transportOptions, HttpClient
4141
_httpClient = httpClient;
4242
_loggerFactory = loggerFactory;
4343
_ownsHttpClient = ownsHttpClient;
44-
EndpointName = $"Client (SSE) for ({transportOptions.Description ?? transportOptions.Endpoint.ToString()})";
44+
Name = transportOptions.Name ?? transportOptions.Endpoint.ToString();
4545
}
4646

4747
/// <inheritdoc />
48-
public string EndpointName { get; }
48+
public string Name { get; }
4949

5050
/// <inheritdoc />
5151
public async Task<ITransport> ConnectAsync(CancellationToken cancellationToken = default)
5252
{
53-
var sessionTransport = new SseClientSessionTransport(_options, _httpClient, _loggerFactory, EndpointName);
53+
var sessionTransport = new SseClientSessionTransport(_options, _httpClient, _loggerFactory, Name);
5454

5555
try
5656
{

src/ModelContextProtocol/Protocol/Transport/SseClientTransportOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public required Uri Endpoint
3131
}
3232

3333
/// <summary>
34-
/// Description of the server process used for logging purposes.
34+
/// Specifies a transport identifier used for logging purposes.
3535
/// </summary>
36-
public string? Description { get; init; }
36+
public string? Name { get; init; }
3737

3838
/// <summary>
3939
/// Timeout for initial connection and endpoint event.

src/ModelContextProtocol/Protocol/Transport/StdioClientTransport.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Diagnostics;
66
using System.Runtime.InteropServices;
77
using System.Text;
8+
using System.Text.RegularExpressions;
89

910
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
1011

@@ -29,16 +30,16 @@ public StdioClientTransport(StdioClientTransportOptions options, ILoggerFactory?
2930

3031
_options = options;
3132
_loggerFactory = loggerFactory;
32-
EndpointName = $"Client (stdio) for ({options.Description ?? options.Command})";
33+
Name = options.Name ?? $"stdio-{Regex.Replace(Path.GetFileName(options.Command), @"[\s\.]+", "-")}";
3334
}
3435

3536
/// <inheritdoc />
36-
public string EndpointName { get; }
37+
public string Name { get; }
3738

3839
/// <inheritdoc />
3940
public async Task<ITransport> ConnectAsync(CancellationToken cancellationToken = default)
4041
{
41-
string endpointName = EndpointName;
42+
string endpointName = Name;
4243

4344
Process? process = null;
4445
bool processStarted = false;
@@ -77,16 +78,16 @@ public async Task<ITransport> ConnectAsync(CancellationToken cancellationToken =
7778
#endif
7879
};
7980

80-
if (arguments is not null)
81+
if (arguments is not null)
8182
{
8283
#if NET
83-
foreach (var arg in arguments)
84+
foreach (string arg in arguments)
8485
{
8586
startInfo.ArgumentList.Add(arg);
8687
}
8788
#else
8889
StringBuilder argsBuilder = new();
89-
foreach (var arg in arguments)
90+
foreach (string arg in arguments)
9091
{
9192
PasteArguments.AppendArgument(argsBuilder, arg);
9293
}

src/ModelContextProtocol/Protocol/Transport/StdioClientTransportOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ public required string Command
3333
public IList<string>? Arguments { get; set; }
3434

3535
/// <summary>
36-
/// Description of the server process used for logging purposes.
36+
/// Specifies a transport identifier used for logging purposes.
3737
/// </summary>
38-
public string? Description { get; set; }
38+
public string? Name { get; set; }
3939

4040
/// <summary>
4141
/// The working directory for the server process.

src/ModelContextProtocol/Protocol/Transport/StreamClientTransport.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public StreamClientTransport(
3636
}
3737

3838
/// <inheritdoc />
39-
public string EndpointName => $"Client (in-memory stream)";
39+
public string Name => $"in-memory-stream";
4040

4141

4242
/// <inheritdoc />

0 commit comments

Comments
 (0)