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

mcp-server Transport trait + Toolset for easier Router building #18

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

Conversation

stevohuncho
Copy link

Completed the TODO of converting the Server in mcp-server to be created with a Transport trait instead of the ByteTransport struct.

  • Created Transport trait in mcp-server/src/transport/mod.rs
  • Converted ByteTransport struct to StdioTransport that implements the newly created Transport trait in mcp-server/src/transport/stdio.rs
  • Updated ALL server examples to use this updated Transport implementation
  • Added a Toolset and ToolsetBuilder struct to make future implementations of Router builders easier allowing for an easy way to store the connection of Tools to their handlers (preventing users to forget to add the functionality of a call_tool for a tool in list_tools)

Motivation and Context

Allows for a proper SSE transport struct to be create along with other custom transports. I am planning on adding the SSE implementation of this new trait.

How Has This Been Tested?

I converted the servers examples to use this new Trait implementation for transport and both the counter_server.rs (STDIO) and axum.rs (SSE) were tested and working.

Breaking Changes

Yes. Users who have ByteTransport::new() MUST now use StdioTransport::new(). An easy one line fix because ByteTransport is now deprecated.

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

I will be pushing a lot more PRs related to SSE mcp-servers and I am a mcp sdk author myself, but I am looking to incorporate all of my features in here now.

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