Skip to content

fix env args with requires #140

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 2 commits into from
Jun 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions crates/apollo-mcp-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,16 @@ struct Args {
introspection: bool,

/// Enable use of uplink to get the schema and persisted queries (requires APOLLO_KEY and APOLLO_GRAPH_REF)
#[arg(long, short = 'u')]
#[arg(
long,
short = 'u',
requires = "apollo_key",
requires = "apollo_graph_ref"
)]
uplink: bool,

/// Expose a tool to open queries in Apollo Explorer (requires APOLLO_KEY and APOLLO_GRAPH_REF)
#[arg(long, short = 'x')]
/// Expose a tool to open queries in Apollo Explorer (requires APOLLO_GRAPH_REF)
#[arg(long, short = 'x', requires = "apollo_graph_ref")]
explorer: bool,

/// Operation files to expose as MCP tools
Expand Down Expand Up @@ -117,7 +122,7 @@ struct Args {
http_port: Option<u16>,

/// collection id to expose as MCP tools (requires APOLLO_KEY)
#[arg(long, conflicts_with_all(["operations", "manifest"]))]
#[arg(long, conflicts_with_all(["operations", "manifest"]), requires = "apollo_key")]
collection: Option<String>,

/// The endpoints (comma separated) polled to fetch the latest supergraph schema.
Expand All @@ -129,11 +134,11 @@ struct Args {
apollo_registry_url: Option<String>,

/// Your Apollo key.
#[clap(skip = std::env::var("APOLLO_KEY").ok())]
#[clap(env = "APOLLO_KEY", long)]
apollo_key: Option<String>,

/// Your Apollo graph reference.
#[clap(skip = std::env::var("APOLLO_GRAPH_REF").ok())]
#[clap(env = "APOLLO_GRAPH_REF", long)]
apollo_graph_ref: Option<String>,
}

Expand Down