Skip to content

Initial proposal to for feature request https://github.com/modelcontextprotocol/java-sdk/issues/415 #439

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

scottslewis
Copy link

Initial pr for feature request: #415

i.mcp.client/server.transport packages contains new transport providers classes : UDSClient/ServerTransportProvider. The name UDS refers to UnixDomainSocket as that's the SocketChannel type being used.

These transport providers use the new classses in util: UDSClientNonBlockingSocketChannel and UDSServerNonBlockingSocketChannel.

These further depend upon super classes ClientNonBlockingSocketChannel and ServerNonBlockingSocketChannel which both depend upon superclass NonBlockSocketChannel, which has most of the actual implementation of the single-threaded/Selector based non-blocking read and write.

This subclass/superclass structure means that Inet4 and Inet6 client/server SocketChannel classes are also present. These are very simple, and will work just the same as the UDSClient/ServerSocketChannel classses but will use Inet4 and Inet6 + port connections rather than UnixDomainSockets.

It will then be very easy to create server/client transport providers that use inet4 or inet6 tcp stacks for localhost or non localhost connections.

But for the moment, I've only created UDSServer/ClientTransportProviders for testing and review.

Motivation and Context

Especially for localhost only communication, it would be valuable to use transport providers that are not based upon stdin and stdout

How Has This Been Tested?

Yes, I have tested these transport providers with my own MCP server and client impls. Mostly in java, but also in Python.

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • [X ] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • [X ] I have read the MCP Documentation
  • [X ] My code follows the repository's style guidelines
  • [X ] New and existing tests pass locally
  • [X ] I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

I'm completely willing to help with restructuring server/client transport providers to allow the easy use of the *NonBlockingSocketChannel classes. I'm not hung up on these class names or package locations...if alternatives are better then I'm willing to refactor.

modelcontextprotocol#415

i.mcp.client/server.transport packages contains new transport providers
classes :  UDSClient/ServerTransportProvider.  The name UDS refers to
UnixDomainSocket as that's the SocketChannel type being used.

These transport providers use the new classses in util:
UDSClientNonBlockingSocketChannel and UDSServerNonBlockingSocketChannel.

These further depend upon super classes ClientNonBlockingSocketChannel
and ServerNonBlockingSocketChannel which both depend upon superclass
NonBlockSocketChannel, which has most of the actual implementation of
the single-threaded/Selector based non-blocking read and write.

This subclass/superclass structure means that Inet4 and Inet6
client/server SocketChannel classes are also present.   These will work
just the same as the UDSClient/ServerSocketChannel classses but rather
will use Inet4 and Inet6 connections rather than UnixDomainSockets.

It will be very easy to create server/client transport providers that
use inet4 or inet6 tcp stacks for localhost or non localhost
connections.

But for the moment, I've only created UDSServer/ClientTransportProviders
for testing and review.

Signed-off-by: Scott Lewis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant