← 返回
开发者工具 中文

Mcp Client

Model Context Protocol (MCP) client - connect to tools, data sources and services
模型上下文协议(MCP)客户端 - 连接工具、数据源和服务
nantes
开发者工具 clawhub v1.0.3 1 版本 99787.8 Key: 无需
★ 1
Stars
📥 2,802
下载
💾 27
安装
1
版本
#agent#integration#latest#mcp

概述

MCP Client Skill

Implementation of the Model Context Protocol (MCP) client for connecting to tools and data sources.

What it does

  • Connect to MCP Servers - Access tools and resources from MCP-enabled services
  • Tool Invocation - Call tools exposed by MCP servers
  • Resource Access - Read files, databases, APIs
  • Prompt Templates - Use structured prompts from MCP servers

Installation

# Install Python dependencies (requests is the only required dependency)
pip install requests

Usage

Connect to MCP Server

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

List Available Tools

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

Call a Tool

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

List Resources

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

Read a Resource

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

MCP Concepts

  • MCP Server: Service that exposes tools, resources, and prompts
  • Tools: Functions the LLM/agent can call
  • Resources: Data sources (files, APIs, DBs)
  • Prompts: Pre-defined prompt templates

API Reference

POST /mcp/connect     - Connect to server
GET  /mcp/tools       - List available tools
POST /mcp/call       - Invoke a tool
GET  /mcp/resources  - List resources
GET  /mcp/read       - Read resource
GET  /mcp/prompts    - List prompt templates

Examples

Python Usage

from mcp_client import MCPClient

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

# List tools
tools = client.list_tools()
print(tools)

# Call tool
result = client.call_tool("search", {"query": "quantum"})
print(result)

# Read resource
data = client.read_resource("file:///config.json")
print(data)

⚠️ Security Warnings

file:// URI Risk

The MCP protocol allows file:///path URIs to read files from the server. Only connect to trusted MCP servers. A malicious server could exfiltrate sensitive files.

Best Practices

  • Only use MCP servers you control or trust
  • Don't connect to random public MCP servers
  • Review what tools/resources are available before using

Requirements

  • Review what tools/resources are available before using
  • Python 3.8+
  • requests library

License

MIT

版本历史

共 1 个版本

  • v1.0.3 当前
    2026-03-29 04:25 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 65 📥 179,842
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 666 📥 323,791
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 920 📥 185,727