Skip to content
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

Added TcpServerTransport #197

Closed

Conversation

IvanMurzak
Copy link

@IvanMurzak IvanMurzak commented Apr 3, 2025

  • Added TcpServerTransport
  • Added .WithTcpServerTransport() for building MCP Server with TCP support
  • Added test that is testing WithTcpServerTransport function

Motivation and Context

  1. My primary goal is to build Unity-MCP that may be connected with Claude Desktop. Unity Editor environment has a .NET sandbox that doesn't allow to use STDIO stream.
  2. To make Unity-MCP-Runtime package for Unity Engine that would allow to implement MCP server into a player's build.
  3. TCP connection works fine in the same time. Also TCP connection could be more flexible for connecting to a wider range of apps. This PR covers this issue.

How Has This Been Tested?

I added tests to cover TCP Protocol. All of them passed.

Breaking Changes

  • none

Types of changes

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

Checklist

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

Additional context

@IvanMurzak
Copy link
Author

I am still going to implement more tests for TcpServerTransport and to properly test it in Unity Editor with Claude Desktop. Please hold...

@PederHP
Copy link
Collaborator

PederHP commented Apr 3, 2025

Really cool to see that particular use case (as a former game dev and game engine dev).

Have you considered submitting this as new transport in the spec itself? Custom transports are allowed (and even encouraged I believe?) spec wise, but making sure this doesn't end up different than a future official TCP spec might be good. Or at least getting some input from maintainers on your design.

@eiriktsarpalis
Copy link
Contributor

Thank you for your contribution @IvanMurzak! Even though we love to see alternative transports being implemented on top of the SDK, unfortunately transports that are not part of the MCP specification are outside the scope of the SDK itself.

My recommendation would be to try to create an extension library that builds on top of the SDK. And if per @PederHP's recommendation you are able to get this ratified by the MCP steering committee, then we will absolutely be bringing it into the fold!

@stephentoub
Copy link
Contributor

Closing per the above comments. But much appreciated on your interest in contributing to the project, @IvanMurzak!

@stephentoub stephentoub closed this Apr 4, 2025
@IvanMurzak
Copy link
Author

Thanks. I was going into a wrong direction...

Got confused with implementation of MCP. Thought TCP is a good transport protocol to communicate between Unity and MCP Server. And that is right, just the Transport in the SDK is designed to communicate only with Client, but not with a target software such as Unity in my case.

Seems like I am free to implement TCP communication with any other software on my own without clear standards or limits from the SDK. So yeah, this PR doesn't have much sense.

@stephentoub stephentoub mentioned this pull request Apr 4, 2025
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.

4 participants