cortexai-mcp 0.1.0

Model Context Protocol (MCP) support for Cortex: stdio, SSE, and server transports
Documentation
//! # Model Context Protocol (MCP) Support
//!
//! Implementation of the Model Context Protocol for cortex.

#![allow(clippy::type_complexity)]
#![allow(clippy::await_holding_lock)]
//! MCP provides a standardized way to connect AI agents to external tools and data sources.
//!
//! ## Features
//!
//! - **STDIO Transport**: Launch MCP servers as subprocesses
//! - **SSE Transport**: Connect to HTTP-based MCP servers
//! - **Tool Integration**: Automatic conversion between MCP tools and agent tools
//!
//! ## Example
//!
//! ```rust,ignore
//! use cortexai_mcp::{McpClient, StdioTransport};
//!
//! // Connect to an MCP server via stdio
//! let transport = StdioTransport::spawn("npx", &["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]).await?;
//! let client = McpClient::new(transport).await?;
//!
//! // List available tools
//! let tools = client.list_tools().await?;
//!
//! // Call a tool
//! let result = client.call_tool("read_file", json!({"path": "/tmp/test.txt"})).await?;
//! ```

pub mod agent_handler;
pub mod bridge;
pub mod client;
pub mod crew_handler;
pub mod error;
pub mod graph_handler;
pub mod protocol;
pub mod server;
pub mod session_resources;
pub mod http_server;
pub mod sse_server;
pub mod transport;

#[cfg(feature = "engine")]
pub mod tool_proxy_handler;
#[cfg(feature = "engine")]
pub mod engine_handler;
#[cfg(feature = "engine")]
pub mod crew_engine_handler;
#[cfg(feature = "engine")]
pub mod cortex_server;

pub use agent_handler::{
    simple_agent, AgentMcpConfig, AgentMcpHandler, AgentMcpHandlerBuilder, AgentMcpInput,
    AgentMcpOutput,
};
pub use crew_handler::{
    CrewMcpConfig, CrewMcpHandler, CrewMcpHandlerBuilder, CrewMcpInput, CrewMcpOutput, TaskResult,
};
pub use graph_handler::{
    GraphMcpConfig, GraphMcpHandler, GraphMcpHandlerBuilder, GraphMcpInput, GraphMcpOutput,
    NodeExecution,
};
pub use bridge::McpToolBridge;
pub use client::McpClient;
pub use error::McpError;
pub use protocol::*;
pub use server::{
    AsyncFnTool, FnTool, McpServer, McpServerBuilder, PromptContent, PromptHandler, PromptMessage,
    ResourceHandler, ServerConfig, ToolHandler,
};
pub use session_resources::{
    MemorySessionStoreAdapter, MemoryTraceStoreAdapter, SessionMetadata, SessionResourceHandler,
    SessionStoreRead, TraceMetadata, TraceResourceHandler, TraceStoreRead,
};
pub use http_server::HttpServerConfig;
pub use sse_server::SseServerConfig;
pub use transport::{McpTransport, SseTransport, StdioTransport};

#[cfg(feature = "engine")]
pub use engine_handler::{EngineHandler, RunAgentInput};
#[cfg(feature = "engine")]
pub use crew_engine_handler::{CrewEngineHandler, CrewTaskInput, RunCrewInput};
#[cfg(feature = "engine")]
pub use tool_proxy_handler::ToolProxyHandler;
#[cfg(feature = "engine")]
pub use cortex_server::{CortexMcpServer, CortexMcpServerBuilder};