返回顶部
m

mcp-clientMCP客户端

Model Context Protocol (MCP) client - connect to tools, data sources and services

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.3
安全检测
已通过
1,665
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

mcp-client

MCP 客户端技能

用于连接工具和数据源的模型上下文协议(MCP)客户端实现。

功能

  • - 连接 MCP 服务器 - 访问支持 MCP 的服务中的工具和资源
  • 工具调用 - 调用 MCP 服务器暴露的工具
  • 资源访问 - 读取文件、数据库、API
  • 提示模板 - 使用 MCP 服务器提供的结构化提示

安装

powershell

安装 Python 依赖(requests 是唯一必需的依赖)


pip install requests

使用方法

连接 MCP 服务器

powershell
.\mcp.ps1 -Action connect -ServerUrl https://mcp-server.com -ApiKey your-key

列出可用工具

powershell
.\mcp.ps1 -Action tools -ServerUrl https://mcp-server.com

调用工具

powershell
.\mcp.ps1 -Action call -ServerUrl https://mcp-server.com -ToolName search -Arguments {query: AI agents}

列出资源

powershell
.\mcp.ps1 -Action resources -ServerUrl https://mcp-server.com

读取资源

powershell
.\mcp.ps1 -Action read -ServerUrl https://mcp-server.com -ResourceUri file:///data/config.json

MCP 概念

  • - MCP 服务器:暴露工具、资源和提示的服务
  • 工具:LLM/代理可以调用的函数
  • 资源:数据源(文件、API、数据库)
  • 提示:预定义的提示模板

API 参考

POST /mcp/connect - 连接服务器
GET /mcp/tools - 列出可用工具
POST /mcp/call - 调用工具
GET /mcp/resources - 列出资源
GET /mcp/read - 读取资源
GET /mcp/prompts - 列出提示模板

示例

Python 用法

python
from mcp_client import MCPClient

client = MCPClient(https://mcp-server.com, api_key=key)

列出工具

tools = client.list_tools() print(tools)

调用工具

result = client.call_tool(search, {query: quantum}) print(result)

读取资源

data = client.read_resource(file:///config.json) print(data)

⚠️ 安全警告

file:// URI 风险

MCP 协议允许使用 file:///path URI 从服务器读取文件。请仅连接受信任的 MCP 服务器。 恶意服务器可能窃取敏感文件。

最佳实践

  • - 仅使用您控制或信任的 MCP 服务器
  • 不要连接随机的公共 MCP 服务器
  • 使用前请检查可用的工具/资源

要求

  • - 使用前请检查可用的工具/资源
  • - Python 3.8+
  • requests 库

许可证

MIT

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 mcp-client-1776420079 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 mcp-client-1776420079 技能

通过命令行安装

skillhub install mcp-client-1776420079

下载

⬇ 下载 mcp-client v1.0.3(免费)

文件大小: 3.28 KB | 发布时间: 2026-4-17 20:01

v1.0.3 最新 2026-4-17 20:01
Force rescan - verified working

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部