Skip to main content
Glama
mcp-server-ddd-template

mcp-server-ddd-template

๐Ÿš€ MCP Server DDD Template

This repository is a template implementation of a Model Context Protocol (MCP) server in Node.js/TypeScript, designed to demonstrate a clean, layered architecture using Domain-Driven Design (DDD) principles. It provides tools to obtain Bitcoin-related information via external APIs.

โœจ Key Features

  • ๐Ÿ—๏ธ Template Project: This codebase serves as a reference template for structuring MCP servers with DDD, ready for customization and production use.

  • ๐Ÿ”Œ MCP Protocol: Communicates via stdio using the MCP protocol (@modelcontextprotocol/sdk).

  • ๐Ÿ›๏ธ Layered DDD Architecture: Clear separation of domain, application, infrastructure, and interface layers.

  • โšก TypeScript: Fully typed with modern TypeScript for better development experience.

Related MCP server: Bitcoin-MCP-Server

๐Ÿ“ Project Structure

src/
โ”œโ”€โ”€ domain/                  # ๐Ÿ›๏ธ Domain models and response interfaces
โ”‚   โ””โ”€โ”€ models/
โ”‚       โ””โ”€โ”€ responses/
โ”‚           โ”œโ”€โ”€ ** interfaces responses **
โ”œโ”€โ”€ infrastructure/          # ๐Ÿ”Œ External API clients and request services
โ”‚   โ”œโ”€โ”€ interfaces/
โ”‚   โ”‚   โ””โ”€โ”€ IApiClient.ts
โ”‚   โ””โ”€โ”€ services/
โ”‚       โ”œโ”€โ”€ clients/
โ”‚       โ”‚   โ””โ”€โ”€ ** client api
โ”‚       โ””โ”€โ”€ requests/
โ”‚           โ”œโ”€โ”€ ** requests services **
โ”œโ”€โ”€ application/             # โš™๏ธ Business logic and helpers
โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ”œโ”€โ”€ ** services implementation **
โ”‚   โ””โ”€โ”€ helpers/
โ”‚       โ””โ”€โ”€ ** helpers **
โ”œโ”€โ”€ interface/               # ๐ŸŽฎ Controllers (MCP tool registration)
โ”‚   โ””โ”€โ”€ controllers/
โ”‚       โ”œโ”€โ”€ base/
โ”‚       โ”‚   โ””โ”€โ”€ BaseToolsController.ts
โ”‚       โ”œโ”€โ”€ **controllers to inteface**
โ”‚       โ””โ”€โ”€ index.ts
โ”œโ”€โ”€ shared/                  # ๐Ÿ”— Shared types/parameters
โ”‚   โ””โ”€โ”€ parameters/
โ”‚       โ””โ”€โ”€ **interfaces parameters**
โ””โ”€โ”€ main.ts                  # ๐Ÿš€ Application entry point

๐Ÿš€ Getting Started

git clone https://github.com/alexandresanlim/mcp-server-ddd-template.git
cd mcp-server-ddd-template
npm install
npm run build

๐ŸŽฏ Usage

After building, you can run the server directly:

node build/main.js

Or, if registered as a binary (for example, mcp-server-ddd-template):

npm link
mcp-server-ddd-template

The server will start on standard output (stdio) and wait for MCP requests.

๐Ÿ› ๏ธ Available Tools in this sample

  • ๐Ÿ’ฐ get-recommended-fees: Get recommended Bitcoin transaction fees from Mempool.space

  • ๐Ÿ”— ping: Simple health check endpoint

๐Ÿ”— Integration Example

To use this MCP server as a tool provider in a client (e.g., Claude client), you can either reference a local build or use the published npm package.

๐Ÿ“‚ Using Local Build Path

"btc-server": {
    "command": "node",
    "args": [
        "{your project path}/mcp-server-ddd-template/build/main.js"
    ]
}

๐Ÿ› ๏ธ Development

Build Commands

# Build for Unix/Linux/macOS
npm run build

# Build for Windows
npm run build:windows

# Run the server
npm run server

Dependencies

  • @modelcontextprotocol/sdk: MCP protocol implementation

  • zod: Runtime type validation

  • typescript: Type safety and compilation

๐Ÿค Contributing

Pull requests are welcome! Feel free to open issues or suggest improvements for this template repository.

โญ Star this repository if you find it helpful!

Available Tools

3 tools
get-blockA

Returns details about a block from hash

Inputs: hash (required).

get-pingA

Get ping to check service is working

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelogโ€ฆ

    TDQS

    A3.8/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool targets a distinct purpose: block details, health check, and fee recommendations. There is no overlap or ambiguity.

    Naming Consistency5/5

    All tools follow a consistent 'get-' prefix with hyphenated lowercase naming, forming a clear pattern.

    Tool Count4/5

    Three tools is a reasonable count for a minimal Bitcoin service, though the server's purpose as a template might justify even fewer.

    Completeness3/5

    The set covers block retrieval, health checking, and fee recommendations, but lacks common Bitcoin operations like transaction handling, making it somewhat incomplete for a full service.

    Related MCP Connectors

    Related MCP Servers

    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      A basic MCP server template built with FastMCP framework that provides example tools for echoing messages and retrieving server information. Serves as a starting point for developing custom MCP servers with Docker support and CI/CD integration.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      MCP server for Bitcoin block explorer and mempool/fee statistics, providing tools to query fees, mempool stats, blocks, transactions, addresses, hashrate, and mining pools.
      300 npm
      MIT