mcp

mcp

Please provide the English text you would like me to translate to Chinese. I need the "mcp example from webset" to be able to translate it.

zhkzly

开发者工具
访问服务器

README

mcp

这个是参考:

https://mp.weixin.qq.com/s/ULxokHOn4zVOgiLHf9DQUA,

https://zhuanlan.zhihu.com/p/20222456593

作出一些简单地补充,采用cline 当作client,可以选择gemini作为llm

1743774040990

文中似乎没有特意注明如何使用claude desktop。这里可以选择多种client作为和llm沟通的平台(就是一个界面,也可以自己写)

当前可以选择的client 在llms-full.txt 中有列出来

server 主要是用来生成工具的,工具正如/src/calculate.py,src/datawale.py中展示的,所以一般而言,我们需要定义的就是这个工具(有人进行了开源可以自行选择,比如:https://composio.dev/)

在这里主要展示如何使用client

vscode 中安装Cline 插件,选择合适的模型,如上图

然后选择 mcp servers ,installed ,edit configuration将配置文件添加进去即可

1743774942455

1743774549113

command 这里必须使用绝对路径,相对路径会出现错误

调用工具的时候,应该是类似与首先执行server 使其始终运行,以便之后进行通信调用 类似于:/Users/{username}/.local/bin/uv --directory /Users/{username}... run txt_counter.py

--directory 切换执行目录。

1743774752161

也可以直接运行txt_counter.py,但是需要自己修改端口 1743774856667

client(我没有尝试)

src/mcp_client.py

参考:https://github.com/modelcontextprotocol/python-sdk?tab=readme-ov-file#quickstart

实际上的作用就是类似于一个ui,目的就是和llm进行通信,获取response(比如需要调用的工具,可以参考langchain)

llms-full.txt 官方的说明文档吧(第一个链接中有)

一些使用的简单示例

https://modelcontextprotocol.io/examples

prompts:的结构

有点类似与langchain bind_tools,但是功能更强大

https://modelcontextprotocol.io/docs/concepts/prompts#prompts

Prompts enable servers to define reusable prompt templates and workflows that clients can easily surface to users and LLMs. They provide a powerful way to standardize and share common LLM interactions.

Prompts are designed to be user-controlled , meaning they are exposed from servers to clients with the intention of the user being able to explicitly select them for use.

{
  name: string;              // Unique identifier for the prompt
  description?: string;      // Human-readable description
  arguments?: [              // Optional list of arguments
    {
      name: string;          // Argument identifier
      description?: string;  // Argument description
      required?: boolean;    // Whether argument is required
    }
  ]
}

how to use:

git clone <repo_path>

cd <repo>

安装 uv

https://docs.astral.sh/uv/getting-started/installation/

uv run script.py

上面的指令会自动安装对应的环境到(./.venv)当前文件夹下,实际上在cline中配置mcp server的时候会自己运行uv相关的内容,如果没有环境,会自动根据项目下的

推荐服务器

Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
MCP Package Docs Server

MCP Package Docs Server

促进大型语言模型高效访问和获取 Go、Python 和 NPM 包的结构化文档,通过多语言支持和性能优化来增强软件开发。

精选
本地
TypeScript
Claude Code MCP

Claude Code MCP

一个实现了 Claude Code 作为模型上下文协议(Model Context Protocol, MCP)服务器的方案,它可以通过标准化的 MCP 接口来使用 Claude 的软件工程能力(代码生成、编辑、审查和文件操作)。

精选
本地
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

用于任务管理的模型上下文协议服务器。它允许 Claude Desktop(或任何 MCP 客户端)在基于队列的系统中管理和执行任务。

精选
本地
JavaScript
mermaid-mcp-server

mermaid-mcp-server

一个模型上下文协议 (MCP) 服务器,用于将 Mermaid 图表转换为 PNG 图像。

精选
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP 服务器向 AI 编码助手(如 Cursor)提供 Jira 工单信息。

精选
TypeScript
Linear MCP Server

Linear MCP Server

一个模型上下文协议(Model Context Protocol)服务器,它与 Linear 的问题跟踪系统集成,允许大型语言模型(LLM)通过自然语言交互来创建、更新、搜索和评论 Linear 问题。

精选
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

这个服务器通过将复杂问题分解为顺序步骤来促进结构化的问题解决,支持修订,并通过完整的 MCP 集成来实现多条解决方案路径。

精选
Python
Curri MCP Server

Curri MCP Server

通过管理文本笔记、提供笔记创建工具以及使用结构化提示生成摘要,从而实现与 Curri API 的交互。

官方
本地
JavaScript