Cover image
Try Now
2025-03-08

最小的打字稿模板构建MCP服务器

3 years

Works with Finder

1

Github Watches

5

Github Forks

9

Github Stars

MCP Server Template 🛠️

A starter template for building your own Model Context Protocol (MCP) server. This template provides the basic structure and setup needed to create custom MCPs that can be used with Cursor or Claude Desktop.

Features

  • Basic MCP server setup with TypeScript
  • Sample tool implementation
  • Ready-to-use project structure
  • Built with @modelcontextprotocol/sdk

Project Structure

mcp-server-template/
├── index.ts        # Main server implementation
├── package.json    # Project dependencies
├── tsconfig.json   # TypeScript configuration
└── build/         # Compiled JavaScript output

Getting Started

  1. Clone this template:
git clone [your-repo-url] my-mcp-server
cd my-mcp-server
  1. Install dependencies:
pnpm install
  1. Build the project:
pnpm run build

This will generate the /build/index.js file - your compiled MCP server script.

Using with Cursor

  1. Go to Cursor Settings -> MCP -> Add new MCP server
  2. Configure your MCP:
    • Name: [choose your own name]
    • Type: command
    • Command: node ABSOLUTE_PATH_TO_MCP_SERVER/build/index.js

Using with Claude Desktop

Add the following MCP config to your Claude Desktop configuration:

{
  "mcpServers": {
    "your-mcp-name": {
      "command": "node",
      "args": ["ABSOLUTE_PATH_TO_MCP_SERVER/build/index.js"]
    }
  }
}

Development

The template includes a sample tool implementation in index.ts. To create your own MCP:

  1. Modify the server configuration in index.ts:
const server = new McpServer({
  name: "your-mcp-name",
  version: "0.0.1",
});
  1. Define your custom tools using the server.tool() method:
server.tool(
  "your-tool-name",
  "Your tool description",
  {
    // Define your tool's parameters using Zod schema
    parameter: z.string().describe("Parameter description"),
  },
  async ({ parameter }) => {
    // Implement your tool's logic here
    return {
      content: [
        {
          type: "text",
          text: "Your tool's response",
        },
      ],
    };
  }
);
  1. Build and test your implementation:
npm run build

Contributing

Feel free to submit issues and enhancement requests!

License

MIT

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Callycode Limited
  • A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Khalid kalib
  • Write professional emails

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Beniyam Berhanu
  • Therapist adept at identifying core issues and offering practical advice with images.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • OffchainLabs
  • 进行以太坊的实施

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • deemkeen
  • 用电源组合控制您的MBOT2:MQTT+MCP+LLM

    Reviews

    3 (1)
    Avatar
    user_x6VlJnSI
    2025-04-16

    The mcp-server-template by jatinsandilya is an incredible resource for developers seeking a robust and efficient server template. With its well-structured code and comprehensive documentation, it significantly simplifies the server setup process. I highly recommend checking it out at https://github.com/jatinsandilya/mcp-server-template. This template has become indispensable for my projects, and I appreciate the thoughtfulness and expertise that went into its creation.