MCP Server Template (

by bsmi021

326 downloads Not rated yet MIT license
GitHub

About

This template helps you quickly bootstrap a new Model Context Protocol (MCP) server project based on recommended practices.

Details

License
MIT license

Explore

- Bootstrap a new MCP server project in one command.
- Prompts for project details (name, description) during initialization.
- Predefined project structure (src/config, src/services, src/tools, etc.).
- Includes TypeScript, ESLint, Prettier, and Husky configuration.
- Step-by-step guide for adding new tools and services.
- Development mode with ts-node and nodemon for auto-reloading.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MCP Server Template (
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

1. Install Dependencies:
ash
npm install

2. Configure Husky (if needed, first time):
ash
npx husky install

3. Run in Development Mode: (Uses s-node and
odemon for auto-reloading)
ash
npm run dev

4. Build for Production:
ash
npm run build

5. Run Production Build:
ash
npm start

To create a new MCP server project named my-new-mcp-server, run the following command using npx:

npx create-mcp-server my-new-mcp-server

(Note: If you haven't published this package to npm, you might need to run npm link in this template directory first, then use create-mcp-server my-new-mcp-server)

This will:

1. Create a new directory named my-new-mcp-server.
2. Prompt you for project details (name, description).
3. Copy the template files (src, docs, config files, etc.) into the new directory.
4. Update the package.json with your project details.

After initialization, follow the instructions provided in the terminal:

```bash
cd my-new-mcp-server
npm install

1. Define Types: Create src/types/yourServiceTypes.ts with interfaces (e.g., YourServiceConfig, YourServiceData). Export from src/types/index.ts.
2. Implement Service: Create src/services/YourService.ts with the core logic class. Export from src/services/index.ts.
3. Define Tool Params: Create src/tools/yourToolParams.ts with TOOL_NAME, TOOL_DESCRIPTION, and TOOL_PARAMS (using Zod with detailed .describe() calls).
4. Implement Tool Registration: Create src/tools/yourTool.ts. Import the service and params. Create a function that instantiates the service and calls server.tool() with an async handler that validates input, calls the service, formats output, and handles errors (mapping to McpError).
5. Register the Tool: Import and call the registration function from src/tools/index.ts within the
egisterTools function.
6. Add Configuration: If needed, update src/config/ConfigurationManager.ts to include config types, defaults, getters, and updaters for the new service.
7. Add Utilities: If needed, add helper functions to src/utils/ and export them.
8. Write Tests: Add unit tests for the service logic in src/services/ and potentially integration tests for the tool adapter in src/tools/.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp server template (": {
            "custom-mcp-template": {
                "command": "npx",
                "args": [
                    "create-mcp-server",
                    "my-new-mcp-server"
                ]
            }
        }
    }
}

McpServers

{
    "custom-mcp-template": {
        "command": "npx",
        "args": [
            "create-mcp-server",
            "my-new-mcp-server"
        ]
    }
}

This template helps you quickly bootstrap a new Model Context Protocol (MCP) server project based on recommended practices.

Usage (Creating a New Server)

To create a new MCP server project named my-new-mcp-server, run the following command using npx:

npx create-mcp-server my-new-mcp-server

(Note: If you haven't published this package to npm, you might need to run npm link in this template directory first, then use create-mcp-server my-new-mcp-server)

This will:

1. Create a new directory named my-new-mcp-server.
2. Prompt you for project details (name, description).
3. Copy the template files (src, docs, config files, etc.) into the new directory.
4. Update the package.json with your project details.

After initialization, follow the instructions provided in the terminal:

```bash
cd my-new-mcp-server
npm install

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.