generic-mcp-server
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Integrations
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 modular, extensible Model Context Protocol (MCP) server template designed for easy customization and extension.
Features
- Modular Architecture: Clear separation of concerns with a well-defined structure
- Small, Focused Files: Better maintainability and easier for AI to ingest
- Easy Extension Points: Simple patterns for adding new tools and services
- Comprehensive Error Handling: Robust error management throughout the codebase
- Type Safety: Full TypeScript support with proper typing
Project Structure
Getting Started
Prerequisites
- Node.js 18 or higher
- npm or yarn
Installation
- Clone this repository:Copy
- Install dependencies:Copy
- Create a
.env
file based on.env.example
:Copy - Edit the
.env
file with your API keys and configuration.
Building and Running
- Build the project:Copy
- Run the server:Copy
Extending the Template
Adding a New Service
- Create a new service file in
src/services/
:Copy - Add any necessary types in
src/types/
.
Adding New Tools
- Define your tools in a new file or extend the existing one in
src/tools/
:Copy - Implement handlers for your tools:Copy
- Register your tools and handlers in
src/index.ts
.
Configuration
The template uses a centralized configuration system in src/config.ts
. Configuration can be provided through:
- Environment variables
- Command line arguments (with
--env KEY=VALUE
) - Default values in the code
Error Handling
The template includes comprehensive error handling:
- Service-level error handling with rate limiting support
- Tool-level error handling with proper error messages
- MCP protocol error handling
License
MIT
This server cannot be installed
A framework to use with AI to easily create a server for any service. Just drop the API Documentation in it and ask to create the MCP.