Adaptive Graph of Thoughts logo

Adaptive Graph of Thoughts

Community
SaptaDey

LLM Reasoning Framework for Scientific Research

PublisherSaptaDey
RepositoryAdaptive-Graph-of-Thoughts-MCP-server
LanguagePython
Forks
9
Stars
31
Available tools
0
Transport typestdio, streamable-http
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    Adaptive Graph of Thoughts exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    31 stars and 9 forks from the linked repository.

MseeP.ai Security Assessment Badge

🧠 Adaptive Graph of Thoughts

Version Python License Docker FastAPI NetworkX Last Updated smithery badge Codacy Security Scan CodeQL Advanced Dependabot Updates Verified on MseeP

🚀 Next-Generation AI Reasoning Framework for Scientific Research

Leveraging graph structures to transform how AI systems approach scientific reasoning


🔍 Overview

Adaptive Graph of Thoughts (AGoT) is a high-performance MCP server that implements the Advanced Scientific Reasoning Graph-of-Thoughts (ASR-GoT) framework. It uses a Neo4j graph database as a dynamic knowledge store and exposes reasoning capabilities through the Model Context Protocol (MCP), enabling seamless integration with AI assistants like Claude Desktop.

Key Highlights

FeatureDescription
🧠 Graph-Based ReasoningMulti-stage pipeline with 8 specialized reasoning stages
📊 Dynamic Confidence ScoringMulti-dimensional evaluation with uncertainty quantification
🔬 Evidence IntegrationReal-time connection to PubMed, Google Scholar & Exa Search
⚡ High PerformanceAsync FastAPI with Neo4j graph operations
🔌 MCP ProtocolNative Claude Desktop & VS Code integration
🐳 Cloud-ReadyFull Docker + Kubernetes (Helm) support

🏗️ System Architecture


🔄 ASR-GoT Reasoning Pipeline

The 8-stage reasoning pipeline transforms a raw question into a comprehensive, evidence-backed answer stored in the knowledge graph:


🕸️ Knowledge Graph Connectome

The Neo4j knowledge graph captures the reasoning structure as a rich connectome — nodes represent concepts, hypotheses, and evidence, while edges represent semantic and logical relationships:


🔁 Request Flow


📚 Documentation

Full documentation including API reference, configuration guide, and contribution guidelines:

➡️ Adaptive Graph of Thoughts Documentation Site

📂 Project Structure

Adaptive-Graph-of-Thoughts-MCP-server/
├── 📁 .github/             # CI/CD workflows (CodeQL, Dependabot)
├── 📁 agt_setup/           # Interactive setup wizard CLI
├── 📁 config/              # settings.yaml configuration
├── 📁 docs_src/            # MkDocs documentation source
├── 📁 helm/                # Kubernetes Helm chart
├── 📁 src/
│   └── 📁 adaptive_graph_of_thoughts/
│       ├── 📁 api/         # FastAPI routes & schemas
│       ├── 📁 application/ # GoTProcessor orchestrator
│       ├── 📁 domain/      # 8-stage pipeline & models
│       ├── 📁 infrastructure/ # Neo4j utilities
│       └── 📁 services/    # LLM & external API clients
├── 📁 tests/               # Comprehensive test suite
├── Dockerfile
├── docker-compose.yml
├── pyproject.toml
└── README.md

🚀 Quick Start

bash
git clone https://github.com/SaptaDey/Adaptive-Graph-of-Thoughts-MCP-server.git
cd Adaptive-Graph-of-Thoughts-MCP-server
poetry install
poetry run python -m agt_setup   # Interactive credential setup wizard
poetry run uvicorn adaptive_graph_of_thoughts.main:app --reload

Visit http://localhost:8000/docs for the interactive API documentation.

🚀 Getting Started

Deployment Prerequisites

Before running Adaptive Graph of Thoughts (either locally or via Docker if not using the provided docker-compose.prod.yml which includes Neo4j), ensure you have:

  • A running Neo4j Instance: Adaptive Graph of Thoughts requires a connection to a Neo4j graph database.

    • APOC Library: Crucially, the Neo4j instance must have the APOC (Awesome Procedures On Cypher) library installed. Several Cypher queries within the application's reasoning stages utilize APOC procedures (e.g., apoc.create.addLabels, apoc.merge.node). Without APOC, the application will not function correctly. You can find installation instructions on the official APOC website.
    • Configuration: Ensure that your config/settings.yaml (or corresponding environment variables) correctly points to your Neo4j instance URI, username, and password.
    • Indexing: For optimal performance, ensure appropriate Neo4j indexes are created. You can run python scripts/run_cypher_migrations.py to apply the provided Cypher migrations automatically. See Neo4j Indexing Strategy for details.

    Note: The provided docker-compose.yml (for development) and docker-compose.prod.yml (for production) already include a Neo4j service with the APOC library pre-configured, satisfying this requirement when using Docker Compose.

Prerequisites

  • Python 3.11+ (as specified in pyproject.toml, e.g., the Docker image uses Python 3.11.x or 3.12.x, 3.13.x)
  • Poetry: For dependency management
  • Docker and Docker Compose: For containerized deployment

Installation and Setup (Local Development)

  1. Clone the repository:

    bash
    git clone https://github.com/SaptaDey/Adaptive-Graph-of-Thoughts-MCP-server.git
    cd Adaptive-Graph-of-Thoughts-MCP-server
  2. Install dependencies using Poetry:

    bash
    poetry install

    This creates a virtual environment and installs all necessary packages specified in pyproject.toml.

  3. Activate the virtual environment:

    bash
    poetry shell
  4. Configure the application:

    bash
    # Copy example configuration
    cp config/settings.example.yaml config/settings.yaml
    
    # Edit configuration as needed
    vim config/settings.yaml
  5. Set up environment variables (optional):

    bash
    # Create .env file for sensitive configuration
    echo "LOG_LEVEL=DEBUG" > .env
    echo "API_HOST=0.0.0.0" >> .env
    echo "API_PORT=8000" >> .env

Secret Management

In production environments, set the SECRETS_PROVIDER environment variable to aws, gcp, or vault to fetch sensitive values from a supported secrets manager. Optionally provide <VAR>_SECRET_NAME variables (for example OPENAI_API_KEY_SECRET_NAME) to control the name of each secret. When a secrets provider is configured, values for OPENAI_API_KEY, ANTHROPIC_API_KEY, and NEO4J_PASSWORD are loaded automatically at startup.

  1. Run the development server:

    bash
    python src/adaptive_graph_of_thoughts/main.py

    Alternatively, for more control:

    bash
    uvicorn adaptive_graph_of_thoughts.main:app --reload --host 0.0.0.0 --port 8000

    The API will be available at http://localhost:8000.

✨ Setup Wizard

An interactive wizard is available to streamline initial configuration.

bash
poetry run python -m agt_setup

Then visit http://localhost:8000/setup to complete the web-based steps.

Setup wizard demo GIF will appear here in the full documentation.

Docker Deployment

  1. Quick Start with Docker Compose:

    bash
    # Build and run all services
    docker-compose up --build
    
    # For detached mode (background)
    docker-compose up --build -d
    
    # View logs
    docker-compose logs -f adaptive-graph-of-thoughts
  2. Individual Docker Container:

    bash
    # Build the image
    docker build -t adaptive-graph-of-thoughts:latest .
    
    # Run the container
    docker run -p 8000:8000 -v $(pwd)/config:/app/config adaptive-graph-of-thoughts:latest
  3. Production Deployment:

    bash
    # Use production compose file
    docker-compose -f docker-compose.prod.yml up --build -d

Kubernetes Deployment (Helm)

A minimal Helm chart is provided under helm/agot-server for running Adaptive Graph of Thoughts on a Kubernetes cluster.

bash
helm install agot helm/agot-server

Customize values in helm/agot-server/values.yaml to set the image repository, resource limits, and other options.

Notes on Specific Deployment Platforms

  • Smithery.ai: Deploy using the included smithery.yaml.
    • Connect your GitHub repository on Smithery and click Deploy.
    • The container listens on the PORT environment variable (default 8000).
    • Health Checks rely on the /health endpoint.
    • The Dockerfile and docker-compose.prod.yml illustrate the container setup.
  1. Access the Services:
    • API Documentation: http://localhost:8000/docs
    • Health Check: http://localhost:8000/health
    • MCP Endpoint: http://localhost:8000/mcp

🔌 MCP Client Integration

Supported MCP Clients

Adaptive Graph of Thoughts supports integration with various MCP clients:

  • Claude Desktop - Full STDIO and HTTP support
  • VS Code - Via MCP extensions
  • Custom MCP Clients - Generic configuration available

Quick Client Setup

Claude Desktop / VS Code settings

json
{
  "mcpServers": {
    "adaptive-graph-of-thoughts": {
      "command": "python",
      "args": ["-m", "adaptive_graph_of_thoughts.main"],
      "cwd": "/path/to/Adaptive-Graph-of-Thoughts-MCP-server",
      "env": {
        "NEO4J_URI": "bolt://localhost:7687",
        "NEO4J_USER": "neo4j",
        "NEO4J_PASSWORD": "your_password",
        "MCP_TRANSPORT_TYPE": "stdio"
      }
    }
  }
}

Available MCP Tools

ToolDescription
scientific_reasoning_queryAdvanced scientific reasoning with graph analysis
analyze_research_hypothesisHypothesis evaluation with confidence scoring
explore_scientific_relationshipsConcept relationship mapping
validate_scientific_claimsEvidence-based claim validation

🔌 API Endpoints

The primary API endpoints exposed by Adaptive Graph of Thoughts are:

  • MCP Protocol Endpoint: POST /mcp

    • This endpoint is used for communication with MCP clients like Claude Desktop.
    • Example Request for the asr_got.query method:
      json
      {
        "jsonrpc": "2.0",
        "method": "asr_got.query",
        "params": {
          "query": "Analyze the relationship between microbiome diversity and cancer progression.",
          "parameters": {
            "include_reasoning_trace": true,
            "include_graph_state": false
          }
        },
        "id": "123"
      }
    • Other supported MCP methods include initialize and shutdown.
  • Health Check Endpoint: GET /health

    • Provides a simple health status of the application.
    • Example Response:
      json
      {
        "status": "healthy",
        "version": "0.1.0" 
      }

The advanced API endpoints previously listed (e.g., /api/v1/graph/query) are not implemented in the current version and are reserved for potential future development.

Session Handling (session_id)

Currently, the session_id parameter available in API requests (e.g., for asr_got.query) and present in responses serves primarily to identify and track a single, complete query-response cycle. It is also used for correlating progress notifications (like got/queryProgress) with the originating query.

While the system generates and utilizes session_ids, Adaptive Graph of Thoughts does not currently support true multi-turn conversational continuity where the detailed graph state or reasoning context from a previous query is automatically loaded and reused for a follow-up query using the same session_id. Each query is processed independently at this time.

Future Enhancement: Persistent Sessions

A potential future enhancement for Adaptive Graph of Thoughts is the implementation of persistent sessions. This would enable more interactive and evolving reasoning processes by allowing users to:

  1. Persist State: Store the generated graph state and relevant reasoning context from a query, associated with its session_id, likely within the Neo4j database.
  2. Reload State: When a new query is submitted with an existing session_id, the system could reload this saved state as the starting point for further processing.
  3. Refine and Extend: Allow the new query to interact with the loaded graph—for example, by refining previous hypotheses, adding new evidence to existing structures, or exploring alternative reasoning paths based on the established context.

Implementing persistent sessions would involve developing robust strategies for:

  • Efficiently storing and retrieving session-specific graph data in Neo4j.
  • Managing the lifecycle (e.g., creation, update, expiration) of session data.
  • Designing sophisticated logic for how new queries merge with, modify, or extend pre-existing session contexts and graphs.

This is a significant feature that could greatly enhance the interactive capabilities of Adaptive Graph of Thoughts. Contributions from the community in designing and implementing persistent session functionality are welcome.

Future Enhancement: Asynchronous and Parallel Stage Execution

Currently, the 8 stages of the Adaptive Graph of Thoughts reasoning pipeline are executed sequentially. For complex queries or to further optimize performance, exploring asynchronous or parallel execution for certain parts of the pipeline is a potential future enhancement.

Potential Areas for Parallelism:

  • Hypothesis Generation: The HypothesisStage generates hypotheses for each dimension identified by the DecompositionStage. The process of generating hypotheses for different, independent dimensions could potentially be parallelized. For instance, if three dimensions are decomposed, three parallel tasks could work on generating hypotheses for each respective dimension.
  • Evidence Integration (Partial): Within the EvidenceStage, if multiple hypotheses are selected for evaluation, the "plan execution" phase (simulated evidence gathering) for these different hypotheses might be performed concurrently.

Challenges and Considerations:

Implementing parallel stage execution would introduce complexities that need careful management:

  • Data Consistency: Concurrent operations, especially writes to the Neo4j database (e.g., creating multiple hypothesis nodes or evidence nodes simultaneously), must be handled carefully to ensure data integrity and avoid race conditions. Unique ID generation schemes would need to be robust for parallel execution.
  • Transaction Management: Neo4j transactions for concurrent writes would need to be managed appropriately.
  • Dependency Management: Ensuring that stages (or parts of stages) that truly depend on the output of others are correctly sequenced would be critical.
  • Resource Utilization: Parallel execution could increase resource demands (CPU, memory, database connections).
  • Complexity: The overall control flow of the GoTProcessor would become more complex.

While the current sequential execution ensures a clear and manageable data flow, targeted parallelism in areas like hypothesis generation for independent dimensions could offer performance benefits for future versions of Adaptive Graph of Thoughts. This remains an open area for research and development.

🧪 Testing & Quality Assurance

Development Commands

Continuous integration pipelines on GitHub Actions run tests, CodeQL analysis, and Microsoft Defender for DevOps security scans.

bash
# Run full test suite with coverage using Poetry
poetry run pytest --cov=src --cov-report=html --cov-report=term

# Or using Makefile for the default test run
make test

# Run specific test categories (using poetry)
poetry run pytest tests/unit/stages/          # Stage-specific tests
poetry run pytest tests/integration/         # Integration tests
poetry run pytest -k "test_confidence"       # Tests matching pattern

# Type checking and linting (can also be run via Makefile targets: make lint, make check-types)
poetry run mypy src/ --strict                # Strict type checking
poetry run ruff check . --fix                # Auto-fix linting issues
poetry run ruff format .                     # Format code

# Pre-commit hooks (recommended)
poetry run pre-commit install                # Install hooks
poetry run pre-commit run --all-files       # Run all hooks (runs Ruff and MyPy)

# See Makefile for other useful targets like 'make all-checks'.

🖥 Dashboard Tour

Dashboard demo GIF coming soon.

💻 IDE Integration

Use the vscode-agot extension to query the server from VS Code. Run the extension and execute AGoT: Ask Graph… from the Command Palette.

❓ Troubleshooting

If the server fails to start or setup reports errors, ensure your Neo4j instance is running and the credentials in .env are correct. Consult the console output for details.

🗺️ Roadmap and Future Directions

We have an exciting vision for the future of Adaptive Graph of Thoughts! Our roadmap includes plans for enhanced graph visualization, integration with more data sources like Arxiv, and further refinements to the core reasoning engine.

For more details on our planned features and long-term goals, please see our Roadmap (also available on the documentation site).

🤝 Contributing

We welcome contributions! Please see our Contributing Guidelines (also available on the documentation site) for details on how to get started, our branching strategy, code style, and more.

📄 License

This project is licensed under the Apache License 2.0. License.

🔒 Security

Please see our Security Policy for reporting vulnerabilities and details on supported versions.

🙏 Acknowledgments

  • NetworkX community for graph analysis capabilities
  • FastAPI team for the excellent web framework
  • Pydantic for robust data validation
  • The scientific research community for inspiration and feedback

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "saptadey-adaptive-graph-of-thoughts-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "Adaptive-Graph-of-Thoughts-MCP-server"
      ]
    }
  }
}

Use Adaptive Graph of Thoughts MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Adaptive Graph of Thoughts is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. You can run MCP locally on your device or connect to a remote MCP server URL.

Option 1: Use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Adaptive Graph of Thoughts as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Adaptive Graph of Thoughts MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "saptadey-adaptive-graph-of-thoughts-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "Adaptive-Graph-of-Thoughts-MCP-server"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Adaptive Graph of Thoughts MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Adaptive Graph of Thoughts MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Adaptive Graph of Thoughts to help me with this task?
Adaptive Graph of Thoughts
Sure. I read it.
Here is what I found using Adaptive Graph of Thoughts.

Option 2: Add an MCP server URL

Use this when Adaptive Graph of Thoughts is already hosted remotely or your team wants one shared connector that multiple users can access.

1

Open MCP connectors

In TypingMind, go to Plugins, open MCP connectors, then choose Add URL.

  1. Open TypingMind in your browser.
  2. Go to Plugins.
  3. Open MCP connectors.
  4. Click Add URL.
TypingMind Add Custom MCP Server URL form
2

Paste the server URL

Enter your server URL in the Server URL field. Add a connection name, description, icon, custom HTTP headers, or OAuth client settings if the server requires them.

  1. Paste your server URL into the Server URL field.
  2. Enter a connection name for Adaptive Graph of Thoughts.
  3. Add a description and icon if you want it to be easier to identify.
  4. Add custom HTTP headers or OAuth client details if the server requires authentication.
3

Create the connection

Click Create connection, then return to the Plugins list and confirm the new MCP connection is active.

  1. Click Create connection.
  2. Return to the MCP connectors list.
  3. Confirm the Adaptive Graph of Thoughts connection appears as active.
  4. Refresh the plugin list if the connection does not appear immediately.
4

Switch models without reconnecting

Start a chat with your preferred model, enable the Adaptive Graph of Thoughts tools from Plugins, and switch to another model whenever needed. The MCP connection stays available to the TypingMind workspace.

  1. Start a new chat in TypingMind.
  2. Select the AI model you want to use.
  3. Enable the Adaptive Graph of Thoughts tools from Plugins.
  4. Ask the model to use the tool when needed.
  5. Switch to another AI model and reuse the same MCP connection.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Adaptive Graph of Thoughts to help me with this task?
Adaptive Graph of Thoughts
Sure. I read it.
Here is what I found using Adaptive Graph of Thoughts.

Frequently asked questions

What is the Adaptive Graph of Thoughts MCP server used for?

Adaptive Graph of Thoughts is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Adaptive Graph of Thoughts MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Adaptive Graph of Thoughts with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Adaptive Graph of Thoughts MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Adaptive Graph of Thoughts connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Adaptive Graph of Thoughts MCP to TypingMind?

Adaptive Graph of Thoughts can be connected in TypingMind with the local MCP connector or by adding a remote MCP server URL. Use the local connector when the server needs access to files, apps, or private resources on your device, and use a server URL when the MCP server is hosted remotely.

What tools does Adaptive Graph of Thoughts MCP provide in TypingMind?

Adaptive Graph of Thoughts exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Adaptive Graph of Thoughts MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Adaptive Graph of Thoughts requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇