Skip to content

mcp-use/mcp-use

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Full-Stack MCP Framework

mcp-use provides everything you need to build with Model Context Protocol
MCP servers, MCP clients and AI agents in 6 lines of code, in both Python and TypeScript.


Badge
Badge


Stack

  • πŸ€– MCP Agents - AI agents that can use tools and reason across steps
  • πŸ”Œ MCP Clients - Connect any LLM to any MCP server
  • πŸ› οΈ MCP Servers - Build your own MCP servers
  • πŸ” MCP Inspector - Web-based debugger for MCP servers
  • 🎨 MCP-UI Resources - Build ChatGPT apps with interactive widgets

πŸš€ What Do You Want to Build?

πŸ€– Build an AI Agent

Create intelligent agents that can use tools, browse the web, manage files, and more.

Quick Start ↓ | Python Docs | TypeScript Docs

πŸ”Œ Use MCP Client

Connect directly to MCP servers and call tools programmatically without an agent.

Quick Start ↓ | Python Docs | TypeScript Docs

πŸ› οΈ Create an MCP Server

Build your own MCP servers with tools, resources, and prompts.

Quick Start ↓ | TypeScript Docs

πŸ” Debug with Inspector

Test, debug, and explore your MCP servers interactively.

Quick Start ↓ | Inspector Docs | MCP Inspector online

🎨 Build ChatGPT Apps

Create interactive UIs with mcp-ui, react and live reload.

Quick Start | Templates

☁️ Deploy to MCP Cloud

Deploy and manage your MCP agents and servers in the cloud.

Quick Start | Cloud β†—


πŸ“¦ Quick Start

Build an AI Agent

Create an AI agent that can use MCP tools to accomplish complex tasks.

Python

pip install mcp-use langchain-openai
import asyncio
from langchain_openai import ChatOpenAI
from mcp_use import MCPAgent, MCPClient

async def main():
    # Configure MCP server
    config = {
        "mcpServers": {
            "filesystem": {
                "command": "npx",
                "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
            }
        }
    }

    client = MCPClient.from_dict(config)
    llm = ChatOpenAI(model="gpt-4o")
    agent = MCPAgent(llm=llm, client=client)

    result = await agent.run("List all files in the directory")
    print(result)

asyncio.run(main())

β†’ Full Python Agent Documentation

Typescript

npm install mcp-use @langchain/openai
import { ChatOpenAI } from "@langchain/openai";
import { MCPAgent, MCPClient } from "mcp-use";

async function main() {
  // Configure MCP server
  const config = {
    mcpServers: {
      filesystem: {
        command: "npx",
        args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
      },
    },
  };

  const client = MCPClient.fromDict(config);
  const llm = new ChatOpenAI({ modelName: "gpt-4o" });
  const agent = new MCPAgent({ llm, client });

  const result = await agent.run("List all files in the directory");
  console.log(result);
}

main();

β†’ Full TypeScript Agent Documentation


Use MCP Client

Connect to MCP servers directly without an AI agent for programmatic tool access.

Python

import asyncio
from mcp_use import MCPClient

async def main():
    config = {
        "mcpServers": {
            "calculator": {
                "command": "npx",
                "args": ["-y", "@modelcontextprotocol/server-everything"]
            }
        }
    }

    client = MCPClient.from_dict(config)
    await client.create_all_sessions()

    session = client.get_session("calculator")
    result = await session.call_tool(name="add", arguments={"a": 5, "b": 3})

    print(f"Result: {result.content[0].text}")
    await client.close_all_sessions()

asyncio.run(main())

β†’ Python Client Documentation

Typescript

import { MCPClient } from "mcp-use";

async function main() {
  const config = {
    mcpServers: {
      calculator: {
        command: "npx",
        args: ["-y", "@modelcontextprotocol/server-everything"],
      },
    },
  };

  const client = new MCPClient(config);
  await client.createAllSessions();

  const session = client.getSession("calculator");
  const result = await session.callTool("add", { a: 5, b: 3 });

  console.log(`Result: ${result.content[0].text}`);
  await client.closeAllSessions();
}

main();

β†’ TypeScript Client Documentation


Create an MCP Server

Build your own MCP server with custom tools, resources, and prompts.

Typescript

npx create-mcp-use-app my-server
cd my-server
npm install
import { createMCPServer } from "mcp-use/server";
import { z } from "zod";

const server = createMCPServer("my-server", {
  version: "1.0.0",
  description: "My custom MCP server",
});

// Define a tool
server.tool("get_weather", {
  description: "Get weather for a city",
  parameters: z.object({
    city: z.string().describe("City name"),
  }),
  execute: async ({ city }) => {
    return { temperature: 72, condition: "sunny", city };
  },
});

// Start server with auto-inspector
server.listen(3000);
// πŸŽ‰ Inspector at http://localhost:3000/inspector

β†’ Full TypeScript Server Documentation

Python

Coming Soon! For now, please use the TypeScript implementation to create MCP servers.


Use the Inspector

Debug and test your MCP servers with the interactive web-based inspector.

Automatic (with mcp-use server)

When you create a server with mcp-use, the inspector is automatically available:

server.listen(3000);
// Inspector automatically at: http://localhost:3000/inspector

Standalone

Inspect any MCP server via CLI:

npx @mcp-use/inspector --url http://localhost:3000/sse

Features:

  • πŸ” Test tools interactively with live execution
  • πŸ“Š Monitor connection status and server health
  • πŸ” Handle OAuth flows automatically
  • πŸ’Ύ Persistent sessions with localStorage

β†’ Full Inspector Documentation


πŸ“š More Examples & Documentation

Example Use Cases

Complete Documentation


✨ Key Features

Feature Description Python TypeScript
πŸ€– MCP Agents AI agents with tool access and multi-step reasoning βœ… βœ…
πŸ”Œ MCP Clients Direct connection to any MCP server βœ… βœ…
πŸ› οΈ MCP Servers Build custom MCP servers πŸ”œ βœ…
πŸ” Inspector Web-based debugging tool βœ… βœ…
🎨 UI Widgets Build interactive React UIs βž– βœ…
🌐 Multi-Server Connect to multiple servers simultaneously βœ… βœ…
πŸ“‘ Streaming Real-time streaming responses βœ… βœ…
πŸ“Š Observability Built-in Langfuse integration βœ… βœ…
πŸ” OAuth Support Built-in OAuth flow handling βœ… βœ…
πŸ›‘οΈ Tool Control Restrict access to specific tools βœ… βœ…

πŸ“¦ Package Overview

This monorepo contains multiple packages for both Python and TypeScript:

Python Packages

Package Description Version
mcp-use Complete MCP client and agent library PyPI

TypeScript Packages

Package Description Version
mcp-use Core framework for clients, agents, and servers npm
@mcp-use/cli Build tool with hot reload and auto-inspector npm
@mcp-use/inspector Web-based debugger for MCP servers npm
create-mcp-use-app Project scaffolding tool npm

πŸ—οΈ Repository Structure

mcp-use/
β”œβ”€β”€ libraries/
β”‚   β”œβ”€β”€ python/              β†’ Python implementation
β”‚   β”‚   β”œβ”€β”€ mcp_use/         β†’ Core library
β”‚   β”‚   β”œβ”€β”€ examples/        β†’ Python examples
β”‚   β”‚   └── docs/            β†’ Python documentation
β”‚   β”‚
β”‚   └── typescript/          β†’ TypeScript implementation
β”‚       └── packages/
β”‚           β”œβ”€β”€ mcp-use/     β†’ Core framework
β”‚           β”œβ”€β”€ cli/         β†’ Build tool
β”‚           β”œβ”€β”€ inspector/   β†’ Web inspector
β”‚           └── create-mcp-use-app/  β†’ Scaffolding
└── README.md               β†’ This file

🌟 Why MCP-Use?

Complete Vertical Stack

Build everything from AI agents to servers - not just clients. Create the full MCP ecosystem in your preferred language.

Language Flexibility

Choose Python for ML/data workflows or TypeScript for web applications. Same great features, different languages.

Production Ready

Includes observability, streaming, multi-server support, sandboxing, and tool access controls out of the box.

Developer Experience

Hot reload, TypeScript/Python type safety, built-in inspector, and comprehensive documentation.

Open Source

MIT licensed and community-driven. Contribute, fork, or extend as needed.


🀝 Community & Support


πŸ“œ License

MIT Β© MCP-Use Contributors


πŸ™ Contributing

We love contributions! Check out our contributing guidelines:


⭐ Star History

Star History Chart


πŸ“ Citation

If you use MCP-Use in your research or project, please cite:

@software{mcp_use2025,
  author = {Zullo, Pietro and Contributors},
  title = {MCP-Use: Complete MCP Ecosystem for Python and TypeScript},
  year = {2025},
  publisher = {GitHub},
  url = {https://github.com/mcp-use/mcp-use}
}

Contributors

Thanks to all our amazing contributors!

Core Contributors

  1. Pietro (@pietrozullo)
  2. Luigi (@pederzh)
  3. Enrico (@tonxxd)


Built with ❀️ by the MCP-Use community
San Francisco | ZΓΌrich