### Install Dependencies with uv Source: https://context7.com/crewaiinc/enterprise-mcp-server/llms.txt Installs project dependencies using the 'uv' package manager. ```bash # Install dependencies using uv uv sync ``` -------------------------------- ### Run MCP Server Directly with uv Source: https://context7.com/crewaiinc/enterprise-mcp-server/llms.txt Starts the MCP server directly using 'uv run' with the 'mcp[cli]' extra. ```bash # Run the MCP server directly uv run --with mcp[cli] mcp run crewai_enterprise_server.py ``` -------------------------------- ### kickoff_crew Source: https://context7.com/crewaiinc/enterprise-mcp-server/llms.txt Starts a new crew execution by sending a POST request to the /kickoff endpoint. It accepts task inputs and returns a crew_id for status tracking. ```APIDOC ## kickoff_crew ### Description Sends a POST request to the `/kickoff` endpoint of the configured CrewAI Enterprise server to start a new crew execution. The `inputs` dictionary is forwarded as the task payload. The response includes a `crew_id` that must be saved and used to poll for the task's result via `get_crew_status`. ### Method POST ### Endpoint `/kickoff` ### Request Body - **inputs** (dict) - Required - The payload for the crew task. ### Request Example ```json { "inputs": { "query": "Summarize the latest advancements in quantum computing", "output_format": "bullet_points", "max_sources": 5 } } ``` ### Response #### Success Response (200) - **crew_id** (string) - The unique identifier for the initiated crew task. - **status** (string) - The current status of the crew task (e.g., "started"). - **message** (string) - A confirmation message. #### Response Example ```json { "crew_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "status": "started", "message": "Crew task has been initiated successfully" } ``` ``` -------------------------------- ### Get Crew Task Status and Results Source: https://context7.com/crewaiinc/enterprise-mcp-server/llms.txt Retrieves the current status and output of a crew task using its 'crew_id'. Sends a GET request to the server's /status/{crew_id} endpoint. Requires 'httpx' and 'python-dotenv'. ```python import asyncio import httpx import os import time from dotenv import load_dotenv load_dotenv() CREWAI_ENTERPRISE_SERVER_URL = os.getenv("MCP_CREWAI_ENTERPRISE_SERVER_URL") CREWAI_ENTERPRISE_BEARER_TOKEN = os.getenv("MCP_CREWAI_ENTERPRISE_BEARER_TOKEN") async def get_crew_status(crew_id: str) -> dict: async with httpx.AsyncClient() as client: response = await client.get( f"{CREWAI_ENTERPRISE_SERVER_URL}/status/{crew_id}", headers={ "Authorization": f"Bearer {CREWAI_ENTERPRISE_BEARER_TOKEN}", "Content-Type": "application/json", }, ) response.raise_for_status() return response.json() ``` -------------------------------- ### get_crew_status Source: https://context7.com/crewaiinc/enterprise-mcp-server/llms.txt Retrieves the status and results of a crew task using a GET request to the /status/{crew_id} endpoint. Requires the crew_id obtained from the kickoff_crew operation. ```APIDOC ## get_crew_status ### Description Sends a GET request to `/status/{crew_id}` on the CrewAI Enterprise server to retrieve the current state of a running or completed crew task. The response contains the task status and, once complete, the full output produced by the crew's agents. ### Method GET ### Endpoint `/status/{crew_id}` ### Parameters #### Path Parameters - **crew_id** (string) - Required - The unique identifier of the crew task. ### Response #### Success Response (200) - **status** (string) - The current status of the crew task (e.g., "running", "completed", "failed"). - **output** (object or null) - The results of the crew task if completed, otherwise null. #### Response Example ```json { "status": "completed", "output": { "summary": "Advancements in quantum computing include breakthroughs in qubit stability and error correction techniques..." } } ``` ``` -------------------------------- ### Run MCP Server as Python Script with uv Source: https://context7.com/crewaiinc/enterprise-mcp-server/llms.txt Executes the MCP server as a Python script using 'uv run', initiating the MCP transport loop. ```bash # Or run as a Python script (starts the MCP transport loop) uv run crewai_enterprise_server.py ``` -------------------------------- ### Kickoff Crew Task with Inputs Source: https://context7.com/crewaiinc/enterprise-mcp-server/llms.txt Initiates a new crew execution by sending a POST request to the server's /kickoff endpoint. The 'inputs' dictionary is passed as the payload. Requires 'httpx' and 'python-dotenv'. ```python import asyncio import httpx import os from dotenv import load_dotenv load_dotenv() CREWAI_ENTERPRISE_SERVER_URL = os.getenv("MCP_CREWAI_ENTERPRISE_SERVER_URL") CREWAI_ENTERPRISE_BEARER_TOKEN = os.getenv("MCP_CREWAI_ENTERPRISE_BEARER_TOKEN") async def kickoff_crew(inputs: dict) -> dict: async with httpx.AsyncClient() as client: response = await client.post( f"{CREWAI_ENTERPRISE_SERVER_URL}/kickoff", headers={ "Authorization": f"Bearer {CREWAI_ENTERPRISE_BEARER_TOKEN}", "Content-Type": "application/json", }, json={"inputs": inputs}, ) response.raise_for_status() return response.json() # Example: kick off a research crew with a topic query async def main(): result = await kickoff_crew({ "query": "Summarize the latest advancements in quantum computing", "output_format": "bullet_points", "max_sources": 5 }) print(result) # Expected output: # { # "crew_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", # "status": "started", # "message": "Crew task has been initiated successfully" # } crew_id = result["crew_id"] print(f"Crew started with ID: {crew_id}") asyncio.run(main()) ``` -------------------------------- ### Verify MCP Server Tools with mcp CLI Source: https://context7.com/crewaiinc/enterprise-mcp-server/llms.txt Verifies that the MCP server exposes the expected tools by inspecting it with the 'mcp dev' command. ```bash # Verify the server exposes the two tools by inspecting with mcp CLI uv run --with mcp[cli] mcp dev crewai_enterprise_server.py # Expected: lists kickoff_crew and get_crew_status as available tools ``` -------------------------------- ### Register CrewAI Enterprise MCP Server in Claude Desktop Source: https://context7.com/crewaiinc/enterprise-mcp-server/llms.txt Configure Claude Desktop to recognize and use the CrewAI Enterprise MCP Server. This involves specifying the command to run the server and its environment variables. ```json // Claude Desktop: Settings > Developer Settings > MCP Servers // claude_desktop_config.json { "mcpServers": { "crewai_enterprise_server": { "command": "uv", "args": [ "run", "--with", "mcp[cli]", "mcp", "run", "/path/to/cloned/repo/crewai_enterprise_server.py" ], "env": { "MCP_CREWAI_ENTERPRISE_SERVER_URL": "https://your-crew-endpoint.app.crewai.com", "MCP_CREWAI_ENTERPRISE_BEARER_TOKEN": "your_bearer_token_here" } } } } ``` -------------------------------- ### Configure CrewAI Enterprise MCP Server Locally Source: https://github.com/crewaiinc/enterprise-mcp-server/blob/main/README.md Use this JSON configuration to set up the CrewAI Enterprise MCP Server when running locally. Ensure you replace placeholders with your actual file path and credentials. ```json { "mcpServers": { "crewai_enterprise_server": { "command": "uv", "args": [ "run", "--with", "mcp[cli]", "mcp", "run", "", "/crewai_enterprise_server.py" ], "env": { "MCP_CREWAI_ENTERPRISE_SERVER_URL": "<>", "MCP_CREWAI_ENTERPRISE_BEARER_TOKEN": "<>" } } } } ``` -------------------------------- ### Configure CrewAI Enterprise Server Environment Variables Source: https://context7.com/crewaiinc/enterprise-mcp-server/llms.txt Set these environment variables to configure the connection to your CrewAI Enterprise backend. Ensure these are set before running the server. ```bash # .env file (loaded automatically via python-dotenv) MCP_CREWAI_ENTERPRISE_SERVER_URL=https://your-crew-endpoint.app.crewai.com MCP_CREWAI_ENTERPRISE_BEARER_TOKEN=your_bearer_token_here ``` -------------------------------- ### Poll Until Crew Task is Complete Source: https://context7.com/crewaiinc/enterprise-mcp-server/llms.txt This function polls for the status of a crew task, returning the result when completed or raising an error if failed. It uses an asyncio sleep to control the polling interval. ```python async def wait_for_crew(crew_id: str, poll_interval: int = 5) -> dict: while True: status_response = await get_crew_status(crew_id) print(f"Current status: {status_response.get('status')}") if status_response.get("status") == "completed": print("Crew finished! Results:") print(status_response.get("result")) # Expected output: # { # "crew_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", # "status": "completed", # "result": "• Quantum error correction has advanced significantly...\n• New qubit designs...", # "completed_at": "2024-11-15T10:32:00Z" # } return status_response elif status_response.get("status") == "failed": raise RuntimeError(f"Crew task failed: {status_response.get('error')}") await asyncio.sleep(poll_interval) asyncio.run(wait_for_crew("a1b2c3d4-e5f6-7890-abcd-ef1234567890")) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.