> For the complete documentation index, see [llms.txt](https://modelmesh.gitbook.io/cline-zhong-wen-ban-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://modelmesh.gitbook.io/cline-zhong-wen-ban-docs/cong-github-tian-jia-mcp-fu-wu-qi.md).

# 从 GitHub 添加 MCP 服务器

本指南提供了如何使用 Cline 从 GitHub 存储库构建现有 MCP 服务器的分步演练。

### **查找 MCP 服务器** <a href="#finding-an-mcp-server" id="finding-an-mcp-server"></a>

网上有多个地方可以找到 MCP 服务器：

* **Cline 可以自动将 MCP 服务器添加到其列表中，您可以对其进行编辑。Cline** 可以直接从 GitHub 克隆代码库并为您构建服务器。
* **GitHub：** 在 GitHub 上查找 MCP 服务器最常见的两个地方包括：
  * [官方 MCP 服务器存储库](https://github.com/modelcontextprotocol/servers)
  * [Awesome-MCP 服务器存储库](https://github.com/punkpeye/awesome-mcp-servers)
* **在线目录：** 一些网站列出了 MCP 服务器，包括：

  * [mcpservers.org](https://mcpservers.org/)
  * [mcp 文件](https://mcp.so/)
  * [glama.ai/mcp/服务器](https://glama.ai/mcp/servers)

  这些目录允许用户根据下载量、日期、星级和用例等各种条件对服务器进行排序。每个条目都提供功能、工具和配置说明等信息。
* **PulseMCP：** 该网站有一篇博客文章，探讨了人工智能如何利用 MCP 服务器淘汰传统网站。PulseMCP 还包含一个关于 MCP 服务器的常见问题解答部分： <https://www.pulsemcp.com/>

### **与Cline-胜算云增强版一起建造** <a href="#building-with-cline" id="building-with-cline"></a>

1. **启动流程：** 向Cline-胜算云增强版提供以下信息：
   * **GitHub Repository URL：** 服务器存储库的 URL。
   * **README.md 内容：** 此文件为可选，但有助于Cline-胜算云增强版理解服务器的用途和配置。您可以从 GitHub 仓库复制 README.md 文件。
2. **与Cline-胜算云增强版的互动示例：**

   复制

   ```
   User: "Cline, I want to add the MCP server for Brave browser control. Here's the GitHub link: @https://github.com/modelcontextprotocol/servers/tree/main/src/brave-search Can you add it?"

   Cline: "OK. Cloning the repository to the MCP directory. It needs to be built because it has a 'package.json' file. Should I run 'npm run build'?"

   User: "Yes, build it."

   Cline: "Build complete. This server needs a browser path. Where's your Brave browser executable?"

   User: "It's in '/Applications/Brave Browser.app/Contents/MacOS/Brave Browser'."

   Cline: "OK. I've updated the server config with that path and added it to 'cline_mcp_settings.json'. Anything else?"

   User: "No, that's all. Let's test it."

   Cline: "Great! Starting the MCP Inspector to test the server connection. After that, we can try controlling the browser from Cline."
   ```
3. **Cline-胜算云增强版的行动：** 根据您的指示，克莱恩将执行以下操作：
   * **存储库克隆：** Cline-胜算云增强版将把存储库克隆到您的本地机器，通常是在您的配置中指定的目录中。
   * **调整：** 您可以引导 Cline-胜算云增强版修改服务器配置。例如：
     * **用户：** “此服务器需要 API 密钥。您能找到应该添加它的位置吗？”
     * Cline-胜算云增强版可能会根据您的指示自动更新 `cline_mcp_settings.json` 文件或其他相关文件。
   * **构建服务器：** Cline-胜算云增强版将为服务器运行适当的构建命令，通常是 `npm run build` 。
   * **将服务器添加到设置：** Cline-胜算云增强版将服务器的配置添加到 `cline_mcp_settings.json` 文件。

### **测试和故障排除** <a href="#testing-and-troubleshooting" id="testing-and-troubleshooting"></a>

1. **测试服务器：** Cline-胜算云增强版完成构建过程后，请测试服务器以确保其正常运行。如果您遇到任何问题，Cline-胜算云增强版可以为您提供帮助。
2. **MCP 检查器：** 您可以使用 MCP 检查器测试服务器的连接和功能。

### **最佳实践** <a href="#best-practices" id="best-practices"></a>

* **了解基础知识：** 虽然 Cline-胜算云增强版简化了流程，但对服务器代码、MCP 协议 () 以及如何配置服务器有基本的了解仍然大有裨益。这有助于更有效地进行故障排除和自定义。
* **清晰的指示：** 在整个过程中向克莱恩提供清晰、具体的指示。
* **测试：** 安装和配置后彻底测试服务器，以确保其正常运行。
* **版本控制：** 使用版本控制系统（如 Git）来跟踪服务器代码的变化。
* **保持更新：** 保持您的 MCP 服务器更新以受益于最新的功能和安全补丁。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://modelmesh.gitbook.io/cline-zhong-wen-ban-docs/cong-github-tian-jia-mcp-fu-wu-qi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
