feat(adapters): from_mcp + to_mcp behind the mcp feature (rmcp 1.8)
from_mcp (src/adapters/from_mcp/): - tools/list discovery over streamable HTTP; per-tool HandlerRegistration (Mutation, Once, FromMCP leaf, Internal; ADR-015/022) - structuredContent-preferred output, ContentBlock-union fallback, isError -> MCP_TOOL_ERROR with content blocks as details (ADR-023) - bearer token flows via capabilities key 'mcp' (ADR-014 no-env-vars) - 19 unit tests + tests/from_mcp_integration.rs (5 tests vs a real rmcp streamable-HTTP MCP server) to_mcp (src/adapters/to_mcp.rs): - 4 fixed gateway tools (search/schema/call/batch, ADR-041); Sub ops excluded from search and uncallable (MCP is request/response) - identity survives rmcp framing: bearer_auth_middleware stashes Option<Identity> in http::request::Parts extensions, call_tool reads it back from RequestContext extensions - StreamableHttpService nested at /mcp in HttpAdapter's router, bearer middleware around it (feature-gated) Streamable HTTP only (ADR-037): rmcp default-features off, no stdio. Default build compiles without rmcp (cargo tree: 0 hits). Verified: cargo test (182 lib default / 218 all-features) + 5 MCP integration + 10 WS, clippy -D warnings (both), fmt.
This commit is contained in:
@@ -9,8 +9,18 @@ pub mod from_openapi;
|
||||
pub mod openapi_spec;
|
||||
pub mod to_openapi;
|
||||
|
||||
#[cfg(feature = "mcp")]
|
||||
pub mod from_mcp;
|
||||
#[cfg(feature = "mcp")]
|
||||
pub mod to_mcp;
|
||||
|
||||
pub use forward::{HttpAuthScheme, HttpServiceConfig};
|
||||
pub use from_jsonschema::FromJsonSchema;
|
||||
pub use from_openapi::FromOpenAPI;
|
||||
pub use openapi_spec::OpenAPISpec;
|
||||
pub use to_openapi::to_openapi;
|
||||
|
||||
#[cfg(feature = "mcp")]
|
||||
pub use from_mcp::FromMCP;
|
||||
#[cfg(feature = "mcp")]
|
||||
pub use to_mcp::{to_mcp_service, ToMcpGateway, ToMcpService};
|
||||
|
||||
Reference in New Issue
Block a user