Skip to main content
Glama

MCP Server Template

MCP 服务器模板🛠️

用于构建您自己的模型上下文协议 (MCP) 服务器的入门模板。此模板提供了创建可与 Cursor 或 Claude Desktop 配合使用的自定义 MCP 所需的基本结构和设置。

特征

项目结构

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

入门

  1. 克隆此模板:
git clone [your-repo-url] my-mcp-server cd my-mcp-server
  1. 安装依赖项:
pnpm install
  1. 构建项目:
pnpm run build

这将生成/build/index.js文件 - 已编译的 MCP 服务器脚本。

与游标一起使用

  1. 前往“光标设置”->“MCP”->“添加新的 MCP 服务器”
  2. 配置您的 MCP:
    • 姓名:[选择您自己的名字]
    • 类型:命令
    • 命令: node ABSOLUTE_PATH_TO_MCP_SERVER/build/index.js

与 Claude Desktop 一起使用

将以下 MCP 配置添加到您的 Claude Desktop 配置中:

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

发展

该模板在index.ts中包含一个示例工具实现。要创建您自己的 MCP,请执行以下操作:

  1. 修改index.ts中的服务器配置:
const server = new McpServer({ name: "your-mcp-name", version: "0.0.1", });
  1. 使用server.tool()方法定义您的自定义工具:
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. 构建并测试您的实现:
npm run build

贡献

请随时提交问题和增强请求!

执照

麻省理工学院

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

local-only server

The server can only run on the client's local machine because it depends on local resources.

用于构建模型上下文协议服务器的入门模板,可以与 Cursor 或 Claude Desktop 集成,允许开发人员为 AI 助手创建自定义工具和扩展。

  1. 特征
    1. 项目结构
      1. 入门
        1. 与游标一起使用
          1. 与 Claude Desktop 一起使用
            1. 发展
              1. 贡献
                1. 执照

                  Related MCP Servers

                  • -
                    security
                    F
                    license
                    -
                    quality
                    A Model Context Protocol server that enables AI assistants to explore and interact with Cursor IDE's SQLite databases, providing access to project data, chat history, and composer information.
                    Last updated -
                    10
                    Python
                    • Apple
                  • -
                    security
                    F
                    license
                    -
                    quality
                    A Model Context Protocol server that enables AI assistants like Claude to perform Python development tasks through file operations, code analysis, project management, and safe code execution.
                    Last updated -
                    1
                    Python
                    • Linux
                    • Apple
                  • -
                    security
                    F
                    license
                    -
                    quality
                    A Model Context Protocol server that connects AI assistants like Claude to Notion workspaces, enabling them to view, search, create, and update Notion databases, pages, and content blocks.
                    Last updated -
                    275
                    JavaScript
                    • Apple
                  • A
                    security
                    A
                    license
                    A
                    quality
                    A foundation for building custom local Model Context Protocol (MCP) servers that provide tools accessible to AI assistants like Cursor or Claude Desktop.
                    Last updated -
                    1
                    9
                    TypeScript
                    MIT License

                  View all related MCP servers

                  MCP directory API

                  We provide all the information about MCP servers via our MCP API.

                  curl -X GET 'https://glama.ai/api/mcp/v1/servers/jatinsandilya/mcp-server-template'

                  If you have feedback or need assistance with the MCP directory API, please join our Discord server