- Explore MCP Servers
- mcp-tool-crewai
Mcp Tool Crewai
What is Mcp Tool Crewai
mcp-tool-crewai is a repository that demonstrates how to integrate CrewAI agents with tools provided by MCP (Model Context Protocol) servers, such as GitHub MCP, Context7, and Sequential Thinking.
Use cases
Use cases include automating project planning and execution using CrewAI agents, integrating AI capabilities into GitHub workflows, and enhancing task management through the use of MCP tools.
How to use
To use mcp-tool-crewai, clone the repository, set up a virtual environment, install dependencies using the ‘uv’ package manager, and configure API tokens for GitHub and the language model. Then, utilize the MCPServerAdapter class to connect CrewAI to various MCP servers via STDIO.
Key features
Key features include the ability to connect CrewAI with different MCP servers, isolated testing for Context7 and GitHub MCP tools, and a combined script that leverages specialized agents for Sequential Thinking and GitHub MCP execution.
Where to use
mcp-tool-crewai can be used in fields such as software development, project management, and AI-driven automation, where integration of AI agents with various tools is beneficial.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Mcp Tool Crewai
mcp-tool-crewai is a repository that demonstrates how to integrate CrewAI agents with tools provided by MCP (Model Context Protocol) servers, such as GitHub MCP, Context7, and Sequential Thinking.
Use cases
Use cases include automating project planning and execution using CrewAI agents, integrating AI capabilities into GitHub workflows, and enhancing task management through the use of MCP tools.
How to use
To use mcp-tool-crewai, clone the repository, set up a virtual environment, install dependencies using the ‘uv’ package manager, and configure API tokens for GitHub and the language model. Then, utilize the MCPServerAdapter class to connect CrewAI to various MCP servers via STDIO.
Key features
Key features include the ability to connect CrewAI with different MCP servers, isolated testing for Context7 and GitHub MCP tools, and a combined script that leverages specialized agents for Sequential Thinking and GitHub MCP execution.
Where to use
mcp-tool-crewai can be used in fields such as software development, project management, and AI-driven automation, where integration of AI agents with various tools is beneficial.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
CrewAI + MCP (Model Context Protocol) Integration Examples
Este repositório demonstra como integrar agentes CrewAI com ferramentas disponibilizadas por servidores MCP (Model Context Protocol), como o GitHub MCP, Context7 e Sequential Thinking.
Descrição
O objetivo é mostrar como utilizar a classe MCPServerAdapter (obtida dos testes do crewai-tools) para conectar CrewAI a diferentes servidores MCP via STDIO, permitindo que os agentes utilizem as ferramentas desses servidores para realizar tarefas.
Os exemplos incluem:
- Testes isolados para conectar e usar ferramentas do Context7 e GitHub MCP.
- Um script combinado que utiliza CrewAI com agentes especializados para Sequential Thinking (planejamento) e GitHub MCP (execução).
Pré-requisitos
- Python: Versão 3.12 ou superior (conforme
pyproject.toml). - Docker: Necessário para executar o servidor GitHub MCP. Certifique-se de que o Docker Desktop (ou equivalente) esteja instalado e em execução.
- uv: Gerenciador de pacotes Python usado neste projeto (
pip install uv). - Tokens de API:
GITHUB_PERSONAL_ACCESS_TOKEN: Um token de acesso pessoal do GitHub com escopos apropriados (ex:repo,read:user). Como criar um PATGEMINI_API_KEY(ou outra LLM): Chave de API para o modelo de linguagem grande (LLM) usado pelo CrewAI (neste exemplo, Google Gemini).
Instalação
-
Clone o repositório:
git clone https://github.com/matheus896/mcp-tool-crewai -
Crie e ative um ambiente virtual:
# Usando venv (padrão Python) python -m venv .venv source .venv/bin/activate # Linux/macOS # ou .\.venv\Scripts\activate # Windows # Ou usando conda, etc. -
Instale as dependências com
uv:uv pip install -r requirements.txt # Se existir um requirements.txt gerado por uv # OU (recomendado se uv.lock estiver atualizado) uv sync # OU (para instalar do pyproject.toml) uv pip install .Nota: O
pyproject.tomlespecifica as dependências, incluindocrewai,crewai-tools[mcp],mcp, emcpadapt.
Configuração
-
Crie um arquivo
.env:
Copie o arquivo.env.examplepara.env:cp .env.example .env -
Edite o arquivo
.env:
Substitua os valores de placeholder pelas suas chaves de API reais:GITHUB_PERSONAL_ACCESS_TOKEN="ghp_SEU_TOKEN_AQUI" GEMINI_API_KEY="SEU_GEMINI_API_KEY_AQUI" # OPENAI_API_KEY="SEU_OPENAI_API_KEY_AQUI" # Se usar OpenAI
Arquivos Principais
mcp_tool.py: Contém a implementação da classeMCPServerAdapter, adaptada dos testes do repositóriocrewai-tools. Esta classe é crucial para a conexão com os servidores MCP. Nota: O nome original no seu projeto pode sermcpadapter.py, ajuste conforme necessário.test_mcp_context7.py: Script de teste isolado para conectar ao servidor Context7 MCP vianpxe usar a ferramentaresolve-library-id.test_mcp_github.py: Script de teste isolado para conectar ao servidor GitHub MCP via Docker e usar a ferramentaget_me.crewai_mcp_combined.py: Script principal que demonstra a integração com CrewAI, utilizando dois servidores MCP (Sequential Thinking e GitHub) e dois agentes especializados (Planejador e Executor). Usa a abordagem de gerenciamento manual da conexão MCP (.stop()nofinally).pyproject.toml: Define as dependências do projeto e metadados..env.example: Arquivo de exemplo para as variáveis de ambiente necessárias.
Como Executar
Certifique-se de que seu ambiente virtual está ativado e o Docker está rodando.
-
Testar Conexão Context7 (Isolado):
python test_mcp_context7.py -
Testar Conexão GitHub (Isolado):
python test_mcp_github.py -
Executar Exemplo Combinado CrewAI + Sequential Thinking + GitHub:
python crewai_mcp_combined.pyEste script iniciará os adaptadores MCP, definirá os agentes e tarefas, e executará a
Crew. A saída mostrará o processo de pensamento dos agentes e o resultado final.
Observações
MCPServerAdapter: A classeMCPServerAdapterusada aqui foi obtida dos arquivos de teste docrewai-tools, pois não estava diretamente disponível na biblioteca no momento da criação deste exemplo. Se/quando for oficialmente incluída nacrewai-tools, o import poderá ser ajustado (from crewai_tools import MCPServerAdapter).- Erro Asyncio no Windows: Pode incluir um erro comum do
asynciono Windows relacionado ao fechamento de subprocessos, geralmente ocorre no final da execução e não impede o funcionamento principal do script. - Gerenciamento da Conexão MCP: O script
crewai_mcp_combined.pyutiliza a abordagem de instanciarMCPServerAdaptere chamar.stop()manualmente em um blocofinally, conforme recomendado para garantir que a conexão permaneça ativa durante a execução daCrew.
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










