mirror of
https://github.com/mcp-use/mcp-use.git
synced 2026-09-14 18:06:01 +08:00
8348c59a53
* docs: reorganize navigation and clean up content - Remove 'Misc' group with misplaced blog posts - Remove 'Libraries' redirect group from Home nav - Simplify 'Dev Tools' group (flatten Inspector, CLI, Tunneling) - Remove individual changelog versions from Python nav (keep summary) - Remove changelog from TypeScript 'Get Started' group - Remove tunneling duplicate from Python Development group - Rewrite mcp101 as clean MCP concepts page (was pitch deck) - Delete typescript/blog posts (not technical docs) - Add redirects for deleted blog post URLs * docs: fix content accuracy and remove sloppy language - Fix broken python/server/mcp-apps link in home page - Remove informal pitch-speak from python/server/index.mdx - Fix grammar error in typescript/server/index.mdx - Update typescript/client/logging.mdx: remove fake 'coming soon' API code - Fix non-existent model name gpt-5.1 in typescript quickstart - Fix mcp_use naming in development contributing guide * docs: fix incorrect TypeScript server API calls in inspector docs - Replace server.addTool() with server.tool() (correct mcp-use API) - Add missing zod import to debugging-chatgpt-apps example * docs: fix fake model names (gpt-5.1 → gpt-4o) in agent docs * docs: update model names, fix APIs, and add agent visibility hints - Replace all deprecated model names with latest: gpt-4.1, gpt-4.1-mini, claude-sonnet-4-6, claude-opus-4-7, gemini-2.5-flash across all docs - Fix TypeScript server.tool() API in installation.mdx (old positional string form) - Fix TypeScript agent.run() in quickstart.mdx (deprecated string form → object) - Remove broken manufact.com/docs/llms.txt hidden hints from 5 pages - Add <Visibility for="agents"> block to mcp101.mdx with install commands, key classes, and API signatures for agent-oriented navigation - Add LangChain provider install note to Python quickstart (mcp-use agent requires a separate langchain-* provider package) - Update model name cards in Python llm-integration.mdx * docs: clean up remaining stale model names and improve accuracy - Update supported model lists in Python and TypeScript llm-integration pages - Fix cost optimization table to use current model IDs - Update TypeScript agent overview supported providers list * docs: add LangChain provider install to TypeScript quickstart agent section The MCPAgent requires a separate @langchain/* provider package; this was not mentioned before the code example that imports from @langchain/openai. * docs: update to latest flagship model IDs (May 2026) - OpenAI: gpt-4.1 → gpt-5.5, gpt-4.1-mini → gpt-5.5-mini - Google: gemini-2.5-flash → gemini-3.1-flash, gemini-2.5-pro → gemini-3.1-pro - Groq: llama-3.1-* → llama-4-scout-17b-16e-instruct - Anthropic (claude-opus-4-7, claude-sonnet-4-6) already current, no change * docs: replace all em dashes with hyphens * docs: restore llms.txt hints using Visibility component * docs: simplify TypeScript logging page to unsupported notice only * docs: rewrite mcp101 to explain MCP protocol with mcp-use examples and doc links * docs: remove goal.md * docs: revert nav changes, keep only Misc group removal and blog redirects * docs: reorder mcp101 to Server/App -> Client/Inspector -> Agent, restore title * docs: add code examples for Resources and Prompts in mcp101 * docs: remove em dashes from mcp101 * docs: add MCPClient code examples to mcp101 * docs: add React client example to mcp101 * docs: add agent code examples to mcp101 * docs: expand MCP Apps section in mcp101 with example and links * docs: restore Contacts, Socials, and Founders sections to mcp101 * docs: add context-setting intro paragraph to mcp101 for new readers * docs: add MCP stores section to mcp101 intro with Claude, ChatGPT, Cursor * docs: fix Claude store link * docs: fix ChatGPT store link * docs: fix Cursor store link * docs: replace store Cards with linked image grid * docs: add captions to store images * docs: add Notifications to client primitives table in mcp101 * docs: add lead-in paragraph before resource cards at bottom of mcp101 * docs: move resource cards to end of page after Contacts/Socials/Founders * docs: demote Contacts/Socials/Founders to bold text to remove from TOC * docs: move Contacts/Socials/Founders to very end of mcp101 * docs: add Resources and Contacts section headers, link official MCP docs * chore(docs): update site metadata, footer links, and rename mcp_use to mcp-use * update docs metadata + images * docs: enhance MCP section by highlighting the reach of MCP stores with 1 billion weekly active users * api ref
235 lines
6.3 KiB
Plaintext
235 lines
6.3 KiB
Plaintext
---
|
|
title: "Quickstart"
|
|
description: "Get started with mcp-use in minutes"
|
|
icon: "rocket"
|
|
---
|
|
|
|
<Visibility for="agents">
|
|
For the complete documentation index, see [llms.txt](https://mcp-use.com/docs/llms.txt).
|
|
</Visibility>
|
|
|
|
**mcp-use** is a unified MCP framework to build **MCP servers**, **MCP clients** and **MCP Agents**.
|
|
|
|
```mermaid
|
|
%%{init: {'theme':'neutral'}}%%
|
|
graph LR
|
|
Agent[MCP Agent] -->|uses| Client[MCP Client]
|
|
Client -->|connects to| Server[MCP Server]
|
|
Server -->|provides tools| Client
|
|
```
|
|
|
|
| Section | Description | |
|
|
|---------|-------------|---------|
|
|
| [Agent](#mcp-agent) | An AI Agent with tool calling capabilities through MCP connections | [Examples](https://github.com/mcp-use/mcp-use/tree/main/libraries/python/examples) |
|
|
| [Client](#mcp-client) | A full featured MCP Client implementation for Python with async support | [Examples](https://github.com/mcp-use/mcp-use/tree/main/libraries/python/examples) |
|
|
| [Server](#mcp-server) | The MCP Server framework implementation for Python | [Examples](https://github.com/mcp-use/mcp-use/tree/main/libraries/python/examples) |
|
|
|
|
|
|
## MCP Agent
|
|
|
|
**mcp-use** has a complete MCP Agent implementation for Python.
|
|
**MCP Agents** are AI-powered agents that can use tools from MCP servers to accomplish complex tasks. They reason across multiple steps, selecting and executing tools as needed.
|
|
Building such agents is easy with **mcp-use**, all you need is an LLM and the MCP Client.
|
|
|
|
<CodeGroup>
|
|
```bash pip
|
|
pip install mcp-use langchain-openai
|
|
```
|
|
```bash uv
|
|
uv add mcp-use langchain-openai
|
|
```
|
|
```bash poetry
|
|
poetry add mcp-use langchain-openai
|
|
```
|
|
</CodeGroup>
|
|
|
|
<Note>
|
|
The agent requires a LangChain LLM provider package. The examples use `langchain-openai` - swap for `langchain-anthropic`, `langchain-google-genai`, or `langchain-groq` as needed.
|
|
</Note>
|
|
|
|
Here's a simple example to get you started for an agent with **browser tools** support.
|
|
|
|
```python
|
|
import asyncio
|
|
from langchain_openai import ChatOpenAI # use your preferred LLM provider
|
|
from mcp_use import MCPAgent, MCPClient
|
|
|
|
async def main():
|
|
# Create MCPClient from configuration object
|
|
client = MCPClient({
|
|
"mcpServers": {
|
|
"playwright": {
|
|
"command": "npx",
|
|
"args": ["@playwright/mcp@latest"],
|
|
"env": {
|
|
"DISPLAY": ":1"
|
|
}
|
|
}
|
|
}
|
|
})
|
|
|
|
# Create agent with the client
|
|
agent = MCPAgent(
|
|
llm=ChatOpenAI(model="gpt-5.5"), # use your preferred LLM provider
|
|
client=client,
|
|
max_steps=30
|
|
)
|
|
|
|
# Run the query
|
|
result = await agent.run(
|
|
"Find the best restaurant in San Francisco USING GOOGLE SEARCH"
|
|
)
|
|
print(f"\nResult: {result}")
|
|
|
|
# Clean up
|
|
await client.close_all_sessions()
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|
|
```
|
|
|
|
<Tip>
|
|
For multi-server setups, tool restrictions, and advanced configuration options, see the [Agent Configuration](/python/agent/agent-configuration) and [Client Configuration](/python/client/client-configuration) guides.
|
|
</Tip>
|
|
|
|
For a complete overview of the mcp-use MCP Agent, see the [MCP Agent](/python/agent/building-custom-agents) documentation.
|
|
|
|
|
|
### Available MCP Servers
|
|
|
|
mcp-use supports **any MCP server**. Check out the [Awesome MCP Servers](https://github.com/punkpeye/awesome-mcp-servers) list for available options.
|
|
Or deploy your own following the instruction [below](#mcp-server).
|
|
|
|
|
|
## MCP Client
|
|
|
|
**mcp-use** has a complete MCP Client implementation for Python with full async support.
|
|
It supports stdio and HTTP with SSE transports for connecting to any MCP server.
|
|
|
|
<CodeGroup>
|
|
```bash pip
|
|
pip install mcp-use
|
|
```
|
|
```bash uv
|
|
uv add mcp-use
|
|
```
|
|
```bash poetry
|
|
poetry add mcp-use
|
|
```
|
|
</CodeGroup>
|
|
|
|
Then create a new MCP Client:
|
|
|
|
```python
|
|
import asyncio
|
|
from mcp_use import MCPClient
|
|
|
|
async def main():
|
|
client = MCPClient({
|
|
"mcpServers": {
|
|
"everything": {
|
|
"command": "npx",
|
|
"args": ["-y", "@modelcontextprotocol/server-everything"]
|
|
}
|
|
}
|
|
})
|
|
|
|
# Initialize all configured sessions
|
|
await client.create_all_sessions()
|
|
|
|
# Get the session for a specific server
|
|
session = client.get_session("everything")
|
|
|
|
# List available tools
|
|
tools = await session.list_tools()
|
|
print(f"Available tools: {[t.name for t in tools]}")
|
|
|
|
# Call a specific tool with arguments
|
|
result = await session.call_tool("add", {"a": 1, "b": 2})
|
|
print(f"Result: {result}")
|
|
|
|
# Clean up
|
|
await client.close_all_sessions()
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|
|
```
|
|
|
|
To learn more about the MCP Client, see the [MCP Client](/python/client/connection-types) documentation.
|
|
|
|
## MCP Server
|
|
|
|
**mcp-use** has a complete MCP server framework implementation for Python.
|
|
It supports all official MCP features including tools, resources, prompts, and middleware.
|
|
|
|
<CodeGroup>
|
|
```bash pip
|
|
pip install mcp-use
|
|
```
|
|
```bash uv
|
|
uv add mcp-use
|
|
```
|
|
```bash poetry
|
|
poetry add mcp-use
|
|
```
|
|
</CodeGroup>
|
|
|
|
### Scaffold a new project
|
|
|
|
```bash
|
|
# Via uvx (from PyPI)
|
|
uvx --from mcp-use create-mcp-use my-server
|
|
|
|
# Or if mcp-use is installed locally
|
|
create-mcp-use my-server
|
|
|
|
# Start the server
|
|
cd my-server
|
|
python server.py
|
|
```
|
|
|
|
### Create an MCP server manually:
|
|
|
|
```python
|
|
from mcp_use import MCPServer
|
|
|
|
server = MCPServer(
|
|
name="my-server",
|
|
version="1.0.0",
|
|
instructions="A simple example server"
|
|
)
|
|
|
|
# Define a tool
|
|
@server.tool()
|
|
def get_weather(city: str) -> dict:
|
|
"""Get weather for a city"""
|
|
return {"temperature": 72, "condition": "sunny", "city": city}
|
|
|
|
# Start the server
|
|
if __name__ == "__main__":
|
|
server.run()
|
|
```
|
|
|
|
To learn more about the MCP Server, see the [MCP Server](/python/server) documentation.
|
|
|
|
---
|
|
|
|
|
|
## Next Steps
|
|
|
|
<CardGroup cols={3}>
|
|
<Card title="Agent Configuration" icon="cog" href="/python/agent/agent-configuration">
|
|
Configure your Agent and connected MCP servers
|
|
</Card>
|
|
<Card title="LLM Integration" icon="brain" href="/python/agent/llm-integration">
|
|
Explore supported LLM providers and their setup
|
|
</Card>
|
|
<Card title="Examples" icon="code" href="https://github.com/mcp-use/mcp-use/tree/main/libraries/python/examples">
|
|
Browse real-world examples and use cases
|
|
</Card>
|
|
</CardGroup>
|
|
|
|
<Tip>
|
|
**Need Help?** Join our [Discord](https://discord.gg/XkNkSkMz3V) or [Github](https://github.com/mcp-use/mcp-use) communities.
|
|
</Tip>
|