
nituparimi/mcp
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
model context protocol
개요
Open Source MCP CLient Library PyPI Downloads PyPI Version Python Versions Documentation License Code style: Ruff GitHub stars 🌐 MCP-Use is the open source way to connect any LLM to MCP tools and build custom agents that have tool access, without using closed source or application clients. 💡 Let developers easily connect any LLM to tools like web browsing, file operations, and more. Features ✨ Key Features Feature Description 🔄 Ease of use Create your first MCP capable agent you need only 6 lines of code 🤖 LLM Flexibility Works with any langchain supported LLM that supports tool calling (OpenAI, Anthropic, Groq, LLama etc.) 🌐 HTTP Support Direct connection to MCP servers running on specific HTTP ports 🧩 Multi-Server Support Use multiple MCP servers simultaneously in a single agent 🛡️ Tool Restrictions Restrict potentially dangerous tools like file system or network access Quick start With pip: pip install mcp-use Or install from source: git clone https://github.
README
원문 README의 일부입니다. 원문 보기.
mcp
model context protocol
Open Source MCP CLient Library PyPI Downloads PyPI Version Python Versions Documentation License Code style: Ruff GitHub stars
🌐 MCP-Use is the open source way to connect any LLM to MCP tools and build custom agents that have tool access, without using closed source or application clients.
💡 Let developers easily connect any LLM to tools like web browsing, file operations, and more.
Features ✨ Key Features Feature Description 🔄 Ease of use Create your first MCP capable agent you need only 6 lines of code 🤖 LLM Flexibility Works with any langchain supported LLM that supports tool calling (OpenAI, Anthropic, Groq, LLama etc.) 🌐 HTTP Support Direct connection to MCP servers running on specific HTTP ports 🧩 Multi-Server Support Use multiple MCP servers simultaneously in a single agent 🛡️ Tool Restrictions Restrict potentially dangerous tools like file system or network access Quick start With pip:
pip install mcp-use Or install from source:
git clone https://github.com/pietrozullo/mcp-use.git cd mcp-use pip install -e . Installing LangChain Providers mcp_use works with various LLM providers through LangChain. You’ll need to install the appropriate LangChain provider package for your chosen LLM. For example:
For OpenAI
pip install langchain-openai
For Anthropic
pip install langchain-anthropic
For other providers, check the LangChain chat models documentation
and add your API keys for the provider you want to use to your .env file.
OPENAI_API_KEY= ANTHROPIC_API_KEY= Important: Only models with tool calling capabilities can be used with mcp_use. Make sure your chosen model supports function calling or tool use.
Spin up your agent: import asyncio import os from dotenv import load_dotenv from langchain_openai import ChatOpenAI from mcp_use import MCPAgent, MCPClient
async def main(): # Load environment variables load_dotenv()
# Create configuration dictionary
config = {
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"],
"env": {
"DISPLAY": ":1"
}
}
}
}
# Create MCPClient from configuration dictionary
client = MCPClient.from_dict(config)
# Create LLM
llm = ChatOpenAI(model="gpt-4o")
# Create agent with the client
agent = MCPAgent(llm=llm, client=client, max_steps=30)
# Run the query
result = await agent.run(
"Find the best restaurant in San Francisco",
)
print(f"\nResult: {result}")
if name == “main”: asyncio.run(main()) You can also add the servers configuration from a config file like this:
client = MCPClient.from_config_file( os.path.join(“browser_mcp.json”) ) Example configuration file (browser_mcp.json):
{ “mcpServers”: { “playwright”: { “command”: “npx”, “args”: [“@playwright/mcp@latest”], “env”: {
설치
npx @playwright/mcp@latest