Transports
Connect your server to LLMs
Transports basically defines how the messages will be shared between the LLMs and your server. We use bridge
function to connect the muppet instance with the transport layer. You can learn more about the bridge
function here
Examples for all these transports are available here. You can learn more about transports in the MCP documentation.
Stdio Transport
The StdioServerTransport
is a transport layer that allows you to connect your server to LLMs using standard input and output streams. This transport layer is useful for running your server in environments where you don't have access to a network, such as in a local development environment or in a container or a private network.
This does blocks your stdio streams, so you won't be able to use console.log
or other stdio functions while the server is running. muppet
has a built-in logger that you can use to log messages. You can use the logger
prop to set the logger for your server. It uses pino
under the hood, so you can use any pino
compatible logger.
This will store all the logs in the muppet.log
file.
SSE Transport
The SSEServerTransport
is a transport layer that allows you to connect your server to LLMs using Server-Sent Events (SSE). This transport layer only runs in nodejs
runtime.
There is a better way, which is to use SSEHonoTransport
which runs on all runtimes which support streaming with hono.
SSE Hono Transport
This transport layer is similar to SSEServerTransport
, but it uses the hono
's streaming capabilities to send the response. This makes running this transport layer on all runtimes which support streaming, such as nodejs
, deno
, bun
, and cloudflare workers
. You can learn more about this in the hono documentation.