Skip to main content
Glama

MCP 服务器集成 — 构建练习

面向 2.4 MCP Server Integration 的 CCA-F 预备练习脚手架。这里没有任何已解决的问题——下面的每个任务都有一个 TODO 供你填写。

任务清单

  • 1. 项目级配置 — .mcp.json 有一个 github 服务器条目(command/args)。如果不是 GitHub,请将其替换为你想要的任何社区服务器。

  • 2. 环境变量展开 — github 条目引用 ${GITHUB_TOKEN} 而不是硬编码的凭据。将 .env.example 复制到 .env 并填入真实的令牌。

  • 3. 用户级配置 — 这里故意不创建,因为 ~/.claude.json 位于项目之外,且是你机器上的个人配置。模板和步骤:docs/user-level-config.md。

  • 4. 暴露 MCP 资源 — src/server.ts 有一个 catalogue://TODO 资源的存根。将其替换为真实的内容目录(例如数据库模式或文档层级结构),并带有正确的 URI、名称、描述和 mimeType。

  • 5. 增强工具描述 — 同一文件中,example_tool 有一个 占位描述。写 3-5 句话,涵盖能力、输出、用例,以及它与内置替代方案的比较。

Related MCP server: MCP Inspector Server

设置

npm install
npm run dev        # starts the stdio server directly
npm run inspect     # opens MCP Inspector against the server for manual testing

布局

.mcp.json                   Task 1 & 2 — project-level server config
.env.example                Task 2 — template for the secret .mcp.json expands
docs/user-level-config.md   Task 3 — template + steps for ~/.claude.json
src/server.ts                Task 4 & 5 — custom MCP server with resource/tool stubs

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    A production-ready development scaffold for MCP servers, optimized for Cursor IDE with built-in tools, resources, and prompts that enables quick development of Model Context Protocol servers with 5-minute startup and 10-minute development capabilities.
    26
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    A basic MCP server template that provides a foundation for building custom tools, resources, and prompts. Serves as a starting point for developers to create their own MCP server functionality.
    -