Enables configuration through environment variables loaded from .env files, supporting easy management of API keys and other configuration settings needed by the MCP server.
Serves as the runtime environment for the MCP server, with support for Node.js 18 or higher, enabling server-side JavaScript execution and API integrations.
Provides full TypeScript support with proper typing throughout the codebase, enabling type safety for tool definitions, service implementations, and handler functions.
Generic MCP Server Template
A flexible template for creating Model Context Protocol (MCP) servers using the official TypeScript SDK.
What is MCP?
The Model Context Protocol (MCP) enables communication between AI assistants and locally running servers that provide additional tools and resources.
Related MCP server: Emcee
Features
Official SDK: Built with
@modelcontextprotocol/sdkType Safety: Full TypeScript support with Zod validation
Stdio Transport: Standard transport for local agent integration
Modular Design: Easy to add new tools and resources
Getting Started
Prerequisites
Node.js (v16 or later)
npm or yarn
Installation
Clone the repository:
git clone https://github.com/v4lheru/generic-mcp-template.git cd generic-mcp-serverInstall dependencies:
npm installBuild the project:
npm run build
Usage
To run the server locally (for testing or development):
Note: This server uses stdio transport, so it expects to communicate via standard input/output. It will not start an HTTP server.
Adding to Claude Desktop
Open Claude Desktop config (e.g.
~/Library/Application Support/Claude/claude_desktop_config.jsonon macOS).Add your server:
Customization
Tools: Add new tools in
src/tools.ts.Resources: Add new resources in
src/resources.ts.Config: Update
src/config.tsfor environment variables.
License
MIT