Skip to main content
Glama
forthy

effect-stateless-mcp

by forthy

effect-stateless-mcp

A stateless MCP server (Model Context Protocol, spec 2026-07-28) that exposes a greet tool. Built and tested with Effect.ts v4 and run on Bun.

The server is fully stateless: a fresh McpServer instance is created per HTTP request, so no session state is retained between calls (no initialize handshake, no Mcp-Session-Id).

Requirements

  • Bun (v1.3.14+)

  • Node types are provided by Bun; no separate Node install needed

Related MCP server: Bun Fun MCP Server

Install

bun install

Run

bun run src/index.ts

By default the server listens on http://localhost:3000/mcp. Override the port with the PORT environment variable (read via Effect's Config):

PORT=8787 bun run src/index.ts

Calling the greet tool

Send a JSON-RPC tools/call request to the /mcp endpoint:

curl -s -X POST http://localhost:3000/mcp \
  -H 'content-type: application/json' \
  -H 'accept: application/json, text/event-stream' \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": { "name": "greet", "arguments": { "name": "Ada", "style": "formal" } }
  }'

The greet tool accepts:

Field

Type

Required

Description

name

string

yes

Name to greet (trimmed, 1–100 chars)

style

"formal" | "casual"

no

Greeting style (defaults to casual)

Test

Tests use vitest with @effect/vitest:

bun run test

Type-check

bunx tsc --noEmit

Project structure

File

Responsibility

src/greeting.ts

Domain logic — makeGreeting and the typed GreetingError.

src/server.ts

Stateless MCP handler — registers the greet tool via createMcpHandler.

src/index.ts

Entry point — starts Bun.serve on the configured port via BunRuntime.runMain.

License

See repository for details.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A simple example MCP server built with Bun that provides basic utility tools including current time retrieval, message echoing, and number addition. Serves as a template for building MCP servers with Bun runtime.
    38 npm
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    A generic template for developing MCP servers with basic examples including echo tool, server info resource, and greeting prompt. Provides a starting point for building custom MCP servers with Bun.
    10 npm
    -
  • A
    license
    C
    quality
    C
    maintenance
    Habitica MCP server built with Effect v4, currently exposing a hello-world tool, resource, and prompt over stdio for early development and testing.
    1
    15 npm
    MIT