pub struct McpBrowserServer { /* private fields */ }Implementations§
Source§impl McpBrowserServer
impl McpBrowserServer
Sourcepub fn new(pool: Arc<BrowserPool>) -> Self
pub fn new(pool: Arc<BrowserPool>) -> Self
Create a new server backed by the given pool.
Call run to start the stdin/stdout event loop.
Sourcepub async fn run(&self) -> Result<()>
pub async fn run(&self) -> Result<()>
Run the JSON-RPC event loop.
Reads newline-delimited JSON from stdin and writes responses to stdout. Runs until stdin is closed (EOF).
§Errors
Returns an I/O error if stdin/stdout cannot be read from or written to.
Sourcepub async fn dispatch(&self, req: &Value) -> Value
pub async fn dispatch(&self, req: &Value) -> Value
Dispatch a single raw JSON-RPC request value.
Used by the stygian-mcp aggregator to route tool calls through this
server without running the full stdin/stdout loop.
§Example
use stygian_browser::{BrowserConfig, BrowserPool};
use stygian_browser::mcp::McpBrowserServer;
use std::sync::Arc;
use serde_json::json;
let pool = BrowserPool::new(BrowserConfig::default()).await?;
let server = McpBrowserServer::new(pool);
let req = json!({"jsonrpc":"2.0","id":1,"method":"initialize","params":{}});
let resp = server.dispatch(&req).await;
assert_eq!(resp["result"]["protocolVersion"], "2025-11-25");Auto Trait Implementations§
impl Freeze for McpBrowserServer
impl !RefUnwindSafe for McpBrowserServer
impl Send for McpBrowserServer
impl Sync for McpBrowserServer
impl Unpin for McpBrowserServer
impl UnsafeUnpin for McpBrowserServer
impl !UnwindSafe for McpBrowserServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more