@modelfetch/bun
v1.0.13
Published
Bun runtime adapter for MCP servers built with ModelFetch
Maintainers
Readme
@modelfetch/bun
Run fast MCP servers with Bun.
Installation
bun add @modelfetch/bunUsage
Start The Server
import handle from "@modelfetch/bun";
import server from "./server.ts"; // Import your McpServer
// Run as a Bun HTTP server
handle(server);Get Listening Address
import handle, { getListeningAddress } from "@modelfetch/bun";
import server from "./server.ts"; // Import your McpServer
// Run as a Bun HTTP server
const bunServer = handle(server);
// Print listening address
console.log(`The MCP server is listening at ${getListeningAddress(bunServer)}`);Specify Custom Port
import handle, { getListeningAddress } from "@modelfetch/bun";
import server from "./server.ts"; // Import your McpServer
// Run as a Bun HTTP server
const bunServer = handle(server, {
// Customize server options
port: 8080,
});
// Print listening address
console.log(`The MCP server is listening at ${getListeningAddress(bunServer)}`);API Reference
handle(server, options?)
Starts the MCP server
- server: Required
McpServerinstance from@modelcontextprotocol/sdk - options: Optional
Bun.ServeOptions
getListeningAddress(server)
Gets listening address from the Bun.Server instance
- server: Required
Bun.Serverinstance returned by thehandle()function
