-
Notifications
You must be signed in to change notification settings - Fork 59
Split local and remote commands in the binary #534
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9b4ef9d
Rename binary from wassette to weld and split commands into run and s…
Copilot 2918198
Revert binary name from weld back to wassette, keep command structure…
Copilot 04dcbe2
Fix failing test and update CLI references from 'serve --stdio' to 'run'
Copilot 87f3e4c
Fix test_structured_output_integration and other transport tests to u…
Copilot 5ecc98a
Run cargo +nightly fmt to fix formatting
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,7 +47,9 @@ pub struct Cli { | |
|
|
||
| #[derive(Subcommand, Debug)] | ||
| pub enum Commands { | ||
| /// Start a MCP Server | ||
| /// Run locally with stdio transport (for local development and testing). | ||
| Run(Run), | ||
| /// Serve remotely over HTTP transports (SSE or StreamableHttp). | ||
| Serve(Serve), | ||
| /// Manage WebAssembly components. | ||
| Component { | ||
|
|
@@ -95,6 +97,31 @@ pub enum Commands { | |
| }, | ||
| } | ||
|
|
||
| /// Configuration for running locally with stdio transport | ||
| #[derive(Parser, Debug, Clone, Serialize, Deserialize)] | ||
| pub struct Run { | ||
| /// Directory where components are stored. Defaults to $XDG_DATA_HOME/wassette/components | ||
| #[arg(long)] | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub component_dir: Option<PathBuf>, | ||
|
|
||
| /// Set environment variables (KEY=VALUE format). Can be specified multiple times. | ||
| #[arg(long = "env", value_parser = crate::parse_env_var)] | ||
| #[serde(skip)] | ||
| pub env_vars: Vec<(String, String)>, | ||
|
|
||
| /// Load environment variables from a file (supports .env format) | ||
| #[arg(long = "env-file")] | ||
| #[serde(skip)] | ||
| pub env_file: Option<PathBuf>, | ||
|
|
||
| /// Disable built-in tools (load-component, unload-component, list-components, etc.) | ||
| #[arg(long)] | ||
| #[serde(default)] | ||
| pub disable_builtin_tools: bool, | ||
| } | ||
|
|
||
| /// Configuration for serving remotely over HTTP transports | ||
| #[derive(Parser, Debug, Clone, Serialize, Deserialize)] | ||
| pub struct Serve { | ||
| /// Directory where components are stored. Defaults to $XDG_DATA_HOME/wassette/components | ||
|
||
|
|
@@ -103,7 +130,7 @@ pub struct Serve { | |
| pub component_dir: Option<PathBuf>, | ||
|
|
||
| #[command(flatten)] | ||
| pub transport: TransportFlags, | ||
| pub transport: HttpTransportFlags, | ||
|
|
||
| /// Set environment variables (KEY=VALUE format). Can be specified multiple times. | ||
| #[arg(long = "env", value_parser = crate::parse_env_var)] | ||
|
|
@@ -131,19 +158,15 @@ pub struct Serve { | |
| pub manifest: Option<PathBuf>, | ||
| } | ||
|
|
||
| /// HTTP transport options for the Serve command | ||
| #[derive(Args, Debug, Clone, Serialize, Deserialize, Default)] | ||
| #[group(required = false, multiple = false)] | ||
| pub struct TransportFlags { | ||
| pub struct HttpTransportFlags { | ||
| /// Serving with SSE transport | ||
| #[arg(long)] | ||
| #[serde(skip)] | ||
| pub sse: bool, | ||
|
|
||
| /// Serving with stdio transport | ||
| #[arg(long)] | ||
| #[serde(skip)] | ||
| pub stdio: bool, | ||
|
|
||
| /// Serving with streamable HTTP transport | ||
| #[arg(long)] | ||
| #[serde(skip)] | ||
|
|
@@ -153,17 +176,15 @@ pub struct TransportFlags { | |
| #[derive(Debug)] | ||
| pub enum Transport { | ||
| Sse, | ||
| Stdio, | ||
| StreamableHttp, | ||
| } | ||
|
|
||
| impl From<&TransportFlags> for Transport { | ||
| fn from(f: &TransportFlags) -> Self { | ||
| match (f.sse, f.stdio, f.streamable_http) { | ||
| (true, false, false) => Transport::Sse, | ||
| (false, true, false) => Transport::Stdio, | ||
| (false, false, true) => Transport::StreamableHttp, | ||
| _ => Transport::Stdio, // Default case: use stdio transport | ||
| impl From<&HttpTransportFlags> for Transport { | ||
| fn from(f: &HttpTransportFlags) -> Self { | ||
| match (f.sse, f.streamable_http) { | ||
| (true, false) => Transport::Sse, | ||
| (false, true) => Transport::StreamableHttp, | ||
| _ => Transport::Sse, // Default case: use SSE transport for serve | ||
| } | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected binary name reference from 'wassette' to 'weld' in default directory path documentation.