@aklinker1/mcp-server-sdk
v0.1.6
Published
SDK for building simple MCP servers with Bun & Deno
Downloads
199
Readme
@aklinker1/mcp-server-sdk
SDK for building simple MCP servers with Bun & Deno.
Alternative to the official @modelcontextprotocol/sdk@v1 with:
- Standard Schema compatible validation library support
- WHATWG
fetchstandard support (Bun & Deno servers) - Minimal dependencies (3 packages summing to 62KB vs 90 summing to 14MB)
- Result type builders
[!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
fetchfunction 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-sdkQuick 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.tsMCP Inspector
Use the @modelcontextprotocol/inspector package to inspec your server:
bunx @modelcontextprotocol/inspector@latest --transport http --server-url http://localhost:3000