{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Network.MCP.Server.StdIO
( runServerWithSTDIO,
withSTDIOServer,
)
where
import Network.MCP.Server
import Network.MCP.Transport.StdIO (newSTDIOTransport)
import UnliftIO (Async)
runServerWithSTDIO :: Server -> IO ()
runServerWithSTDIO :: Server -> IO ()
runServerWithSTDIO Server
server = do
STDIOTransport
stdioTransport <- IO STDIOTransport
newSTDIOTransport
Server -> STDIOTransport -> IO ()
forall t. Transport t => Server -> t -> IO ()
runServerWithTransport Server
server STDIOTransport
stdioTransport
withSTDIOServer :: Server -> (Async () -> IO a) -> IO a
withSTDIOServer :: forall a. Server -> (Async () -> IO a) -> IO a
withSTDIOServer Server
server Async () -> IO a
action = do
STDIOTransport
stdioTransport <- IO STDIOTransport
newSTDIOTransport
Server -> STDIOTransport -> (Async () -> IO a) -> IO a
forall t a.
Transport t =>
Server -> t -> (Async () -> IO a) -> IO a
withTransportServer Server
server STDIOTransport
stdioTransport Async () -> IO a
action