API & MCP Server Skeleton (ElysiaJS + Bun)

by luridarmawan

2 203 downloads Not rated yet
GitHub

About

A lightweight, high-performance API server built with ElysiaJS on the Bun runtime. It integrates Model Context Protocol (MCP) for context-aware AI interactions and includes WebSocket support for real-time communication. Designed for developers who need a fast, scalable server…

Explore

- REST API Server powered by Bun runtime.
- WebSocket Event Handling (realtime communication).
- Model Context Protocol (MCP) base support:
- MCP Plugin Registry
- MCP Discovery Endpoint (/.well-known/mcp.json)
- Hot reload during development.
- Ready for scalable deployment.
- Example Events: Prayer Schedule, Event Registration.

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 API & MCP Server Skeleton (ElysiaJS + Bun)
    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

Clone this project and install dependencies:

git clone https://github.com/luridarmawan/mcp-api-server.git
cd mcp-api-server
bun install

Run development server:

bun run dev

Open http://localhost:3000 in your browser.

You can interact with the server via WebSocket:

1. Install wscat if needed:

npm install -g wscat

2. Connect to the WebSocket server:

wscat -c ws://localhost:3000

3. Example Events you can send:

| Event | Payload Example | Description |
|---|---|---|
| prayer:schedule | "Jakarta" | Get prayer times for a city |
| registration:new | { "name": "Alice", "phone": "081122334455", "email": "[email protected]" } | Register a new user |


npm install -g wscat

Build and run for production:

bash
bun run build
bun start
```

Ready to deploy on platforms like Vercel, Railway, Fly.io, or any Bun-supported environment.

Claude Desktop / Cursor

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

{
    "mcpServers": {
        "api & mcp server skeleton (elysiajs + bun)": {
            "mcp-api-server": {
                "command": "bun",
                "args": [
                    "run",
                    "dev"
                ]
            }
        }
    }
}

McpServers

{
    "mcp-api-server": {
        "command": "bun",
        "args": [
            "run",
            "dev"
        ]
    }
}

bun
elysia
mcp
websocket
license

__(Documentation is not yet complete.)__

<!-- TOC -->
<details>
<summary>📑 Daftar Isi</summary>

- API & MCP Server Skeleton (ElysiaJS + Bun)
- 🚀 Features
- 📌 Requirements
- 🛠️ Getting Started
- 🧠 Model Context Protocol (MCP)
- 🔌 WebSocket Usage
- 📁 Project Structure
- 🚀 Deployment
- 🔖 License
- 📘 References
- MCP vs Traditional API
</details>

---

A lightweight, high-performance API Server using ElysiaJS with Bun runtime, integrated with Model Context Protocol (MCP) and WebSocket support.

🚀 Features

- REST API Server powered by Bun runtime.
- WebSocket Event Handling (realtime communication).
- Model Context Protocol (MCP) base support:
- MCP Plugin Registry
- MCP Discovery Endpoint (/.well-known/mcp.json)
- Hot reload during development.
- Ready for scalable deployment.
- Example Events: Prayer Schedule, Event Registration.

📋 Requirements

- Bun runtime (v1.0+): Install Bun
- Node.js (optional, for installing tools like wscat)
- WebSocket client (Postman, wscat, etc.)

🛠️ Getting Started

Clone this project and install dependencies:

git clone https://github.com/luridarmawan/mcp-api-server.git
cd mcp-api-server
bun install

Run development server:

bun run dev

Open http://localhost:3000 in your browser.

🧠 Model Context Protocol (MCP)

MCP is a lightweight communication protocol designed to enable context-aware interactions with AI agents or applications.

- Base URL: http://localhost:3000/mcp
- Discovery Endpoint: http://localhost:3000/mcp/.well-known/mcp.json

Example basic MCP interaction via WebSocket:

{
  "event": "prayer:schedule",
  "data": {
    "city": "Jakarta"
  }
}

For full details, see MCP and API Explanation.

🔌 WebSocket Usage

You can interact with the server via WebSocket:

1. Install wscat if needed:

npm install -g wscat

2. Connect to the WebSocket server:

wscat -c ws://localhost:3000

3. Example Events you can send:

| Event | Payload Example | Description |
|---|---|---|
| prayer:schedule | "Jakarta" | Get prayer times for a city |
| registration:new | { "name": "Alice", "phone": "081122334455", "email": "[email protected]" } | Register a new user |

```bash

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.