Skip to content

aklinker1/mcp-server-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@aklinker1/mcp-server-sdk

JSR NPM Version Docs Install Size

SDK for building simple MCP servers with Bun & Deno.

Alternative to the official @modelcontextprotocol/sdk@v1 with:

Warning

V2 of the official SDK will likely add support for all my changes. Waiting for that version to be released.

Supported Protocol Versions

Protocol Version Supported?
2025-11-25
2025-06-18
2025-03-26
2024-11-05
draft

Supported Features

MCP Feature Supported?
Transports > stdio
Transports > Streamable HTTP
Prompts
Resources
Tools
Authorization
Basic Utilities > Cancellation
Basic Utilities > Ping
Basic Utilities > Progress
Server Utilities > Completion
Server Utilities > Logging
Server Utilities > Pagination

Goal here is to create a generalized MCP fetch function that I can host in my homelab and use in chats that supports Bun.

Installation

npm i @aklinker1/mcp-server-sdk
bun add @aklinker1/mcp-server-sdk
deno add @aklinker1/mcp-server-sdk

Quick Start

// main.ts

import {
  createMcpFetchTransport,
  definePrompt,
  defineTool,
  defineResourceTemplate,
} from "@aklinker1/mcp-server-sdk";
import z from "zod";

// Define your prompts, resources, and tools

const examplePrompt = definePrompt({
  argsSchema: z.object({
    param: z.string(),
  }),
  handler: async ({ args }) => {
    // ...
  },
});

const exampleResource = defineResourceTemplate({
  uriTemplate: "example://{id}",
  uriSchema: z.object({
    id: z.string(),
  }),
  handler: async ({ uri }) => {
    // ...
  },
});

const exampleTool = defineTool({
  inputSchema: z.object({
    param: z.string(),
  }),
  handler: async ({ input }) => {
    // ...
  },
});

// Create a server-side fetch function

const fetch = createMcpFetchTransport({
  toJsonSchema: z.toJSONSchema,
  prompts: {
    examplePrompt,
  },
  resources: {
    exampleResource,
  },
  tools: {
    exampleTool,
  },
});

// Serve the MCP server at http://localhost:3000

Bun.serve({ fetch });
// or
Deno.serve({ fetch });

Then run your server!

bun run main.ts
deno run --allow-net main.ts

MCP Inspector

Use the @modelcontextprotocol/inspector package to inspec your server:

bunx @modelcontextprotocol/inspector@latest --transport http --server-url http://localhost:3000

About

Server-side APIs for creating MCP server-side fetch functions

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors