Bun-based MCP Server

by moikas-code

221 downloads
Not rated
GitHub

Description

# 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…

About

# 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 -…

Details

Author
moikas-code
Downloads
221
Categories
Developer Tools

- Minimal MCP server built with Bun and TypeScript
- Uses StdioServerTransport for local testing
- Strict TypeScript and ESLint configuration
- Example add tool (returns sum of two numbers)
- Dynamic tool loading simulated from a PostgreSQL database

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Bun-based MCP Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install Bun, then run bun install to install dependencies. Start the server with bun run src/index.ts; it listens for MCP requests via stdio. Lint with bun run lint and type-check with bun run tsc.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "bun-based mcp server": {
            "mcp-server-moikas-code": {
                "command": "bun",
                "args": [
                    "run",
                    "src/index.ts"
                ]
            }
        }
    }
}

McpServers

{
    "mcp-server-moikas-code": {
        "command": "bun",
        "args": [
            "run",
            "src/index.ts"
        ]
    }
}

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

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.