Skip to content

ppijbb/mcp_agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

614 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

MCP Agent System

A comprehensive multi-agent system for enterprise automation and intelligence, featuring basic agents for simple tasks and sophisticated enterprise-level agents for complex business automation.

โœ… What's New (Current Version)

  • Stronger agentic prompts across the stack (directive tone, JSON-only outputs, explicit schemas)
  • NO FALLBACK policy enforced for LLM calls and workflows (fail fast on misconfiguration)
  • External MCP server integration via environment variables (OpenAPI, Oracle, Alpaca, Finnhub, Polygon, EDGAR, CoinStats, etc.)
  • Financial LangGraph workflow with multi-node pipeline (collector โ†’ analyzer โ†’ strategist โ†’ portfolio โ†’ trader โ†’ auditor)
  • Concurrent MCP calls for batch ticker processing
  • Strict output validation for goal setting and investment plans

๐Ÿ“ Project Structure

srcs/
โ”œโ”€โ”€ common/                 # ๐Ÿ”ง Common modules and shared resources
โ”‚   โ”œโ”€โ”€ __init__.py        # Unified module entry point
โ”‚   โ”œโ”€โ”€ imports.py         # Standardized imports and dependencies
โ”‚   โ”œโ”€โ”€ config.py          # Shared configurations and constants
โ”‚   โ”œโ”€โ”€ utils.py           # Common utility functions
โ”‚   โ””โ”€โ”€ templates.py       # Agent base templates and patterns
โ”œโ”€โ”€ basic_agents/           # Simple, lightweight agents
โ”‚   โ”œโ”€โ”€ basic.py           # Basic functionality and testing
โ”‚   โ”œโ”€โ”€ agent.py           # Base Agent class
โ”‚   โ”œโ”€โ”€ swarm.py           # Multi-agent coordination
โ”‚   โ”œโ”€โ”€ workflow_orchestration.py # Workflow management
โ”‚   โ”œโ”€โ”€ researcher.py      # Research and information gathering
โ”‚   โ”œโ”€โ”€ researcher_v2.py   # Enhanced research agent (using common modules)
โ”‚   โ”œโ”€โ”€ parallel.py        # Parallel processing demonstration
โ”‚   โ”œโ”€โ”€ streamlit_agent.py # Web interface agent
โ”‚   โ”œโ”€โ”€ data_generator.py  # Data generation and synthesis
โ”‚   โ”œโ”€โ”€ enhanced_data_generator.py # Advanced data generation
โ”‚   โ””โ”€โ”€ rag_agent.py       # Retrieval-Augmented Generation
โ”œโ”€โ”€ enterprise_agents/      # Sophisticated business automation
โ”‚   โ”œโ”€โ”€ mental.py          # Mental model analysis
โ”‚   โ”œโ”€โ”€ hr_recruitment_agent.py              # HR & Talent Acquisition
โ”‚   โ”œโ”€โ”€ legal_compliance_agent.py            # Legal & Regulatory Compliance
โ”‚   โ”œโ”€โ”€ cybersecurity_infrastructure_agent.py # Security & Threat Detection
โ”‚   โ”œโ”€โ”€ supply_chain_orchestrator_agent.py   # Supply Chain Optimization
โ”‚   โ”œโ”€โ”€ customer_lifetime_value_agent.py     # Customer Experience & CLV
โ”‚   โ”œโ”€โ”€ esg_carbon_neutral_agent.py         # ESG & Sustainability
โ”‚   โ”œโ”€โ”€ hybrid_workplace_optimizer_agent.py  # Workplace Optimization
โ”‚   โ””โ”€โ”€ product_innovation_accelerator_agent.py # Innovation & Development
โ”œโ”€โ”€ utils/                  # Additional utilities
โ”‚   โ””โ”€โ”€ mental_visualization.py # Interactive visualization
โ”œโ”€โ”€ run_agent.py           # Unified execution script
โ””โ”€โ”€ COMMON_MODULES.md      # Common modules usage guide

Additional Modules

lang_graph/
โ””โ”€โ”€ financial_agent/
    โ”œโ”€โ”€ agents/
    โ”‚   โ”œโ”€โ”€ auditor.py
    โ”‚   โ”œโ”€โ”€ chief_strategist.py
    โ”‚   โ”œโ”€โ”€ data_collector.py
    โ”‚   โ”œโ”€โ”€ news_analyzer.py
    โ”‚   โ”œโ”€โ”€ news_collector.py
    โ”‚   โ”œโ”€โ”€ portfolio_manager.py
    โ”‚   โ”œโ”€โ”€ sync_node.py
    โ”‚   โ””โ”€โ”€ trader.py
    โ”œโ”€โ”€ financial_mcp_server.py    # MCP tools for technical indicators/news via yfinance
    โ”œโ”€โ”€ graph.py                   # LangGraph workflow (includes entrypoint)
    โ”œโ”€โ”€ llm_client.py              # Gemini LLM client (NO FALLBACK)
    โ”œโ”€โ”€ mcp_client.py              # Parallel MCP tool invocation utilities
    โ”œโ”€โ”€ external_mcp.py            # Note: Automation service uses its own external MCP registrar
    โ””โ”€โ”€ state.py                   # Type definitions and state schema

srcs/
โ””โ”€โ”€ multi_agent_automation_service/
    โ”œโ”€โ”€ orchestrator.py            # Multi-agent orchestration (auto-register external MCP servers)
    โ”œโ”€โ”€ gemini_executor.py         # Gemini CLI executor (agentic, MCP-based)
    โ”œโ”€โ”€ external_mcp.py            # Env-var driven registrar for external MCP servers
    โ””โ”€โ”€ agents/ ...                # code review/documentation/performance/security/K8s agents

srcs/
โ””โ”€โ”€ goal_setter_agent/
    โ””โ”€โ”€ goal_setter.py             # Decomposes high-level goals into a JSON plan (strict schema + validation)

๐Ÿš€ Installation

  1. Clone the repository

  2. Install dependencies:

    pip install -r requirements.txt
  3. Configure API keys:

    • Create mcp_agent.secrets.yaml file in the srcs directory
    • Add your API keys for OpenAI and Google:
      openai:
        api_key: your-openai-api-key
      google:
        api_key: your-google-api-key
  4. Optional: Gemini (for financial_agent) and External MCP servers

    • Environment variables (examples):

      # LLM
      export GEMINI_API_KEY="your-gemini-api-key"
      export GEMINI_MODEL="gemini-2.5-flash-lite-preview-0607"
      
      # External MCP servers (OpenAPI wrapper, Oracle, Brokers, Market Data, Filings, Crypto)
      export OPENAPI_MCP_CMD=node
      export OPENAPI_MCP_ARGS="/opt/mcp/openapi-server.js --spec /opt/specs/polygon.yaml --apiKey $POLYGON_API_KEY"
      
      export ORACLE_MCP_CMD=python
      export ORACLE_MCP_ARGS="/opt/mcp/oracle_mcp_server.py --tns $TNS --user $DB_USER --pass $DB_PASS"
      
      export ALPACA_MCP_CMD=node
      export ALPACA_MCP_ARGS="/opt/mcp/openapi-server.js --spec /opt/specs/alpaca.yaml --apiKey $ALPACA_KEY --secret $ALPACA_SECRET"
      
      export FINNHUB_MCP_CMD=node
      export FINNHUB_MCP_ARGS="/opt/mcp/openapi-server.js --spec /opt/specs/finnhub.yaml --apiKey $FINNHUB_KEY"
      
      export POLYGON_MCP_CMD=node
      export POLYGON_MCP_ARGS="/opt/mcp/openapi-server.js --spec /opt/specs/polygon.yaml --apiKey $POLYGON_API_KEY"
      
      export EDGAR_MCP_CMD=node
      export EDGAR_MCP_ARGS="/opt/mcp/openapi-server.js --spec /opt/specs/secapi.yaml --apiKey $SEC_API_KEY"
      
      export COINSTATS_MCP_CMD=node
      export COINSTATS_MCP_ARGS="/opt/mcp/openapi-server.js --spec /opt/specs/coinstats.yaml --apiKey $COINSTATS_API_KEY"
    • Optional per-server settings:

      • <NAME>_MCP_TIMEOUT_MS (default: 30000)
      • <NAME>_MCP_TRUST (true|false, default: true)
      • <NAME>_MCP_ENV_JSON (JSON string for additional env)

๐ŸŽฏ Running Agents

Using the Unified Runner (Recommended)

Navigate to the srcs directory and use the unified runner:

cd srcs

# List all available agents
python run_agent.py --list

# Run basic agents
python run_agent.py --basic researcher
python run_agent.py --basic researcher_v2    # Enhanced with common modules
python run_agent.py --basic data_generator
python run_agent.py --basic rag

# Run enterprise agents
python run_agent.py --enterprise supply_chain
python run_agent.py --enterprise customer_clv
python run_agent.py --enterprise workplace
python run_agent.py --enterprise personal_finance

# Run utilities
python run_agent.py --utility mental
python run_agent.py --utility swarm

# Development examples
python run_agent.py --dev common_demo         # Common modules demo
python run_agent.py --dev template_basic      # Basic agent template
python run_agent.py --dev template_enterprise # Enterprise agent template

Financial Agent Workflow (LangGraph)

# Run the LangGraph workflow (prints summary to stdout)
python lang_graph/financial_agent/graph.py

# Start the financial MCP server (technical indicators & news via yfinance)
python lang_graph/financial_agent/financial_mcp_server.py
  • Workflow nodes: market_data_collector โ†’ news_collector โ†’ sync โ†’ news_analyzer (LLM) โ†’ chief_strategist (LLM) โ†’ portfolio_manager (LLM) โ†’ trader โ†’ auditor
  • Prompts are agentic, JSON-only where required; NO FALLBACK in LLM client (llm_client.py).
  • External sources can be added via environment-driven MCP servers (registered automatically in the automation service; financial graph uses its own mcp_client).

Direct Execution

You can also run agents directly:

cd srcs

# Basic agents
python basic_agents/researcher.py
python basic_agents/researcher_v2.py    # New enhanced version
python basic_agents/data_generator.py

# Enterprise agents  
python enterprise_agents/supply_chain_orchestrator_agent.py
python enterprise_agents/customer_lifetime_value_agent.py

# Utilities
python enterprise_agents/mental.py

Multi-Agent Automation Service

# Full automation
python -m srcs.multi_agent_automation_service.main --workflow full --target srcs

# Kubernetes workflow
python -m srcs.multi_agent_automation_service.main --workflow kubernetes --app-name myapp --config-path k8s/

# Single agent
python -m srcs.multi_agent_automation_service.main --agent code_review --target srcs
  • On start, the service will auto-register external MCP servers present in env (openapi, oracle, alpaca, finnhub, polygon, edgar, coinstats).
  • gemini_executor.py executes Gemini CLI tasks through MCP tools; instructions are strict and agentic.
  • All MCP calls use concurrency where applicable.

Goal Setter Agent

python -m srcs.goal_setter_agent.goal_setter --goal "Improve conversion rate of new SaaS feature by 20%"
  • Output is a strict JSON plan (Korean text allowed) with SMART sub-goals, KPIs (name/metric/target/data_source), actions (agent, due_days, acceptance_criteria), risks, and overall_success_criteria.
  • A validator enforces schema and domain constraints; invalid outputs raise errors (no fallback).

๐Ÿ”ง Common Modules System

The new common modules system provides shared functionality for efficient agent development:

Key Benefits

  • 50-70% faster development with standardized templates
  • Code reusability and consistency across all agents
  • Standardized patterns for imports, configuration, and utilities
  • Quality assurance with built-in best practices

Quick Start with Templates

Create a new basic agent:

from common import BasicAgentTemplate

class MyAgent(BasicAgentTemplate):
    def __init__(self):
        super().__init__(
            agent_name="my_agent",
            task_description="Your agent's task description"
        )

Create a new enterprise agent:

from common import EnterpriseAgentTemplate

class MyEnterpriseAgent(EnterpriseAgentTemplate):
    def __init__(self):
        super().__init__(
            agent_name="my_enterprise_agent",
            business_scope="Global Operations"
        )

See COMMON_MODULES.md for comprehensive usage guide and examples.

๐Ÿ“ Available Agents

Basic Agents

  • researcher - Research and information gathering
  • researcher_v2 - Enhanced research agent using common modules
  • basic - Basic functionality and testing
  • parallel - Parallel processing demonstration
  • swarm - Multi-agent swarm coordination
  • streamlit - Web interface agent
  • workflow - Workflow orchestration and management
  • data_generator - Data generation and synthesis
  • enhanced_data_generator - Advanced data generation with ML
  • rag - Retrieval-Augmented Generation

Enterprise Agents

  • hr_recruitment - HR recruitment and talent acquisition automation
  • mental - Mental model analysis and visualization
  • legal_compliance - Legal compliance and contract analysis
  • cybersecurity - Cybersecurity infrastructure and threat detection
  • supply_chain - Supply chain orchestration and optimization
  • customer_clv - Customer lifetime value and experience optimization
  • esg_carbon - ESG and carbon neutrality management
  • workplace - Hybrid workplace optimization and management
  • innovation - Product innovation acceleration and development
  • personal_finance - Personal finance health diagnosis & auto investment (Korean market)

Utilities

  • mental_viz - Mental model interactive visualization

Advanced Agents

  • decision_agent - ๐Ÿค– Mobile interaction-based automatic decision system
  • architect - AI architecture design and optimization

Development Tools

  • common_demo - Common modules demonstration
  • template_basic - Basic agent template example
  • template_enterprise - Enterprise agent template example

๐Ÿ’ผ Enterprise Features

The enterprise agents provide comprehensive business automation with:

  • ROI-Focused Solutions: Each agent targets 200-600% ROI through measurable improvements
  • Industry Standards: Compliance with frameworks like GDPR, SOX, HIPAA, SASB, GRI
  • Scalable Architecture: Multi-agent orchestration with quality control systems
  • Real-time Analytics: Performance monitoring and continuous optimization
  • Integration Ready: API-first design for enterprise system integration

๐Ÿ”’ Security & Compliance Posture

  • NO FALLBACK policy: Misconfigured API keys or LLM failures raise explicit errors instead of returning placeholder data.
  • External MCP servers are configured via explicit env vars; trust/timeouts can be tuned per server.
  • Audit trail: Financial workflow writes a daily report via auditor.py.
  • Secrets via environment variables or dedicated secret files; do not hardcode keys.

โš™๏ธ Configuration Quick Reference

  • LLM
    • OPENAI_API_KEY (for OpenAI-based components)
    • GEMINI_API_KEY, GEMINI_MODEL (for Gemini-based components)
  • Financial MCP Server (built-in)
    • Run with python lang_graph/financial_agent/financial_mcp_server.py
  • External MCP (automation service auto-registers)
    • <NAME>_MCP_CMD, <NAME>_MCP_ARGS required
    • Optional: <NAME>_MCP_TIMEOUT_MS, <NAME>_MCP_TRUST, <NAME>_MCP_ENV_JSON

๐Ÿ”ง Requirements

  • Python 3.8+
  • Docker (for Python interpreter functionality)
  • OpenAI API key
  • Google API key (optional, for enhanced search capabilities)

๐Ÿค– Decision Agent - Revolutionary Mobile Decision System

The Decision Agent represents a breakthrough in personal AI assistance, offering unprecedented intervention capabilities in daily mobile interactions:

๐ŸŽฏ Core Capabilities

  • Real-time Mobile Monitoring: 24/7 detection of all mobile interactions (purchases, calls, messages, bookings)
  • Context-Aware Analysis: Deep understanding of user situation, preferences, and constraints
  • Intelligent Intervention: Smart threshold-based decision on when to intervene
  • Personalized Recommendations: Tailored decisions based on individual user profiles and goals
  • Automated Execution: High-confidence decisions can be executed automatically
  • Continuous Learning: Improves decision quality through user feedback

๐Ÿš€ Key Features

  • Multi-App Integration: Works across shopping, food delivery, booking, communication apps
  • Risk Assessment: Evaluates financial, health, and opportunity risks for each decision
  • Alternative Analysis: Provides multiple options with pros/cons analysis
  • Budget Management: Real-time budget tracking with spending optimization
  • Mood-Aware: Adapts recommendations based on detected user emotional state
  • Time-Sensitive: Prioritizes urgent decisions with appropriate response times

๐Ÿ’ก Use Cases

  1. Smart Shopping: Prevents impulse purchases, finds better deals, suggests alternatives
  2. Health Optimization: Guides food choices based on health goals and dietary preferences
  3. Financial Management: Optimizes spending patterns and investment decisions
  4. Time Management: Helps prioritize calls, messages, and meetings
  5. Travel Planning: Optimizes booking decisions for cost and convenience

๐Ÿ”ง Technical Architecture

# Example Decision Agent Usage
from srcs.advanced_agents.decision_agent import DecisionAgent

agent = DecisionAgent(anthropic_api_key="your-key")
await agent.start_monitoring("user_id")

# Agent automatically intervenes when significant decisions are detected
# Provides real-time recommendations through push notifications

๐Ÿ“Š Demo Results

  • 89.5% Decision Accuracy: High-quality recommendations validated by user feedback
  • 76.8% User Acceptance Rate: Users follow agent recommendations majority of time
  • 1.2s Average Response Time: Near-instantaneous decision generation
  • $500+ Monthly Savings: Average cost savings through optimized decisions

๐ŸŽฎ Try It Now

# Run interactive demo
python srcs/advanced_agents/decision_agent_demo.py

# Or use the web interface
streamlit run main.py
# Navigate to "๐Ÿค– Decision Agent" page

๐Ÿ“Š Business Impact

Enterprise agents deliver measurable business value:

  • Supply Chain: 15-30% cost reduction, 25-40% delivery improvement
  • Customer CLV: 25-40% retention improvement, 10-25% CLV increase
  • ESG Management: Carbon neutrality achievement, 40-60% ESG rating improvement
  • Workplace Optimization: 30-50% productivity improvement, 25-40% cost reduction
  • Innovation Acceleration: 40-60% time-to-market reduction, 50-75% success rate improvement
  • ๐Ÿค– Decision Agent: $500+ monthly savings per user, 25% reduction in poor decisions

๐Ÿš€ Development with Common Modules

The common modules system enables rapid agent development:

  1. Choose Template: Select BasicAgentTemplate or EnterpriseAgentTemplate
  2. Import Common: Use from common import * for all dependencies
  3. Implement Methods: Override required methods for your specific logic
  4. Run and Test: Use the unified runner for execution and testing

Example development workflow:

# Explore common modules
python run_agent.py --dev common_demo

# See template examples
python run_agent.py --dev template_basic

# Test existing enhanced agent
python run_agent.py --basic researcher_v2

# Create your own agent using the patterns

For detailed documentation on individual agents and their capabilities, refer to the agent-specific files and COMMON_MODULES.md for development guidelines.

MCP Agent Hub - Agent UI

Directory Structure

mcp_agent/
โ”œโ”€โ”€ main.py                    # Streamlit main app
โ”œโ”€โ”€ pages/                     # Streamlit pages
โ”‚   โ”œโ”€โ”€ business_strategy.py
โ”‚   โ”œโ”€โ”€ seo_doctor.py
โ”‚   โ”œโ”€โ”€ finance_health.py
โ”‚   โ”œโ”€โ”€ cybersecurity.py
โ”‚   โ”œโ”€โ”€ data_generator.py
โ”‚   โ”œโ”€โ”€ hr_recruitment.py
โ”‚   โ”œโ”€โ”€ ai_architect.py
โ”‚   โ”œโ”€โ”€ decision_agent.py
โ”‚   โ”œโ”€โ”€ travel_scout.py
โ”‚   โ”œโ”€โ”€ workflow.py
โ”‚   โ”œโ”€โ”€ research.py
โ”‚   โ””โ”€โ”€ rag_agent.py
โ”œโ”€โ”€ srcs/                      # source code
โ”‚   โ”œโ”€โ”€ ...                    # agent code
โ”‚   โ””โ”€โ”€ ...                    # ...
โ””โ”€โ”€ configs/                   # configuration

How to Run

Run the main app

streamlit run main.py

Run specific agent pages

# Business strategy agent
cd srcs/business_strategy_agents
streamlit run streamlit_app.py

# SEO Doctor
cd srcs/seo_doctor  
streamlit run seo_doctor_app.py

Roadmap

  1. Mobile UI optimization (responsive design)
  2. Dark mode improvements
  3. Performance optimization (loading time)
  4. Full integration with production agents
  5. User authentication and personalization

Development Guidelines

  1. Prefer common modules for new features
  2. Maintain consistency with existing patterns and style guides
  3. Robust error handling; avoid fallbacks that mask failures
  4. Keep docs up-to-date with feature changes
  5. Test across environments

AI CLI Tools

1. Gemini CLI

Overview: Googleโ€™s AI development CLI to interact with Gemini models for code generation, debugging, and docs. Reference: Gemini CLI

Install:

npx https://github.com/google-gemini/gemini-cli

Key features:

  • Code generation and debugging
  • File I/O
  • Web/search integration
  • System command execution

Example:

gemini > Write Python code using turtle to draw a blue circle with radius 100.

2. Claude CLI

Overview: Anthropicโ€™s AI CLI for code generation/refactoring/testing via natural language.

Install:

npm install -g @anthropic/claude-cli

Key features:

  • Natural language code generation/modification
  • Code quality and style checks
  • Test generation

Example:

claude > Refactor the following JavaScript function to improve readability.

3. Cursor CLI

Overview: Cursor editorโ€™s CLI for code changes, review, and generation. Reference: Cursor CLI

Install:

curl https://cursor.com/install -fsS | bash

Key features:

  • Review/apply code changes
  • Real-time agent directives
  • Custom rule configuration

Example:

cursor > Review agent edits

About

toward business agent

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages