Skip to content

Agent MCP Demo

Advanced ai integration developer

An intelligent AI agent with MCP integration enabling multi-source search across Google Drive, Slack, and filesystem.

Experience the power of AI agents with Model Context Protocol (MCP) integration. This example demonstrates how to build agents that can access multiple data sources.

Capabilities

  • Multi-Source Search: Query across Google Drive, Slack, and local files
  • MCP Integration: Uses the Model Context Protocol for tool access
  • Intelligent Agent: Claude-powered reasoning and task execution
  • Context Awareness: Maintains conversation context across queries

This example showcases how Habits can power sophisticated AI agents that go beyond simple chat to actually interact with your tools and data.

Requirements

  • Claude API key (via env var)
  • MCP server running (optional)
  • Google Drive credentials (optional)

Key Files

yaml
version: "1.0"
workflows:
  - id: agent-mcp-search
    path: ./habit.yaml
    enabled: true

server:
  port: 13000
  host: "0.0.0.0"

logging:
  level: info
  outputs: [console]
  format: text
  colorize: true
yaml
id: agent-mcp-search
name: Agent MCP Search Demo
description: |
  Demonstrates using bit-agent to search across multiple data sources:
  - Google Drive for documents
  - Slack for messages  
  - Local filesystem via Everything MCP server

nodes:
  # Agent that searches across Google Drive, Slack, and local files
  - id: multi-source-search
    type: bit
    data:
      framework: bits
      module: '@ha-bits/bit-agent'
      operation: run_agent
      source: local
      credentials:
        agentAuth:
          llmProvider: openai
          apiKey: '{{habits.env.OPENAI_API_KEY}}'
          mcpSecrets:
            # GDRIVE_CREDENTIALS: '{{habits.env.GDRIVE_CREDENTIALS}}'
            SLACK_BOT_TOKEN: '{{habits.env.SLACK_BOT_TOKEN}}'
            SLACK_TEAM_ID: '{{habits.env.SLACK_TEAM_ID}}'
      params:
        prompt: '{{habits.input.query}}'
        systemPrompt: |
          You are a helpful research assistant with access to multiple tools.
          
          You can search:
          1. Google Drive - for documents, spreadsheets, and files
          2. Slack - for messages and conversations
          3. Local filesystem - for local files and data
          
          When the user asks to search for something, use ALL available tools 
          to provide comprehensive results. Summarize your findings clearly.
        mcpServers:
          # Google Drive MCP - requires GDRIVE_CREDENTIALS
          # - type: google-drive
          # Slack MCP - requires SLACK_BOT_TOKEN
          - type: slack
          # Everything MCP - no auth required, great for testing
          - type: everything
        model: gpt-4o
        maxIterations: 15
        temperature: 0.3

edges: []

# Optional: Output the agent's response
output:
  response: '{{multi-source-search.response.output.response}}'
  # toolsUsed: '{{multi-source-search.toolCalls}}'
  # mcpServers: '{{multi-source-search.mcpServersConnected}}'
example
# LLM Provider API Key (required)
# Get your OpenAI API key from: https://platform.openai.com/api-keys
OPENAI_API_KEY=sk-...

# Google Drive MCP Credentials (optional)
# Follow setup at: https://github.com/anthropics/mcp-server-gdrive
# This is a base64 encoded JSON of your Google OAuth credentials
# Use echo -n "" | base64 to encode your credentials JSON into a single line string for the GDRIVE_CREDENTIALS variable.
GDRIVE_CREDENTIALS=eyJ...

# Slack Bot Token (optional)
# Create a Slack app at: https://api.slack.com/apps
# Required scopes: channels:history, channels:read, users:read
SLACK_BOT_TOKEN=xoxb-...
# Slack Team ID (required if using Slack MCP)
# Find it in your Slack workspace URL: https://app.slack.com/client/TXXXXXXXX/...
# The TXXXXXXXX part is your Team ID
SLACK_TEAM_ID=T...

# Alternative LLM Providers (if not using OpenAI)
# ANTHROPIC_API_KEY=sk-ant-...
# GOOGLE_API_KEY=AI...

Quick Start

Run directly using Cortex package, recommended for production runs, does not inlcude base or extra depdencies.

# First, download the example files
npx @ha-bits/cortex@latest server --config ./agent-mcp-demo/stack.yaml

Released under the Apache 2.0 License.