mcp-use: The Developer Framework for Building AI Agents and MCP Servers

May 16, 2025

Introduction

Building AI agents that can actually interact with the real world often requires writing endless amounts of custom glue code for every single API and data source. For developers who want to move beyond simple chat interfaces, the challenge is creating a standardized way for Large Language Models (LLMs) to access tools and context without reinventing the wheel for every project. mcp-use is a developer-focused framework designed to solve this by implementing the Model Context Protocol (MCP), providing a streamlined path to build AI agents and MCP servers with a superior developer experience (DX).

What Is mcp-use?

mcp-use is a framework for the Model Context Protocol (MCP) that provides the best developer experience (DX) for building AI agents and MCP servers. It allows developers to create servers that expose tools, resources, and prompts to any MCP host, and build clients that can connect to any MCP server. Written primarily in Python, it simplifies the process of connecting LLMs to external data sources and tools, enabling the creation of dynamic agents that can retrieve current information and take action.

The project is hosted on GitHub and follows an open-source philosophy, allowing developers to integrate it with various LLM providers through LangChain, making it compatible with a wide range of modern AI models.

Why mcp-use Matters

Before the advent of MCP and frameworks like mcp-use, integrating an AI model with a specific tool—such as a database or a project management system—required a custom-built connector. If you wanted your agent to use ten different tools, you had to manage ten separate implementations, ten different authentication flows, and ten potential failure points. This fragmented approach created a massive bottleneck for AI agent development.

mcp-use matters because it implements a universal “language” for AI-tool interaction. By using this framework, developers no longer need to build the plumbing; they inherit it. This allows them to focus on the actual logic of the agent and the specific tools they want to expose, rather than the transport layer. It significantly reduces the time to market for agentic AI applications and reduces the risk of hallucinations by grounding the AI in real-time, structured data.

As the industry shifts toward “Agentic AI,” where models move from passive chat to active execution, mcp-use provides the necessary infrastructure to make these agents reliable and scalable.

Key Features

  • AI Agent Construction: Provides a high-level framework for building agents that can autonomously use tools and access resources via the MCP standard.
  • MCP Server Creation: Simplifies the process of creating servers that expose specific functionalities (tools) and resources (data) to AI hosts.
  • UI Widgets for Servers: Supports the creation of UI widgets, allowing MCP servers to provide a more interactive and visual experience for the end-user.
  • Built-in Inspector: Includes a debugging tool (inspector) that allows developers to test and verify the tools and resources exposed by their MCP servers in real-time.
  • LangChain Integration: Works seamlessly with various LLM providers through LangChain, allowing developers to switch between models like GPT-4, Claude 3.5, or Llama 3 without rewriting their MCP logic.
  • Standardized Transport: Supports standard MCP transports including stdio, Streamable HTTP, and SSE, ensuring compatibility with any MCP-compliant host.
  • Client SDK: Includes a client SDK that enables the creation of custom AI applications that can connect to any existing MCP server in the ecosystem.

How mcp-use Compares

When evaluating mcp-use, it is important to compare it against the official MCP Python SDK and other specialized MCP server implementations like GitMCP or the GitHub MCP server.

Feature mcp-use Official MCP SDK Specialized Servers (e.g., GitMCP)
Primary Focus Developer Experience (DX) & Agent Framework Protocol Specification & Core SDK Single-purpose Tooling
Ease of Setup High (Integrated Framework) Medium (Low-level API) High (Ready-to-use)
UI Components Yes (UI Widgets) No No
Debugging Tools Yes (Built-in Inspector) Partial No
Flexibility Very High Maximum Low (Specific to one tool)

While the official MCP SDK provides the raw building blocks for the protocol, mcp-use acts as a higher-level abstraction layer. It is designed for developers who want to build complex agents quickly without getting bogged down in the low-level details of the protocol specification. The primary differentiator is the focus on DX—providing tools like the inspector and UI widgets that make the development cycle faster and more intuitive.

In contrast, specialized servers like GitMCP are excellent for a specific task (e.g., turning a GitHub repo into a documentation hub), but they do not provide a framework for building your own custom agents or servers. mcp-use is the tool you use to build the tools.

Getting Started: Installation

mcp-use is available as a Python package. You can install it directly from PyPI or clone the repository for development purposes.

Installation via pip

pip install mcp-use

Installation from Source

If you wish to contribute or modify the framework, you can install it in editable mode from the GitHub repository:

git clone https://github.com/mcp-use/mcp-use.git
cd mcp-use
pip install -e .

Prerequisites

Python 3.10 or higher is required to run mcp-use. It is also recommended to use a virtual environment (such as venv or uv) to manage dependencies.

How to Use mcp-use

The basic workflow in mcp-use involves creating an MCP server that exposes a tool, and then connecting an MCP client (or an AI host like Claude Desktop) to that server.

First, you define a tool using a Python function. The framework handles the conversion of this function into an MCP-compliant tool definition that the LLM can understand. mcp-use simplifies this by using type hints and docstrings to automatically generate the tool’s schema.

Once the server is running, you can use the built-in inspector to verify that the tool is visible and executable. After verification, you can add the server configuration to your MCP host (e.g., in the config.json of Claude Desktop), allowing the AI to call the tool autonomously.

Code Examples

The following examples demonstrate how to use mcp-use to create a simple MCP server and a basic MCP client.

Example 1: Creating a Simple MCP Server

This example shows how to define a tool that the AI can use to fetch data from an external API.

from mcp_use import MCP_Server

server = MCP_Server("My Data Server", "1.0.0")

@server.tool()
async def get_weather(city: str) -> str:
    """Fetches the current weather for a given city."""
    # In a real scenario, you would call an external API
    return f"The weather in {city} is sunny and 25 degrees." 

if __name__ == "__main__":
    server.run()

Example 2: Building a Basic MCP Client

This example demonstrates how to build a custom client that connects to an MCP server and requests a tool execution.

from mcp_use import MCP_Client

async def main():
    async with MCP_Client("stdio") as client:
        # Connect to a server
        await client.connect("python server.py")
        
        # List available tools
        tools = await client.list_tools()
        print(f"Available tools: {tools}")
        
        # Call a tool
        result = await client.call_tool("get_weather", {"city": "New York"})
        print(f"Result: {result}")

import asyncio
asyncio.run(main())

Real-World Use Cases

mcp-use shines in scenarios where AI agents need to interact with proprietary data or specialized tools that do not have a standard AI integration.

  • Internal Company Knowledge Base: A developer can use mcp-use to create a server that queries an internal SQL database or a proprietary API, allowing an AI agent to answer questions about internal project status, ticket numbers, or company policies without the data ever leaving the secure environment.
  • Automated Engineering Workflows: An engineer can build a server that interacts with GitHub Actions or Jira, allowing an AI agent to triage tickets, summarize pull requests, and update ticket status based on on-chain data, effectively turning the AI into a project coordinator.
  • Custom Hardware Interaction: For developers working with IoT or specialized hardware, mcp-use allows them to create a tool that can trigger physical actions (e.g., “turn on the lab server」) or read sensor data, bridging the gap between LLMs and the physical world.

Contributing to mcp-use

The mcp-use project is open-source and welcomes contributions from the community. Because it is a framework for other developers, improving the DX (Developer Experience) is a primary goal.

To contribute, you can start by reporting bugs via GitHub Issues. If you want to submit a feature request or a new tool implementation, please open a PR. The project maintains a standard GitHub flow: fork the repository, create a feature branch, and submit a pull request to the main branch. Contributors are encouraged to ensure their code passes all tests and follows the Python type-hinting standards used in the project.

Community and Support

mcp-use is part of the broader Model Context Protocol ecosystem. Support and discussions typically happen on GitHub Discussions and the official MCP Contributors Discord server. Since the project is a framework, many of the laest developments in the MCP specification are integrated into mcp-use to ensure compatibility with the latest AI hosts.

Developers can find additional examples and community-built MCP servers in the official MCP servers repository on GitHub, which serves as a companion to the framework.

Conclusion

mcp-use is the right choice for developers who want to build AI agents that are grounded in real-world data and capable of active execution. By implementing the Model Context Protocol, it removes the plumbing of AI-tool integration and provides a high-level abstraction that makes building agents faster and more reliable.

While the official SDK is powerful, mcp-use’s focus on developer experience—through tools like the inspector and UI widgets—makes it a superior choice for those who prioritize rapid prototyping and iterative development. If you are building a custom AI assistant, an internal tool, or a complex agentic system, mcp-use is the essential infrastructure you need.

Star the repo, try the quickstart, and join the community to start building the next generation of agentic AI.

What is mcp-use and what problem does it solve?

mcp-use is a framework for the Model Context Protocol (MCP) that simplifies the creation of AI agents and MCP servers. It solves the problem of fragmented, custom glue code for every AI-tool integration by providing a standardized way for LLMs to interact with external data and tools.

How do I install mcp-use?

You can install mcp-use via pip using the command pip install mcp-use. Alternatively, you can install it from source by cloning the GitHub repository and running pip install -e .

How does mcp-use compare to the official MCP SDK?

While the official SDK provides the core protocol implementation, mcp-use is a higher-level framework focused on developer experience (DX). It includes additional tools like a built-in inspector for debugging and UI widgets for servers, which the official SDK lacks.

Can I use mcp-use for building internal company tools?

Yes, mcp-use is ideal for building internal tools. It allows you to create servers that expose secure, internal data to an AI agent without requiring the data to be exported to the LLM provider’s cloud, maintaining security and security.

Does mcp-use support multiple LLM providers?

mcp-use provides integration with various LLM providers through LangChain, meaning you can use it with models from OpenAI, Anthropic, and others as long as they are MCP-compliant.

What are MCP resources and tools in mcp-use?

In mcp-use, a tool is an executable function that the AI can call to perform an action, while a resource is a piece of data (like a file or a database record) that the AI can read to gain context.

Is mcp-use open source?

mcp-use use the MIT License, allowing developers to freely use, modify, and distribute the framework to build their own AI agents.