
轻松将现有代理框架中的工具、代理和编排器转换为MCP服务器
概览
AutoMCP 允许您轻松将现有代理框架中的工具、代理和编排器转换为 MCP 服务器,然后通过 Cursor 和 Claude Desktop 等客户端通过标准化接口访问。 我们目前支持以下代理框架的代理、工具和编排器作为MCP服务器的部署: 1. CrewAI 2.LangGraph 3.Llama 索引 4.OpenAI 代理 SDK 5.Pydantic AI 6.MCP-agent 为您的项目创建一个新的MCP服务器: 访问您的项目目录,并查看您的代理实施: 通过CLI生成MCP服务器文件,并带有以下之一的标志(crewai、langgraph、llamaindex、openai、pydantic、mcp_agent): 编辑生成的run_mcp.py文件以配置你的代理: 安装依赖并运行你的MCP服务器:
概述(AI 翻译)
🚀 概述
AutoMCP 允许您轻松将现有代理框架中的工具、代理和编排器转换为 MCP 服务器,然后通过 Cursor 和 Claude Desktop 等客户端通过标准化接口访问。
我们目前支持以下代理框架的代理、工具和编排器作为MCP服务器的部署:
- 船员AI(船员AI)
- LangGraph
- 羊驼指数
- OpenAI 代理 SDK
- 意念人工智能
- MCP-代理
🔧 安装
从 PyPI 安装:
或者从源代码安装:
🧩 快速启动
为您的项目创建一个新的MCP服务器:
访问您的项目目录,并查看您的代理实施:
通过CLI生成MCP服务器文件,并带有以下之一的标志(crewai、langgraph、llamaindex、openai、pydantic、mcp_agent):
编辑生成的run_mcp.py文件以配置您的代理:
安装依赖并运行你的MCP服务器:
📁 生成文件
当你运行automcp init -f 时,会生成以下文件:
run_mcp.py
这是建立并运行 MCP 服务器的主文件。它包含:
- 服务器初始化代码
- STDIO和SSE传输处理器
- 你的代理实现的占位符
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
automcp
🚀 Overview
automcp allows you to easily convert tools, agents and orchestrators from existing agent frameworks into MCP servers, that can then be accessed by standardized interfaces via clients like Cursor and Claude Desktop.
We currently support deployment of agents, tools, and orchestrators as MCP servers for the following agent frameworks:
- CrewAI
- LangGraph
- Llama Index
- OpenAI Agents SDK
- Pydantic AI
- mcp-agent
🔧 Installation
Install from PyPI:
# Basic installation
pip install naptha-automcp
# UV
uv add naptha-automcp
Or install from source:
git clone https://github.com/napthaai/automcp.git
cd automcp
uv venv
source .venv/bin/activate
pip install -e .
🧩 Quick Start
Create a new MCP server for your project:
Navigate to your project directory with your agent implementation:
cd your-project-directory
Generate the MCP server files via CLI with one of the following flags (crewai, langgraph, llamaindex, openai, pydantic, mcp_agent):
automcp init -f crewai
Edit the generated run_mcp.py file to configure your agent:
# Replace these imports with your actual agent classes
from your_module import YourCrewClass
# Define the input schema
class InputSchema(BaseModel):
parameter1: str
parameter2: str
# Set your agent details
name = ""
description = ""
# For CrewAI projects
mcp_crewai = create_crewai_adapter(
orchestrator_instance=YourCrewClass().crew(),
name=name,
description=description,
input_schema=InputSchema,
)
Install dependencies and run your MCP server:
automcp serve -t sse
📁 Generated Files
When you run automcp init -f , the following file is generated:
run_mcp.py
This is the main file that sets up and runs your MCP server. It contains:
- Server initialization code
- STDIO and SSE transport handlers
- A placeholder for your agent implementation
- Utilities to suppress warnings that might corrupt the STDIO protocol
You’ll need to edit this file to:
- Import your agent/crew classes
- Define your input schema (the parameters your agent accepts)
- Configure the adapter with your agent
🔍 Examples
Running the examples
The repository includes examples for each supported framework:
# Clone the repository
git clone https://github.com/NapthaAI/automcp.git
cd automcp
# Install automcp in development mode
pip install -e .
# Navigate to an example directory
cd examples/crewai/marketing_agents
# Generate the MCP server files (use the appropriate framework)
automcp init -f crewai
# Edit the generated run_mcp.py file to import and configure the example agent
# (See the specific example's README for details)
# Add a .env file with necessary environmental variables
# Install dependencies and run
automcp serve -t sse
安装
uvx --from git+https://github.com/your-username/your-repo serve_stdio配置
{
"mcpServers": {
"crew-name-stdio": {
"type": "stdio",
"command": "/absolute/path/to/your/.venv/bin/uv",
"args": [
"--directory",
"/absolute/path/to/your/project_dir",
"run",
"serve_stdio"
],
"env": {
"OPENAI_API_KEY": "sk-",
"SERPER_API_KEY": ""
}
},
"crew-name-python": {
"type": "stdio",
"command": "/absolute/path/to/your/.venv/bin/python",
"args": [
"/absolute/path/to/your/project_dir/run_mcp.py"
],
"env": {
"OPENAI_API_KEY": "sk-",
"SERPER_API_KEY": ""
}
},
"crew-name-automcp": {
"type": "stdio",
"command": "/absolute/path/to/your/.venv/bin/automcp",
"args": [
"serve",
"-t",
"stdio"
],
"cwd": "/absolute/path/to/your/project_dir",
"env": {
"OPENAI_API_KEY": "sk-",
"SERPER_API_KEY": ""
}
},
"crew-name-sse": {
"type": "sse",
"url": "http://localhost:8000/sse"
}
}
}