Open Source MCP CLient Library
@bittush8789
Overview
What is Open Source MCP CLient Library?
Open Source MCP CLient Library (mcp-use) is an open source Python library that connects any LangChain-supported LLM to MCP tools, enabling developers to build custom agents with tool access without using closed source or application clients.
How to use Open Source MCP CLient Library?
Install via pip install mcp-use and optionally a LangChain provider package (e.g., langchain-openai). Configure an MCP server using a dictionary or JSON file, create an MCPClient and a LangChain LLM that supports tool calling, then create an MCPAgent and invoke await agent.run() with a query.
Key features of Open Source MCP CLient Library
- Ease of use: create a first MCP agent with only 6 lines of code
- LLM flexibility: works with any LangChain LLM supporting tool calling (OpenAI, Anthropic, Groq, etc.)
- HTTP support: direct connection to MCP servers running on 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 to search and scrape the web
- Searching Airbnb for accommodations using an MCP server
- Creating 3D models in Blender via the Blender MCP server
- Combining tools from multiple MCP servers (e.g., browsing + file operations)
- Connecting to web-based MCP servers over HTTP for remote tool access
FAQ from Open Source MCP CLient Library
What LLMs are supported?
Any LangChain-supported LLM that has tool calling capabilities, such as OpenAI, Anthropic, Groq, and Llama models.
How do I install the library?
Run pip install mcp-use and install the appropriate LangChain provider package (e.g., langchain-openai) for your chosen LLM.
How do I connect to MCP servers?
You can connect via stdio by specifying a command and arguments in the config, or via HTTP by providing a URL (e.g., http://localhost:8931/sse).
Can I restrict which tools the agent can use?
Yes, pass disallowed_tools to MCPAgent to block categories like file_system or network.
Can I use multiple MCP servers at the same time?
Yes, define multiple servers under mcpServers in your configuration and pass it to MCPClient.from_dict() or from_config_file().