Agentai
    Agentai

    Agentai

    Python SDK designed to simplify interactions with MCP (Model Context Protocol) servers. It provides an easy-to-use interface for connecting to MCP servers, reading resources, and calling tools

    4.3

    GitHub Stats

    Stars

    21

    Forks

    3

    Release Date

    5/3/2025

    about 2 months ago

    Detailed Description

    mcpagentai 🚀

    pypi python versions license

    mcpagentai is a standardized tool wrapping framework for implementing and managing diverse tools in a unified way. it is designed to help developers quickly integrate and launch tool-based use cases.

    key features

    • 🔧 standardized wrapping: provides an abstraction layer for building tools using the mcp protocol.
    • 🚀 flexible use cases: easily add or remove tools to fit your specific requirements.
    • out-of-the-box tools: includes pre-built tools for common scenarios:
      • 🐦 twitter management: automate tweeting, replying, and managing twitter interactions.
      • 💸 crypto: get the latest cryptocurrency prices.
      • 🤖 elizaos integration: seamlessly connect and interact with elizaos for enhanced automation.
      • 🕑 time utilities
      • ☁️ weather information (api)
      • 📚 dictionary lookups
      • 🧮 calculator for mathematical expressions
      • 💵 currency exchange (api)
      • 📈 stocks data: access real-time and historical stock market information.
      • [wip] 📰 news: retrieve the latest news headlines.

    tech stack 🛠️

    • python: core programming language
    • mcp framework: communication protocol
    • docker: containerization

    🤔 what is mcp?

    the model context protocol (mcp) is a cutting-edge standard for context sharing and management across ai models and systems. think of it as the language ai agents use to interact seamlessly. 🧠✨

    here’s why mcp matters:

    • 🧩 standardization: mcp defines how context can be shared across models, enabling interoperability.
    • scalability: it’s built to handle large-scale ai systems with high throughput.
    • 🔒 security: robust authentication and fine-grained access control.
    • 🌐 flexibility: works across diverse systems and ai architectures.

    mcp_architecture source

    installation 📦

    install via pypi

    pip install mcpagentai
    

    usage 💻

    run locally

    mcpagentai --local-timezone "america/new_york"
    

    run in docker

    1. build the docker image: docker build -t mcpagentai .

    2. run the container: docker run -i --rm mcpagentai


    twitter integration 🐦

    mcpagentai offers robust twitter integration, allowing you to automate tweeting, replying, and managing twitter interactions. this section provides detailed instructions on configuring and using the twitter integration, both via docker and .env + scripts/run_agent.sh.

    docker environment variables for twitter integration

    when running mcpagentai within docker, it's essential to configure environment variables for twitter integration. these variables are divided into two categories:

    1. agent node client credentials

    these credentials are used by the node.js client within the agent for managing twitter interactions.

    env twitter_username=
    env twitter_password=
    env twitter_email=
    

    2. tweepy (twitter api v2) credentials

    these credentials are utilized by tweepy for interacting with twitter's api v2.

    env twitter_api_key=
    env twitter_api_secret=
    env twitter_access_token=
    env twitter_access_secret=
    env twitter_client_id=
    env twitter_client_secret=
    env twitter_bearer_token=
    

    running mcpagentai with docker

    1. build the docker image:

      docker build -t mcpagentai .
      
    2. run the container:

      docker run -i --rm mcpagentai
      

    running mcpagentai with .env + scripts/run_agent.sh

    setting up environment variables

    create a .env file in the root directory of your project and add the following environment variables:

    anthropic_api_key=your_anthropic_api_key
    eliza_path=/path/to/eliza
    twitter_username=your_twitter_username
    twitter_email=your_twitter_email
    twitter_password=your_twitter_password
    personality_config=/path/to/personality_config.json
    run_agent=true
    
    # tweepy (twitter api v2) credentials
    twitter_api_key=your_twitter_api_key
    twitter_api_secret=your_twitter_api_secret
    twitter_access_token=your_twitter_access_token
    twitter_access_secret=your_twitter_access_secret
    twitter_client_id=your_twitter_client_id
    twitter_client_secret=your_twitter_client_secret
    twitter_bearer_token=your_twitter_bearer_token
    

    running the agent

    1. make the script executable:

      chmod +x scripts/run_agent.sh
      
    2. run the agent:

      bash scripts/run_agent.sh
      

    summary

    you can configure mcpagentai to run with twitter integration either using docker or by setting up environment variables in a .env file and running the scripts/run_agent.sh script.

    this flexibility allows you to choose the method that best fits your deployment environment.


    elizaos integration 🤖

    mcpagentai offers seamless integration with elizaos, providing enhanced automation capabilities through eliza agents. there are two primary ways to integrate eliza agents:

    1. directly use eliza agents from mcpagentai

    this approach allows you to use eliza agents without running the eliza framework in the background. it simplifies the setup by embedding eliza functionality directly within mcpagentai.

    steps:

    1. configure mcpagentai to use eliza mcp agent: in your python code, add eliza mcp agent to the multitoolagent:
      from mcpagentai.core.multi_tool_agent import multitoolagent
      from mcpagentai.tools.eliza_mcp_agent import eliza_mcp_agent
      
      multi_tool_agent = multitoolagent([
          # ... other agents
          eliza_mcp_agent
      ])
      

    advantages:

    • simplified setup: no need to manage separate background processes.
    • easier monitoring: all functionalities are encapsulated within mcpagentai.
    • highlight feature: emphasizes the flexibility of mcpagentai in integrating various tools seamlessly.

    2. run eliza framework from mcpagentai

    this method involves running the eliza framework as a separate background process alongside mcpagentai.

    steps:

    1. start eliza framework: bash src/mcpagentai/tools/eliza/scripts/run.sh

    2. monitor eliza processes: bash src/mcpagentai/tools/eliza/scripts/monitor.sh

    3. configure mcpagentai to use eliza agent: in your python code, add eliza agent to the multitoolagent:

      from mcpagentai.core.multi_tool_agent import multitoolagent
      from mcpagentai.tools.eliza_agent import eliza_agent
      
      multi_tool_agent = multitoolagent([
         # ... other agents
         eliza_agent
      ])
      

    tutorial: selecting specific tools

    you can configure mcpagentai to run only certain tools by modifying the agent configuration in your server or by updating the server.py file to only load desired agents. for example:

    from mcpagentai.tools.time_agent import timeagent
    from mcpagentai.tools.weather_agent import weatheragent
    from mcpagentai.core.multi_tool_agent import multitoolagent
    
    multi_tool_agent = multitoolagent([
        timeagent(),
        weatheragent()
    ])
    this setup will only enable **time** and **weather** tools.
    

    integration example: claude desktop configuration

    you can integrate mcpagentai with claude desktop using the following configuration (claude_desktop_config.json), note that local elizaos repo is optional arg:

    {
        "mcpservers": {
            "mcpagentai": {
                "command": "docker",
                "args": ["run", "-i", "-v", "/path/to/local/eliza:/app/eliza", "--rm", "mcpagentai"]
            }
        }
    }
    

    development 🛠️

    1. clone this repository:

      git clone https://github.com/mcpagents-ai/mcpagentai.git
      cd mcpagentai
      
    2. (optional) create a virtual environment:

      python3 -m venv .venv
      source .venv/bin/activate
      
    3. install dependencies:

      pip install -e .
      
    4. build the package:

      python -m build
      

    contributing 🤝

    we welcome contributions! please open an issue or pull request.


    license: mit
    enjoy! 🎉

    Star History

    Star History

    Jan 6Jan 12Jan 15Jan 23Feb 12Feb 28Mar 16Apr 29Jun 2006121824
    Powered by MSeeP Analytics

    About the Project

    This app has not been claimed by its owner yet.

    Claim Ownership

    Receive Updates

    Security Updates

    Get notified about trust rating changes

    to receive email notifications.