What is mcp_use?

mcp_use is an open source library that enables developers to connect any Language Learning Model (LLM) to any MCP server, allowing the creation of custom agents with tool access without relying on closed-source or application-specific clients.

Key Features

Getting Started

Streaming Agent Output

MCP-Use supports asynchronous streaming of agent output using the astream method. This allows you to receive incremental results, tool actions, and intermediate steps as they are generated by the agent.

How to use

Call agent.astream(query) and iterate over the results asynchronously:

async for chunk in agent.astream("your query here"):
    print(chunk["messages"], end="", flush=True)

Each chunk is a dictionary containing keys such as actions, steps, messages, and (on the last chunk) output. This enables real-time feedback and progress reporting in your applications.

See the README for more details and usage patterns.