Boilerplate MCP Server

by aashari

71 stars
375 downloads
Not rated
GitHub

About

TypeScript Model Context Protocol (MCP) server boilerplate providing IP lookup tools/resources. Includes CLI support and extensible structure for connecting AI systems (LLMs) to external data sources like ip-api.com. Ideal template for creating new MCP integrations via Node.js.

Details

Author
aashari
GitHub stars
71
Downloads
375
Categories
Developer Tools, AI

- Security First: DNS rebinding protection and localhost-only binding
- Dual Transport Support: STDIO and Streamable HTTP with automatic fallback
- Layered Architecture: Six clean layers for maintainable code
- Type Safety: Full TypeScript with Zod v4.3.6 schema validation
- All MCP Primitives: Tools, resources, and prompts with examples
- TOON Output Format: 30–60% fewer tokens than JSON

Clone the repository, install dependencies, and build the project. Run in CLI mode (npm run cli -- get-ip-details), STDIO transport (npm run mcp:stdio), HTTP transport (npm run mcp:http), or development with MCP Inspector (npm run mcp:inspect). Transport mode is configured via the TRANSPORT_MODE environment variable.

Boilerplate MCP Server

A production-ready foundation for developing custom Model Context Protocol (MCP) servers in TypeScript. Provides a complete layered architecture pattern, working example implementation, and comprehensive developer infrastructure to connect AI assistants with external APIs and data sources.

NPM Version
License: ISC

> Latest Update (Feb 2026): Updated to MCP SDK 1.26.0 and Zod 4.3.6 with continued modern registerTool patterns and streamable HTTP improvements. See docs/MODERNIZATION.md for details.

Features

- Security First: DNS rebinding protection, localhost-only binding, secure error handling
- Dual Transport Support: STDIO and Streamable HTTP transports with automatic fallback
- Layered Architecture: Clean separation between CLI, tools, resources, prompts, controllers, services, and utilities
- Type Safety: Full TypeScript implementation with Zod v4.3.6 schema validation
- All MCP Primitives: Tools, resources, and prompts (with examples)
- ResourceLink Pattern: Token-efficient resource references for large responses
- TOON Output Format: Token-Oriented Object Notation for 30-60% fewer tokens than JSON
- JMESPath Filtering: Extract only needed fields from responses to reduce token costs
- Raw Response Logging: Automatic logging of large API responses to /tmp/mcp/<project>/ with truncation guidance
- Modern SDK: Uses MCP SDK v1.26.0 with registerTool API pattern (ready for v2 migration)
- Complete IP Address Example: Tools, resources, prompts, and CLI commands for IP geolocation
- Comprehensive Testing: Unit and integration tests with coverage reporting (47 tests passing)
- Production Tooling: ESLint, Prettier, semantic-release, and MCP Inspector integration
- Error Handling: Structured error handling with isError field and contextual logging
- Security Documentation: Complete SECURITY.md with authentication implementation guides

What is MCP?

Model Context Protocol (MCP) is an open standard for securely connecting AI systems to external tools and data sources. This boilerplate implements the MCP specification with a clean, layered architecture that can be extended to build custom MCP servers for any API or data source.

Prerequisites

- Node.js (>=20.x): Download
- Git: For version control

Quick Start

```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.