Open Source MCP Client Library logo

Open Source MCP Client Library

by pietrozullo

MCP-Use is an open-source library that connects any LLM to any MCP server, enabling the creation of custom agents with tool access. It allows developers to easily integrate LLMs with tools like web browsing and file operations.

View on GitHub

Last updated: N/A

What is Open Source MCP Client Library?

MCP-Use is a Python library that facilitates the connection between Large Language Models (LLMs) and MCP (Meta-Control Protocol) servers. It allows developers to build custom agents capable of using various tools and services exposed through MCP, such as web browsing, file system access, and more, without relying on closed-source solutions.

How to use Open Source MCP Client Library?

To use MCP-Use, first install the library using pip (pip install mcp-use). Then, install the appropriate LangChain provider package for your chosen LLM (e.g., pip install langchain-openai). Configure your MCP servers either through a dictionary or a configuration file. Create an MCPClient instance, an LLM instance (e.g., ChatOpenAI), and finally, an MCPAgent instance, passing in the LLM and client. Use the agent.run() method to execute queries.

Key features of Open Source MCP Client Library

  • Ease of use: Create an MCP capable agent with only 6 lines of code

  • LLM Flexibility: Works with any LangChain supported LLM that supports tool calling

  • HTTP Support: Direct connection to MCP servers running on specific HTTP ports

  • Multi-Server Support: Use multiple MCP servers simultaneously in a single agent

  • Tool Restrictions: Restrict potentially dangerous tools like file system or network access

Use cases of Open Source MCP Client Library

  • Web Browsing with Playwright: Automate web interactions and data extraction using Playwright MCP.

  • Airbnb Search: Build agents that can search for accommodations on Airbnb.

  • Blender 3D Creation: Automate 3D modeling tasks using Blender MCP.

  • Connecting to MCP servers running on specific HTTP ports

FAQ from Open Source MCP Client Library

What is MCP?

MCP stands for Meta-Control Protocol. It's a protocol for controlling applications and services.

What LLMs are supported?

MCP-Use supports any LangChain supported LLM that has tool calling capabilities, such as OpenAI, Anthropic, Groq, and Llama.

How do I configure MCP servers?

You can configure MCP servers using a dictionary or a configuration file (JSON). The configuration includes the command to start the server and any necessary arguments or environment variables.

Can I use multiple MCP servers at once?

Yes, MCP-Use supports using multiple MCP servers simultaneously in a single agent.

How can I restrict tool access?

You can restrict tool access by providing a list of disallowed tools to the MCPAgent constructor.