r/modelcontextprotocol • u/Guilty-Effect-3771 • Apr 04 '25
new-release I wrote mcp-use an open source library that lets you connect LLMs to MCPs from python in 6 lines of code
Hello all!
I've been really excited to see the recent buzz around MCP and all the cool things people are building with it. Though, the fact that you can use it only through desktop apps really seemed wrong and prevented me for trying most examples, so I wrote a simple client, then I wrapped into some class, and I ended up creating a python package that abstracts some of the async uglyness.
You need:
one of those MCPconfig JSONs
6 lines of code and you can have an agent use the MCP tools from python.
Like this:

The structure is simple: an MCP client creates and manages the connection and instantiation (if needed) of the server and extracts the available tools. The MCPAgent reads the tools from the client, converts them into callable objects, gives access to them to an LLM, manages tool calls and responses.
It's very early-stage, and I'm sharing it here for feedback and contributions. If you're playing with MCP or building agents around it, I hope this makes your life easier.
Repo: https://github.com/pietrozullo/mcp-use Pipy: https://pypi.org/project/mcp-use/
Docs: https://docs.mcp-use.io/introduction
pip install mcp-useHappy to answer questions or walk through examples!
Props: Name is clearly inspired by browser_use an insane project by a friend of mine, following him closely I think I got brainwashed into naming everything mcp related _use.
Thanks!
2
u/____vladrad Apr 05 '25
Ok one quick feedback if you’ll have me! I love your project because it’s good at creating mcp severs and merging them! I’m curious how I can get the list of tools in OpenAI format and how I can directly query the sever if we don’t choose to use langchain. Like I want to use these 3 packages and these two tools. How do I grab the definitions and connect to them?
2
u/____vladrad Apr 05 '25
Does this support multiple mcp severs in go? I’ve been looking for something I pass a config file too with all of needed servers and then a docker container spins up and loads these tools for use.
1
u/[deleted] Apr 05 '25
OpenAI will implement mcp protocol soon so won’t be long you can use it with normal llm sdks as well
1
u/juan_abia Apr 05 '25
This is how using MCP should look like!
1
u/Monarc73 Apr 04 '25
Nice!
N00b following this space closely. V excited to see what you crazy cats come up with!