muppet logo
Concepts

MCP & Bridge

Creating the MCP instance of your app

Muppet

Now that you have defined your tools and prompts, you can create the MCP instance of your app. This is done using the muppet function. This function takes the app instance and an configurtions object as arguments.

import { Hono } from "hono";
import { muppet } from "muppet";
 
const app = new Hono();
 
// Define your tools, prompts, and resources here
// ...
 
const instance = muppet(app, {
  name: "My Muppet",
  version: "1.0.0",
});
 

The muppet function takes the following configurations

PropTypeDefault
name
string
-
version
string
-
logger?
number
-
resources?
Record<string, ResourceFetcherFn>
-
events?
Emitter<ClientToServerNotifications>
-

Bridge

Now let's create a bridge between the LLM and your server. This is done using the bridge function. Think of this like Bifröst, it connects the LLM using the transport layer to your server.

This takes in your muppet instance and the transport layer you wanna use.

import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { Hono } from "hono";
import { muppet, bridge } from "muppet";
 
const app = new Hono();
 
// Define your tools, prompts, and resources here
// ...
 
const instance = muppet(app, {
  name: "My Muppet",
  version: "1.0.0",
}).then((mcp) => {
  if (!mcp) {
    throw new Error("MCP not initialized");
  }
 
  bridge({
    mcp,
    transport: new StdioServerTransport(),
  });
});
 

You can check out other transport layers here.

On this page