mcpField
B
Bun-based MCP Server

Bun-based MCP Server

Local
github.com/moikas-codeDeveloper Tools0Updated 77w ago

About Bun-based MCP Server

A minimal MCP server example built with Bun and TypeScript, intended for developers exploring server implementation. It demonstrates stdio transport, a basic addition tool, and simulated dynamic tool loading from PostgreSQL.

Key features

  1. 01Bun and TypeScript implementation
  2. 02Stdio server transport
  3. 03Example add tool
  4. 04Simulated PostgreSQL tool loading
  5. 05Lint and type-check scripts

Use cases

  1. 01Study a minimal MCP server
  2. 02Test MCP requests over stdio
  3. 03Experiment with tool definitions loaded from a database

MCP support

It implements an MCP server using `@modelcontextprotocol/sdk` and `StdioServerTransport`. The server exposes an `add` tool and demonstrates simulated dynamic tool loading.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

Bun-based MCP Server

This is a minimal Model Context Protocol (MCP) server using Bun, TypeScript, and the @modelcontextprotocol/sdk package. It demonstrates:

  • StdioServerTransport for local testing
  • A basic example tool (add) that adds two numbers
  • Dynamic tool loading from a (mocked) PostgreSQL database
  • Strict TypeScript and ESLint configuration

Setup

  1. Install Bun.
  2. Install dependencies:
bun install

Usage

Start the server:

bun run src/index.ts

The server will listen for MCP requests via stdio.

Tool Loading

The function load_tools_from_db simulates loading tool definitions and handlers from a PostgreSQL database. Replace this with real database logic as needed.

Example Tool

The add tool takes two numbers (a and b) and returns their sum as result.

Linting

bun run lint

Type Checking

bun run tsc

File Structure

  • src/index.ts: Main server entry point
  • tsconfig.json: TypeScript configuration
  • .eslintrc.json: ESLint configuration
  • package.json: Project metadata and scripts

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.