Skip to content

Conversation

@4t145
Copy link
Collaborator

@4t145 4t145 commented Mar 2, 2025

Add an axum sse server example for crate mcp-server

Motivation and Context

Since there's a stdin example, I want to add a sse example as a complement.

How Has This Been Tested?

Run npx @modelcontextprotocol/inspector and connect to localhost:8000/sse, everything seems OK.

Breaking Changes

No breaking changes

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

Some changes are made in crates/mcp-server/src/lib.rs to make server.run(transport) Send, so async runtime like tokio can spawn it.

@4t145 4t145 mentioned this pull request Mar 2, 2025
4t145 added 2 commits March 3, 2025 09:07
This commit adds supporting modules for the Axum Server-Sent Events (SSE) example:
- Added `counter.rs` with a simple counter router implementation
- Added `jsonrpc_frame_codec.rs` for decoding JSON-RPC frames
- Created a `mod.rs` to expose these modules
- Removed the previous SSE example configuration from Cargo.toml
@RWDai RWDai mentioned this pull request Mar 3, 2025
9 tasks
@4t145 4t145 mentioned this pull request Mar 3, 2025
9 tasks
@kalvinnchau
Copy link
Contributor

Hi! Thank you for the contribution!! We recently overhauled the examples in #10, can you please update this PR to follow that one?

kalvinnchau
kalvinnchau previously approved these changes Mar 4, 2025
Copy link
Contributor

@kalvinnchau kalvinnchau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! thanks for the contribution!

@kalvinnchau kalvinnchau merged commit c0bd94d into modelcontextprotocol:main Mar 4, 2025
3 checks passed
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.

2 participants