- Introduced a new AI Real Estate Agent Team with multi-agent capabilities for property search, market analysis, and valuation. - Added comprehensive README documentation detailing features, setup instructions, and API requirements. - Implemented the Enterprise MCP AI Agent Team for orchestrating knowledge management across local files and SaaS platforms, including specialized agents for Notion, GitHub, and Figma. - Enhanced the overall architecture with intelligent routing and task delegation using the Model Context Protocol (MCP). - Included necessary requirements for both teams to ensure proper functionality. |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| agent.py | ||
| README.md | ||
| requirements.txt | ||
Enterprise MCP AI Agent Team
A production-grade multi-agent system built with Google ADK that orchestrates knowledge management across local files and SaaS platforms using MCP (Model Context Protocol).
Overview
This system combines:
- Local Filesystem MCP Server - for accessing and analyzing local documents
- Notion MCP Server - for managing Notion workspaces and content
- Composio MCP Server - for GitHub and Figma integration
- Intelligent Router/Orchestrator - context-aware task delegation with state management
- 4 Specialized AI Agents - each handling specific platform capabilities
Architecture
┌─────────────────────────────────────────────────────────────┐
│ Enterprise MCP AI Agent Team │
│ (Coordinator/Dispatcher Pattern) │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────────┐ ┌─────────────────┐ ┌──────────────┐ │
│ │ File Analysis │ │ Notion Agent │ │ GitHub Agent │ │
│ │ AI Agent │ │ (Optional) │ │ (Optional) │ │
│ └─────────────────┘ └─────────────────┘ └──────────────┘ │
│ │ │ │ │
│ ┌─────────────────┐ ┌─────────────────┐ ┌──────────────┐ │
│ │ Filesystem MCP │ │ Notion MCP │ │ Composio MCP │ │
│ │ Server │ │ Server │ │ Server │ │
│ └─────────────────┘ └─────────────────┘ └──────────────┘ │
│ │ │ │ │
│ ┌─────────────────┐ ┌─────────────────┐ ┌──────────────┐ │
│ │ Local Documents │ │ Notion Pages & │ │ GitHub Repos │ │
│ │ (PDF, DOC, XLS) │ │ Databases │ │ & Issues │ │
│ └─────────────────┘ └─────────────────┘ └──────────────┘ │
│ │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Figma Agent │ │ Composio MCP │ │
│ │ (Optional) │ │ Server │ │
│ └─────────────────┘ └─────────────────┘ │
│ │ │ │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Figma Files & │ │ Figma Designs & │ │
│ │ Designs │ │ Assets │ │
│ └─────────────────┘ └─────────────────┘ │
└─────────────────────────────────────────────────────────────┘
Routing Patterns:
- Coordinator/Dispatcher Pattern: Intelligent routing based on query analysis
- LLM-Driven Delegation: Automatic agent selection using
transfer_to_agent() - Explicit Invocation: Direct agent calls using
AgentTool - Graceful Degradation: System works with any combination of available agents
Features
🔍 File Analysis Agent
- Analyzes local documents (PDFs, Word docs, spreadsheets)
- Extracts key topics, summaries, and action items
- Categorizes documents by type and content
- Identifies information for knowledge base sync
📝 Notion Agent
- Reads, writes, and updates Notion pages and databases
- Searches for content across Notion workspace
- Creates structured knowledge bases and documentation
- Syncs content from other sources to Notion
🐙 GitHub Agent
- Creates and manages GitHub issues and pull requests
- Searches repositories and code
- Manages repository content and documentation
- Sets up automated workflows and actions
🎨 Figma Agent
- Reads and analyzes Figma files and designs
- Exports design assets and components
- Searches for design elements and styles
- Manages design system components
🎯 Enterprise MCP AI Agent Team (Router/Orchestrator)
- Analyzes user requests and determines which AI agents should handle them
- Routes tasks to appropriate specialized AI agents based on capabilities
- Coordinates multi-step workflows that require multiple AI agents
- Shares context and results between AI agents through session state
- Provides comprehensive results and recommendations
🛡️ Error Handling & Graceful Degradation
- MCP Server Failures: Graceful fallback when servers are unavailable
- Missing Environment Variables: System works with available APIs only
- Agent Creation Failures: Continues with available agents
- Validation: Ensures at least one agent is available before operation
- Comprehensive Logging: Detailed logs for troubleshooting
Prerequisites
- Python 3.9+ and Node.js (for MCP servers)
- Google ADK installed and configured
- Notion API Key for Notion integration
- Required API Keys in environment variables
Setup
1. Environment Variables
Create a .env file in the project root:
# Required: Google Gemini API
GOOGLE_API_KEY=your_gemini_api_key_here
# Required: API Keys for MCP Tools
NOTION_API_KEY=your_notion_api_key_here
GITHUB_API_KEY=your_github_api_key_here
FIGMA_API_KEY=your_figma_api_key_here
# Optional: Custom filesystem path (defaults to ~/Documents)
MCP_FILESYSTEM_PATH=/Users/madhushantan/Downloads
2. Notion Setup
Creating a Notion Integration
- Go to Notion Integrations
- Click "New integration"
- Name your integration (e.g., "Enterprise Knowledge Orchestrator")
- Select the capabilities needed (Read & Write content)
- Submit and copy your "Internal Integration Token"
Sharing Your Notion Page with the Integration
- Open your Notion page
- Click the three dots (⋮) in the top-right corner
- Select "Add connections" from the dropdown
- Search for your integration name
- Click on your integration to add it to the page
- Confirm by clicking "Confirm"
Finding Your Notion Page ID
- Open your Notion page in a browser
- Copy the URL:
https://www.notion.so/workspace/Your-Page-1f5b8a8ba283... - The ID is the part after the last dash:
1f5b8a8ba283
3. Notion Implementation
The system uses SSE (Composio) for Notion integration:
# Notion MCP Server (SSE - Composio)
url="https://mcp.composio.dev/composio/server/61e41019-d05f-44d0-973e-2aef7777063a/sse?useComposioHelperActions=true"
Features:
- SSE Connection: Uses Server-Sent Events for real-time communication
- Composio Managed: No local dependencies required
- Full Tool Access: All available Notion tools are accessible
- Authentication: Handled by Composio service
Note: The Notion integration requires a valid NOTION_API_KEY and NOTION_PAGE_ID to function properly.
4. GitHub & Figma Implementation
The system uses separate SSE (Composio) servers for GitHub and Figma:
# GitHub MCP Server (SSE - Composio)
url="https://mcp.composio.dev/composio/server/11fbff47-fa12-432f-8c3a-18ed4e9f66f8/sse?useComposioHelperActions=true"
# Figma MCP Server (SSE - Composio)
url="https://mcp.composio.dev/composio/server/f05e7129-7997-4c17-a654-f935278c0dfe/sse?useComposioHelperActions=true"
Features:
- Separate Servers: Each service has its own dedicated Composio server
- Full Tool Access: All available GitHub and Figma tools are accessible
- No Local Dependencies: Managed by Composio service
2. Install Dependencies
pip install -r requirements.txt
3. Verify MCP Server Installation
# Verify npx is available
which npx
# Test filesystem MCP server
npx -y @modelcontextprotocol/server-filesystem --help
# Test Notion MCP server
npx -y @notionhq/notion-mcp-server --help
Usage
Basic Usage
import asyncio
from agent import EnterpriseKnowledgeOrchestrator
async def main():
# Create orchestrator
orchestrator = EnterpriseKnowledgeOrchestrator()
try:
# Process knowledge request
results = await orchestrator.process_knowledge_request(
"Analyze all PDF documents in my Documents folder and create GitHub issues for action items"
)
# Access results
print(f"Files analyzed: {len(results['file_analysis'])}")
print(f"Notion operations: {len(results['notion_operations'])}")
print(f"GitHub operations: {len(results['github_operations'])}")
print(f"Figma operations: {len(results['figma_operations'])}")
finally:
await orchestrator.close()
if __name__ == "__main__":
asyncio.run(main())
Example Requests
# Document analysis
"Analyze all PDF documents in my Documents folder and create a summary"
# Multi-platform operations
"Search for design components in my Figma files and create a GitHub repository for the design system"
# Notion and GitHub integration
"Read my Notion project page and create GitHub issues for all action items"
# Figma asset management
"Export design assets from Figma and organize them in a structured folder"
# Complex workflows
"Analyze quarterly reports, extract key metrics, create Notion dashboard, and set up GitHub issues for follow-ups"
Agent Routing Logic
The Router/Orchestrator agent intelligently routes tasks based on query analysis:
- File-related tasks → FileAnalysisAgent
- Notion-related tasks → NotionAgent
- GitHub-related tasks → GitHubAgent
- Figma-related tasks → FigmaAgent
- Multi-platform tasks → Coordinate between relevant agents
Configuration
MCP Server URLs
The system uses these MCP servers:
# Filesystem MCP Server (local)
command='npx'
args=["-y", "@modelcontextprotocol/server-filesystem", "~/Documents"]
# Notion MCP Server (SSE - Composio)
url="https://mcp.composio.dev/composio/server/61e41019-d05f-44d0-973e-2aef7777063a/sse?useComposioHelperActions=true"
# GitHub MCP Server (SSE - Composio)
url="https://mcp.composio.dev/composio/server/11fbff47-fa12-432f-8c3a-18ed4e9f66f8/sse?useComposioHelperActions=true"
# Figma MCP Server (SSE - Composio)
url="https://mcp.composio.dev/composio/server/f05e7129-7997-4c17-a654-f935278c0dfe/sse?useComposioHelperActions=true"
# No tool filtering - all available tools are accessible
Custom Filesystem Path
The system now supports configurable filesystem paths through environment variables:
# Set in .env file or export in terminal
export MCP_FILESYSTEM_PATH="/path/to/your/folder"
# Examples:
export MCP_FILESYSTEM_PATH="/Users/username/Projects"
export MCP_FILESYSTEM_PATH="/home/user/documents"
export MCP_FILESYSTEM_PATH="~/Desktop/Work"
Features:
- Flexible Paths: Use absolute or relative paths
- Auto-Expansion: Tilde (~) expansion for home directory
- Auto-Creation: Directory created if it doesn't exist
- Fallback: Defaults to
~/Documentsif not specified
Output Schemas
The system uses structured Pydantic models for consistent outputs:
FileAnalysis
{
"file_name": "quarterly_report.pdf",
"file_type": "PDF",
"summary": "Q3 financial performance analysis...",
"key_topics": ["revenue", "expenses", "growth"],
"action_items": ["Review budget allocation", "Update projections"]
}
NotionOperation
{
"operation_type": "read",
"page_id": "1f5b8a8ba283...",
"content_summary": "Project documentation read from Notion",
"status": "completed",
"results": {"content": "...", "blocks": [...]}
}
GitHubOperation
{
"operation_type": "create_issue",
"repository": "my-project",
"content_summary": "Created issue for design system documentation",
"status": "completed",
"results": {"issue_id": 123, "url": "..."}
}
FigmaOperation
{
"operation_type": "export",
"file_id": "figma_file_id",
"content_summary": "Exported design assets from Figma",
"status": "completed",
"results": {"assets": [...], "urls": [...]}
}
Context Sharing
The system implements intelligent context sharing between agents:
# Session state includes shared context
"shared_context": {
"current_task": user_request,
"agent_results": {},
"dependencies": []
}
# Agents can access and update shared context
updated_session.state["shared_context"]["agent_results"]["file_analysis"] = file_results
Error Handling
The system includes comprehensive error handling:
- MCP Connection Failures: Graceful fallback when servers are unavailable
- API Rate Limits: Automatic retry logic with exponential backoff
- Invalid Data: Validation and sanitization of inputs
- Session Management: Proper cleanup of resources
Monitoring and Logging
import logging
# Configure logging level
logging.basicConfig(level=logging.INFO)
# Monitor agent activities
logger.info("File analysis completed: 5 documents processed")
logger.warning("Notion API key not found, Notion integration disabled")
logger.error("Failed to create GitHub issue: rate limit exceeded")
Production Deployment
Environment Setup
# Production environment variables
export GOOGLE_API_KEY="your_production_key"
export NOTION_API_KEY="your_production_key"
export LOG_LEVEL="INFO"
Resource Management
# Proper cleanup in production
async with EnterpriseKnowledgeOrchestrator() as orchestrator:
results = await orchestrator.process_knowledge_request(request)
Scaling Considerations
- Use connection pooling for MCP servers
- Implement caching for frequently accessed documents
- Consider async processing for large document sets
- Monitor memory usage with large file operations
Troubleshooting
Common Issues
-
MCP Server Connection Failed
# Verify Node.js and npx installation node --version npx --version # Test filesystem MCP server manually npx -y @modelcontextprotocol/server-filesystem /path/to/documents # Test Notion MCP server manually npx -y @notionhq/notion-mcp-server -
Notion Integration Not Working
# Verify environment variables echo $NOTION_API_KEY # Test Notion connection curl -H "Authorization: Bearer $NOTION_API_KEY" \ -H "Notion-Version: 2022-06-28" \ https://api.notion.com/v1/users/me -
Composio MCP Server Issues
# Test Composio MCP server connection curl "https://mcp.composio.dev/composio/server/f05e7129-7997-4c17-a654-f935278c0dfe/sse?useComposioHelperActions=true" -
Permission Denied for Documents
# Check file permissions ls -la ~/Documents # Update permissions if needed chmod 755 ~/Documents
Debug Mode
# Enable debug logging
logging.basicConfig(level=logging.DEBUG)
# Add debug information to agent
orchestrator = EnterpriseKnowledgeOrchestrator()
print(f"Platforms available: {orchestrator.session_service.get_session(...).state['platforms_available']}")
Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.