car-connectors 0.24.0

Remote MCP connectors for the Common Agent Runtime — connect to remote MCP servers over HTTP, register their tools, and route calls through CAR's governance layer (validator, policy, eventlog).
//! Remote MCP connectors for the Common Agent Runtime.
//!
//! Lets CAR users add remote MCP servers as tool sources — the way
//! Claude and ChatGPT add connectors. This crate is the **client**
//! direction of MCP (the `car-mcp` crate is the server direction, which
//! exposes CAR's own tools to other MCP clients).
//!
//! ## What it provides
//!
//! - [`McpHttpSession`] — an HTTP-streamable MCP client transport that
//!   implements [`car_engine::McpSession`], so a remote connector plugs
//!   into the engine's existing [`car_engine::McpToolExecutor`] routing
//!   and fallback machinery exactly like a stdio MCP server does.
//! - [`ConnectorManager`] — connector lifecycle: connect, discover,
//!   enable, persist to `~/.car/connectors.json`, with secret auth
//!   headers stored in the OS keychain (never in the JSON).
//!
//! ## Governance
//!
//! Because connector tools register as ordinary
//! [`car_engine::ToolEntry`]s and dispatch through the standard
//! executor, every call flows through CAR's validator, policy, and
//! eventlog — the differentiator over calling connector tools directly.
//!
//! ## Scope
//!
//! - **Phase 1:** unauthenticated and static-auth-header servers over
//!   the HTTP-streamable transport.
//! - **Phase 2:** OAuth 2.1 ([`oauth`]) — Protected Resource + auth
//!   server metadata discovery, dynamic client registration, PKCE, and
//!   token refresh. See [`ConnectorManager::authenticate`] /
//!   [`ConnectorManager::complete_authentication`].
//! - **Phase 3:** per-tool enable/disable
//!   ([`ConnectorManager::enable_tools`] / [`ConnectorManager::disable_tools`])
//!   and a daemon `deny_connector` policy rule.
//! - **Phase 4:** local stdio connectors
//!   ([`ConnectorManager::add_stdio`], reusing `car_engine::McpServer`)
//!   and team-shareable secret-free `.car/connectors.toml`.
//!
//! See `docs/proposals/remote-mcp-connectors.md` for deferred items.

pub mod discovery;
pub mod error;
pub mod manager;
pub mod manifest;
pub mod oauth;
pub mod schema;
pub mod secrets;
pub mod transport;

pub use error::ConnectorError;
pub use manager::{ConnectorManager, ConnectorStatus, ToolView};
pub use manifest::{ConnectorConfig, ConnectorsFile, OAuthConfig, StdioConfig};
pub use transport::{McpHttpSession, CLIENT_PROTOCOL_VERSION};