mcp-server-0.3.0.1: src/MCP/Server.hs
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
-- | Build an MCP server: run it over stdio or HTTP, or mount it as a WAI
-- application, with the handler and definition types re-exported from
-- "MCP.Server.Types". "MCP.Server.Derive" generates handlers from data
-- types.
module MCP.Server
( -- * Server Runtime
runMcpServerStdio
, runMcpServerStdioWithConfig
, runMcpServerHttp
, runMcpServerHttpWithConfig
-- * Transport Configuration
, StdioConfig(..)
, defaultStdioConfig
, HttpConfig(..)
, defaultHttpConfig
, mcpApplication
-- * Handlers that ask the client for input
, module MCP.Server.Ask
-- * Request state (multi round-trip requests)
, StateCodec(..)
, StateError(..)
, StateKey
, stateKey
, stateKeyId
, aeadStateCodec
, ephemeralStateCodec
, defaultStateLifetime
-- * Change Notifications
, McpNotifier(..)
, NotificationSource
, newMcpNotifier
-- * Re-exports
, module MCP.Server.Types
) where
import MCP.Server.Ask
import MCP.Server.Notifications (McpNotifier (..), NotificationSource,
newMcpNotifier)
import MCP.Server.Transport.Stdio (StdioConfig (..), defaultStdioConfig,
transportRunStdio,
transportRunStdioWithConfig)
import MCP.Server.Transport.Http (HttpConfig(..), transportRunHttp, defaultHttpConfig,
mcpApplication)
import MCP.Server.RequestState
import MCP.Server.Types
-- | Run an MCP server using STDIO transport
runMcpServerStdio :: McpServerInfo -> McpServerHandlers -> IO ()
runMcpServerStdio = transportRunStdio
-- | Run an MCP server using STDIO transport with custom configuration
runMcpServerStdioWithConfig :: StdioConfig -> McpServerInfo -> McpServerHandlers -> IO ()
runMcpServerStdioWithConfig = transportRunStdioWithConfig
-- | Run an MCP server using HTTP transport with default configuration
runMcpServerHttp :: McpServerInfo -> McpServerHandlers -> IO ()
runMcpServerHttp = transportRunHttp defaultHttpConfig
-- | Run an MCP server using HTTP transport with custom configuration
runMcpServerHttpWithConfig :: HttpConfig -> McpServerInfo -> McpServerHandlers -> IO ()
runMcpServerHttpWithConfig = transportRunHttp