Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/openshell-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ thiserror = { workspace = true }
miette = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
sha2 = { workspace = true }
tracing = { workspace = true }
url = { workspace = true }
ipnet = "2"
Expand Down
1 change: 1 addition & 0 deletions crates/openshell-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub mod inference;
pub mod jwt;
pub mod local_api_socket;
pub mod mcp;
pub mod mcp_route_status;
pub mod metadata;
pub mod middleware;
pub mod net;
Expand Down
13 changes: 11 additions & 2 deletions crates/openshell-core/src/mcp.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//! OpenShell-owned MCP protocol revisions and immutable batch-shape metadata.
//! `OpenShell`-owned MCP protocol revisions and immutable batch-shape metadata.

use std::collections::BTreeSet;
use std::fmt;
Expand All @@ -14,6 +14,15 @@ use crate::proto::{McpOptions, ProviderProfile};
/// The bound is distinct from the separately enforced request-body byte limit.
pub const MAX_MCP_LEGACY_BATCH_MESSAGES: usize = 64;

/// Return whether a policy protocol name denotes MCP.
///
/// Protocol names are case-insensitive throughout policy validation and
/// execution, so every MCP-specific projection must use the same predicate.
#[must_use]
pub fn is_mcp_protocol(protocol: &str) -> bool {
protocol.trim().eq_ignore_ascii_case("mcp")
}

/// Stable MCP protocol revisions accepted by `OpenShell` policy configuration.
///
/// Variant order is the canonical semantic order used when normalizing policy
Expand Down Expand Up @@ -46,7 +55,7 @@ pub const DEFAULT_MCP_PROTOCOL_VERSION: McpProtocolVersion = McpProtocolVersion:
/// original evidence. MCP-shaped data on non-MCP endpoints is also untouched.
pub fn normalize_provider_profile_mcp_fields(profile: &mut ProviderProfile) {
for endpoint in &mut profile.endpoints {
if !endpoint.protocol.eq_ignore_ascii_case("mcp") {
if !is_mcp_protocol(&endpoint.protocol) {
continue;
}

Expand Down
Loading
Loading