{"type":"mcp_client","name":"mcp-server-mas-sequential-thinking","description":"MAS sequential thinking server. Agno-based multi-agent system exposed via MCP.","category":"System Tools","language":"Python","stars":306,"forks":23,"owner":"FradSer","github_url":"https://github.com/FradSer/mcp-server-mas-sequential-thinking","homepage":null,"setup":"## Setup\n\n### Prerequisites\n\n- Python 3.10+\n- Access to a compatible LLM API (configured for `agno`). The system currently supports:\n    - **Groq:** Requires `GROQ_API_KEY`.\n    - **DeepSeek:** Requires `DEEPSEEK_API_KEY`.\n    - **OpenRouter:** Requires `OPENROUTER_API_KEY`.\n    - Configure the desired provider using the `LLM_PROVIDER` environment variable (defaults to `deepseek`).\n- Exa API Key (required only if using the Researcher agent's capabilities)\n    - Set via the `EXA_API_KEY` environment variable.\n- `uv` package manager (recommended) or `pip`.\n\n### Installation\n\n1.  **Clone the repository:**\n    ```bash\n    git clone git@github.com:FradSer/mcp-server-mas-sequential-thinking.git\n    cd mcp-server-mas-sequential-thinking\n    ```\n\n2.  **Set Environment Variables:**\n    Create a `.env` file in the project root directory or export the variables directly into your environment:\n    ```dotenv\n    # --- LLM Configuration ---\n    # Select the LLM provider: \"deepseek\" (default), \"groq\", or \"openrouter\"\n    LLM_PROVIDER=\"deepseek\"\n\n    # Provide the API key for the chosen provider:\n    # GROQ_API_KEY=\"your_groq_api_key\"\n    DEEPSEEK_API_KEY=\"your_deepseek_api_key\"\n    # OPENROUTER_API_KEY=\"your_openrouter_api_key\"\n\n    # Optional: Base URL override (e.g., for custom DeepSeek endpoints)\n    # DEEPSEEK_BASE_URL=\"your_base_url_if_needed\"\n\n    # Optional: Specify different models for Team Coordinator and Specialist Agents\n    # Defaults are set within the code based on the provider if these are not set.\n    # Example for Groq:\n    # GROQ_TEAM_MODEL_ID=\"llama3-70b-8192\"\n    # GROQ_AGENT_MODEL_ID=\"llama3-8b-8192\"\n    # Example for DeepSeek:\n    # DEEPSEEK_TEAM_MODEL_ID=\"deepseek-chat\" # Note: `deepseek-reasoner` is not recommended as it doesn't support function calling\n    # DEEPSEEK_AGENT_MODEL_ID=\"deepseek-chat\" # Recommended for specialists\n    # Example for OpenRouter:\n    # OPENROUTER_TEAM_MODEL_ID=\"deepseek/deepseek-r1\" # Example, adjust as needed\n    # OPENROUTER_AGENT_MODEL_ID=\"deepseek/deepseek-chat\" # Example, adjust as needed\n\n    # --- External Tools ---\n    # Required ONLY if the Researcher agent is used and needs Exa\n    EXA_API_KEY=\"your_exa_api_key\"\n    ```\n\n    **Note on Model Selection:**\n    - The `TEAM_MODEL_ID` is used by the Coordinator (`Team` object). This role benefits from strong reasoning, synthesis, and delegation capabilities. Consider using a more powerful model (e.g., `deepseek-chat`, `claude-3-opus`, `gpt-4-turbo`) here, potentially balancing capability with cost/speed.\n    - The `AGENT_MODEL_ID` is used by the specialist agents (Planner, Researcher, etc.). These handle focused sub-tasks. A faster or more cost-effective model (e.g., `deepseek-chat`, `claude-3-sonnet`, `llama3-8b`) might be suitable, depending on task complexity and budget/performance needs.\n    - Defaults are provided in the code (e.g., in `main.py`) if these environment variables are not set. Experimentation is encouraged to find the optimal balance for your use case.\n\n3.  **Install Dependencies:**\n    It's highly recommended to use a virtual environment.\n\n    - **Using `uv` (Recommended):**\n        ```bash\n        # Install uv if you don't have it:\n        # curl -LsSf https://astral.sh/uv/install.sh | sh\n        # source $HOME/.cargo/env # Or restart your shell\n\n        # Create and activate a virtual environment (optional but recommended)\n        python -m venv .venv\n        source .venv/bin/activate # On Windows use `.venv\\\\Scripts\\\\activate`\n\n        # Install dependencies\n        uv pip install -r requirements.txt\n        # Or if a pyproject.toml exists with dependencies defined:\n        # uv pip install .\n        ```\n    - **Using `pip`:**\n        ```bash\n        # Create and activate a virtual environment (optional but recommended)\n        python -m venv .venv\n        source .venv/bin/activate # On Windows use `.venv\\\\Scripts\\\\activate`\n\n        # Install dependencies\n        pip install -r requirements.txt\n        # Or if a pyproject.toml exists with dependencies defined:\n        # pip install .\n        ```\n\n### MCP Server Configuration (Client-Side)\n\nThis server runs as a standard executable script that communicates via stdio, as expected by MCP. The exact configuration method depends on your specific MCP client implementation. Consult your client's documentation for details on integrating external tool servers.\n\nThe `env` section within your MCP client configuration should include the API key for your chosen `LLM_PROVIDER`.\n\n```json\n{\n  \"mcpServers\": {\n      \"mas-sequential-thinking\": {\n         \"command\": \"uvx\", // Or \"python\", \"path/to/venv/bin/python\" etc.\n         \"args\": [\n            \"mcp-server-mas-sequential-thinking\" // Or the path to your main script, e.g., \"main.py\"\n         ],\n         \"env\": {\n            \"LLM_PROVIDER\": \"deepseek\", // Or \"groq\", \"openrouter\"\n            // \"GROQ_API_KEY\": \"your_groq_api_key\", // Only if LLM_PROVIDER=\"groq\"\n            \"DEEPSEEK_API_KEY\": \"your_deepseek_api_key\", // Default provider\n            // \"OPENROUTER_API_KEY\": \"your_openrouter_api_key\", // Only if LLM_PROVIDER=\"openrouter\"\n            \"DEEPSEEK_BASE_URL\": \"your_base_url_if_needed\", // Optional: If using a custom endpoint for DeepSeek\n            \"EXA_API_KEY\": \"your_exa_api_key\" // Only if using Exa\n         }\n      }\n   }\n}\n```","tools":"## Available Tools\n\nThe `sequentialthinking` tool is the primary feature of this project. It's designed for complex problem-solving by leveraging a Multi-Agent System (MAS) architecture.\n\n*   **`sequentialthinking`**: This tool takes a thought as input, processes it using a team of specialized agents, and returns a synthesized response with guidance for the next step. It supports revisions and branching to explore alternative paths.\n\n    *   **Functionality:**\n        *   Receives a thought, validates it, and logs it.\n        *   Delegates sub-tasks to specialized agents (Planner, Researcher, Analyzer, Critic, Synthesizer).\n        *   Synthesizes responses from agents into a cohesive output.\n        *   Provides recommendations for revision or branching.\n        *   Returns a JSON string containing the synthesized response, status, and updated context.\n    *   **Parameters (via `ThoughtData` Pydantic model):**\n        *   `thought` (str): Content of the current thought/step.\n        *   `thoughtNumber` (int): Sequence number (>=1).\n        *   `totalThoughts` (int): Estimated total steps (>=1, suggest >=5).\n        *   `nextThoughtNeeded` (bool): Is another step required after this?\n        *   `isRevision` (bool, optional): Is this revising a previous thought? Defaults to `False`.\n        *   `revisesThought` (Optional[int], optional): If `isRevision`, which thought number? Defaults to `None`.\n        *   `branchFromThought` (Optional[int], optional): If branching, from which thought? Defaults to `None`.\n        *   `branchId` (Optional[str], optional): Unique ID for the new branch being created. Defaults to `None`.\n        *   `needsMoreThoughts` (bool, optional): Signal if estimate is too low before last step. Defaults to `False`.\n    *   **Usage Example (Conceptual):**\n\n        1.  **LLM:** Calls `sequentialthinking` tool with `thoughtNumber: 1`, the initial `thought` (e.g., \"Plan the analysis...\"), an estimated `totalThoughts`, and `nextThoughtNeeded: True`.\n        2.  **Server:** MAS processes the thought. The Coordinator synthesizes responses from specialists and provides guidance (e.g., \"Analysis plan complete. Suggest researching X next. No revisions recommended yet.\").\n        3.  **LLM:** Receives the JSON response containing `coordinatorResponse`.\n        4.  **LLM:** Formulates the next thought based on the `coordinatorResponse` (e.g., \"Research X using available tools...\").\n        5.  **LLM:** Calls `sequentialthinking` tool with `thoughtNumber: 2`, the new `thought`, potentially updated `totalThoughts`, `nextThoughtNeeded: True`.\n        6.  **Server:** MAS processes. The Coordinator synthesizes (e.g., \"Research complete. Findings suggest a flaw in thought #1's assumption. RECOMMENDATION: Revise thought #1...\").\n        7.  **LLM:** Receives the response, notes the recommendation.\n        8.  **LLM:** Formulates a revision thought.\n        9.  **LLM:** Calls `sequentialthinking` tool with `thoughtNumber: 3`, the revision `thought`, `isRevision: True`, `revisesThought: 1`, `nextThoughtNeeded: True`.\n\n*   **Specialized Agents (within `sequentialthinking`):** These agents are not directly called but are integral to the `sequentialthinking` tool's operation.\n    *   **Planner:** Responsible for planning the analysis process.\n    *   **Researcher:** Gathers information, potentially using external tools like Exa.\n    *   **Analyzer:** Analyzes the thought and provides insights.\n    *   **Critic:** Critiques the thought and identifies potential flaws.\n    *   **Synthesizer:** Synthesizes information and generates a cohesive output.","faq":null,"created_at":"2025-04-02T16:59:22+00:00","updated_at":"2025-07-06T23:08:42+00:00","source_url":"https://model-context-protocol.com/clients/mcp-server-mas-sequential-thinking","related_articles":[]}