Skip to content

[DRAFT] Restructure IMcpEndpoint, IMcpClient, and IMcpServer #723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ dotnet add package ModelContextProtocol --prerelease

## Getting Started (Client)

To get started writing a client, the `McpClientFactory.CreateAsync` method is used to instantiate and connect an `IMcpClient`
to a server. Once you have an `IMcpClient`, you can interact with it, such as to enumerate all available tools and invoke tools.
To get started writing a client, the `McpClientFactory.CreateAsync` method is used to instantiate and connect an `McpClientSession`
to a server. Once you have an `McpClientSession`, you can interact with it, such as to enumerate all available tools and invoke tools.

```csharp
var clientTransport = new StdioClientTransport(new StdioClientTransportOptions
Expand Down
2 changes: 1 addition & 1 deletion samples/InMemoryTransport/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
_ = server.RunAsync();

// Connect a client using a stream-based transport over the same in-memory pipe.
await using IMcpClient client = await McpClientFactory.CreateAsync(
await using McpClientSession client = await McpClientFactory.CreateAsync(
new StreamClientTransport(clientToServerPipe.Writer.AsStream(), serverToClientPipe.Reader.AsStream()));

// List all tools.
Expand Down
9 changes: 9 additions & 0 deletions src/ModelContextProtocol.Core/AssemblyNameHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Reflection;

namespace ModelContextProtocol;

internal static class AssemblyNameHelper
{
/// <summary>Cached naming information used for MCP session name/version when none is specified.</summary>
public static AssemblyName DefaultAssemblyName { get; } = (Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly()).GetName();
}
4 changes: 2 additions & 2 deletions src/ModelContextProtocol.Core/Client/IClientTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace ModelContextProtocol.Client;
/// and servers, allowing different transport protocols to be used interchangeably.
/// </para>
/// <para>
/// When creating an <see cref="IMcpClient"/>, <see cref="McpClientFactory"/> is typically used, and is
/// When creating an <see cref="McpClientSession"/>, <see cref="McpClientFactory"/> is typically used, and is
/// provided with the <see cref="IClientTransport"/> based on expected server configuration.
/// </para>
/// </remarks>
Expand All @@ -35,7 +35,7 @@ public interface IClientTransport
/// </para>
/// <para>
/// The lifetime of the returned <see cref="ITransport"/> instance is typically managed by the
/// <see cref="McpClient"/> that uses this transport. When the client is disposed, it will dispose
/// <see cref="McpClientSession"/> that uses this transport. When the client is disposed, it will dispose
/// the transport session as well.
/// </para>
/// <para>
Expand Down
47 changes: 0 additions & 47 deletions src/ModelContextProtocol.Core/Client/IMcpClient.cs

This file was deleted.

236 changes: 0 additions & 236 deletions src/ModelContextProtocol.Core/Client/McpClient.cs

This file was deleted.

Loading