使用说明
mcp-client
A simple Python MCP client that uses the MCP protocol, manages SSE/HTTP connections, handles mcp-session-id sessions, and sends JSON-RPC requests.
🚀 Usage
To use the MCP client in your own projects:
- Copy the folder
mcp_clientinto your project. - Install the required packages listed in
requirements.txt:pip install -r requirements.txt - Initialize the MCPClient with the url of your remote MCP server :
from mcp_client import MCPClient client = MCPClient(url="mon_serveur_mcp:8000/mcp") await client.connect()
🔧 Available Methods
- List available tools from the MCP server :
tools = await client.list_tools() - Call a remote tool :
parameters = {"param_name": param_value} tools = await client.call_tool() - 🛑 Closing the connection
await client.close()
📌 Notes
-
This client is designed to be lightweight and easily embeddable in your Python projects.
-
It follows the MCP protocol for communication and tool invocation.
