MCP HubMCP Hub
MatthewDailey

mcp-starter

by: MatthewDailey

A start template for a typescript mcp server

8created 16/01/2025
Visit
TypeScript
template

📌Overview

Purpose: To provide a minimal server template for developing AI assistant tools using the ModelContextProtocol.

Overview: The MCP Starter Server is designed for building tools compatible with AI assistants like Claude, featuring a straightforward setup for developers to create and integrate functionalities seamlessly.

Key Features:

  • Simple Tool Example: Offers a basic "hello world" tool that demonstrates essential functionalities and serves as a template for further development.

  • TypeScript + esbuild Setup: Utilizes TypeScript and esbuild for efficient build processes and type safety, ensuring robust and maintainable code.

  • Preconfigured Development Tools: Includes out-of-the-box configurations for development, debugging, and monitoring via tools like the MCP Inspector, allowing for effective testing and iteration.


MCP Starter Server

A minimal ModelContextProtocol (MCP) server template for building AI assistant tools. This starter provides a basic structure for creating MCP tools compatible with AI assistants like Claude.

Features

  • Simple "hello world" tool example
  • TypeScript + esbuild setup
  • Preconfigured development tools

Setup to Build and Run with Claude

  1. Download and install the Claude desktop app from https://claude.ai/download

  2. Clone the repository, install dependencies, and build:

    npm install
    npm run build
    
  3. Configure Claude to use this MCP server. If this is your first MCP server, in the root of this project run:

    echo '{
      "mcpServers": {
        "mcp-starter": {
          "command": "node",
          "args": ["'$PWD'/dist/index.cjs"]
        }
      }
    }' > ~/Library/Application\ Support/Claude/claude_desktop_config.json
    

    This should create an entry in your claude_desktop_config.json like:

    "mcpServers": {
      "mcp-starter": {
        "command": "node",
        "args": ["/Users/matt/code/mcp-starter/dist/index.cjs"]
      }
    }
    

    If you have existing MCP servers, add the mcp-starter block to your existing config. Make sure the args path points to <path_to_repo_on_your_machine>/mcp-starter/dist/index.cjs.

  4. Restart Claude Desktop.

  5. Look for the hammer icon with the number of available tools in Claude's interface to confirm the server is running.

  6. To develop your MCP server, use:

    npm run dev
    

    Remember to restart Claude each time to restart the MCP server.

Developing with Inspector

For development and debugging, use the MCP Inspector tool, which provides a visual interface for testing and monitoring MCP server interactions.

See the Inspector documentation for setup details.

To test locally with Inspector:

npm run inspect

To build on file changes:

npm run watch

Or run both watcher and inspector together:

npm run dev

Publishing

To distribute your server:

  1. Set up an NPM account at https://www.npmjs.com/

  2. Publish your package with:

    npm publish
    
  3. After publishing, others can install the server with a config entry like:

    "mcpServers": {
      "<your-package-name>": {
        "command": "npx",
        "args": ["<your-package-name>"]
      }
    }
    

Available Tools

The server provides:

  • hello_tool: A simple example tool that takes a name parameter and returns a greeting.

Creating New Tools

To add new tools:

  1. Define the tool schema in index.ts.
  2. Add it to the tools array in the ListToolsRequestSchema handler.
  3. Implement it in the CallToolRequestSchema handler.

Refer to the hello_tool implementation as an example.