Skip to main content
Glama
alexandresanlim

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

ParametersJSON Schema
NameRequiredDescriptionDefault
hashYesThe hash info to get block

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, and the description does not disclose behavioral traits like side effects, read-only nature, or response format. The phrase 'Returns details' lacks specificity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence with no wasted words; front-loaded with the key action and resource.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-parameter tool without output schema, the description is minimally adequate but lacks information about what 'details' are returned, reducing completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% (1 parameter fully described), so baseline is 3. The description 'The hash info to get block' adds minimal meaning beyond the existing schema definition.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description uses specific verb 'Returns' and resource 'block' with input 'hash', clearly distinguishing from sibling tools like get-ping and get-recommended-fees which have different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives, but the description's specificity makes usage obvious given the siblings' distinct functions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get-pingA

Get ping to check service is working

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so the description carries full burden. It states the tool checks service availability but does not disclose any side effects or latency. For a trivial ping, this is adequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence with no wasted words. It is front-loaded with the action and purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has no parameters, no output schema, and trivial complexity, the description fully covers its purpose and usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist (0 params), so the description adds no parameter info beyond the schema. Schema coverage is 100% trivially.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get ping to check service is working' clearly states the verb (get) and resource (ping). It is distinct from sibling tools get-block and get-recommended-fees, which have different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit when-to-use or when-not-to-use guidance is provided, but for a simple health check, the usage context is obvious. A score of 3 reflects the lack of explicit guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 3 tool updatesv1.0.0
    • First observedget-block
    • First observedget-ping
    • First observedget-recommended-fees

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.

Maintenance

ActivityInactive
ResponsivenessNo issues

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.
    6
    MIT