Skip to content

The transport-streamable-http-client feature should include reqwest #349

@ozaner

Description

@ozaner

Describe the bug
The transport-streamable-http-client feature makes use of the reqwest crate, but does not declare it as a component feature in the rmcp Cargo.toml. This prevents a project with rmcp from being compiled if they make use of the feature.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new rust crate
  2. Run cargo add rmcp -F transport-streamable-http-client
  3. Run cargo build

Expected behavior
Crate compiles

Actual behavior
Fails to compile, error message given below:

$ cargo build
   Compiling rmcp v0.3.0
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `reqwest`
  --> C:\Users\dummy\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\rmcp-0.3.0\src\transport\streamable_http_client.rs:51:11
   |
51 | impl From<reqwest::Error> for StreamableHttpError<reqwest::Error> {
   |           ^^^^^^^ use of unresolved module or unlinked crate `reqwest`
   |
   = help: if you wanted to use a crate named `reqwest`, use `cargo add reqwest` to add it to your `Cargo.toml`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `reqwest`
  --> C:\Users\dummy\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\rmcp-0.3.0\src\transport\streamable_http_client.rs:51:51
   |
51 | impl From<reqwest::Error> for StreamableHttpError<reqwest::Error> {
   |                                                   ^^^^^^^ use of unresolved module or unlinked crate `reqwest`
   |
   = help: if you wanted to use a crate named `reqwest`, use `cargo add reqwest` to add it to your `Cargo.toml`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `reqwest`
  --> C:\Users\dummy\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\rmcp-0.3.0\src\transport\streamable_http_client.rs:52:16
   |
52 |     fn from(e: reqwest::Error) -> Self {
   |                ^^^^^^^ use of unresolved module or unlinked crate `reqwest`
   |
   = help: if you wanted to use a crate named `reqwest`, use `cargo add reqwest` to add it to your `Cargo.toml`

For more information about this error, try `rustc --explain E0433`.
error: could not compile `rmcp` (lib) due to 3 previous errors

Proposed fix
The fix should simply be to change this line in the Cargo.toml from:

transport-streamable-http-client = ["client-side-sse", "transport-worker"]

to

transport-streamable-http-client = ["client-side-sse", "transport-worker", "reqwest"]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions