Related MCP Server Resources

Explore more AI models, providers, and integration options:

  • Explore AI Models
  • Explore AI Providers
  • Explore MCP Servers
  • LangDB Pricing
  • Documentation
  • AI Industry Blog
  • Image Generation MCP Server
  • Image Processor MCP Server
  • Aider MCP Server
  • Semgrep MCP Server
  • Sanity MCP Server
Back to MCP Servers
generic-mcp-server

generic-mcp-server

Public
v4lheru/generic-mcp-template

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.

Verified
typescript
0 tools
May 29, 2025
Updated May 30, 2025

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

generic-mcp-template/
├── src/
│   ├── services/       # Service classes for API interactions
│   │   ├── base-service.ts        # Abstract base service with common functionality
│   │   └── example-service.ts     # Example service implementation
│   ├── tools/          # MCP tool definitions and handlers
│   │   ├── example-tools.ts       # Tool definitions (name, description, schema)
│   │   └── example-tool-handlers.ts # Tool handler implementations
│   ├── types/          # TypeScript type definitions
│   │   └── example-types.ts       # Example type definitions
│   ├── config.ts       # Configuration management
│   └── index.ts        # Main entry point
├── .env.example        # Example environment variables
├── package.json        # Project dependencies and scripts
├── tsconfig.json       # TypeScript configuration
└── README.md           # Project documentation

Getting Started

Prerequisites

  • Node.js 18 or higher
  • npm or yarn

Installation

  1. Clone this repository:

    git clone https://github.com/v4lheru/generic-mcp-template.git cd generic-mcp-template
  2. Install dependencies:

    npm install
  3. Create a .env file based on .env.example:

    cp .env.example .env
  4. Edit the .env file with your API keys and configuration.

Building and Running

  1. Build the project:

    npm run build
  2. Run the server:

    npm start

Extending the Template

Adding a New Service

  1. Create a new service file in src/services/:

    // src/services/my-service.ts import { BaseService } from './base-service.js'; import config from '../config.js'; export class MyService extends BaseService { // Implement your service... }
  2. Add any necessary types in src/types/.

Adding New Tools

  1. Define your tools in a new file or extend the existing one in src/tools/:

    // src/tools/my-tools.ts export const myTools = [ { name: "my_tool", description: "Description of my tool", inputSchema: { // JSON Schema for the tool's input } } ];
  2. Implement handlers for your tools:

    // src/tools/my-tool-handlers.ts import { MyService } from '../services/my-service.js'; export function createMyToolHandlers(myService: MyService) { return { my_tool: async (args: any) => { // Implement your tool handler } }; }
  3. 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

Publicly Shared Threads0

Discover shared experiences

Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!

Share your threads to help others
Related MCPs5
  • Image Generation MCP Server
    Image Generation MCP Server

    A Model Context Protocol server that enables generation of high-quality images using the Flux.1 Schn...

    1 tools
    Added May 30, 2025
  • Image Processor MCP Server
    Image Processor MCP Server

    A TypeScript-based MCP server that implements a simple notes system, allowing users to create, acces...

    2 tools
    Added May 30, 2025
  • Aider MCP Server
    Aider MCP Server

    A Model Context Protocol server that connects Claude and other MCP clients to Aider, enabling AI ass...

    Added May 30, 2025
  • Semgrep MCP Server
    Semgrep MCP Server

    An MCP server that provides a comprehensive interface to Semgrep, enabling users to scan code for se...

    6 tools
    Added May 30, 2025
  • Sanity MCP Server
    Sanity MCP Server

    Connect your Sanity content to AI agents. Create, update, and explore structured content using Claud...

    Added May 30, 2025