MCP HubMCP Hub
mcpagents-ai

mcpagentai

by: mcpagents-ai

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

17created 06/01/2025
Visit
Python
SDK

๐Ÿ“ŒOverview

Purpose: MCPAgentAI aims to provide a standardized framework for integrating and managing various tools, allowing developers to efficiently create and deploy tool-based use cases.

Overview: MCPAgentAI is a tool wrapping framework that simplifies the process of incorporating multiple tools into applications using the Model Context Protocol (MCP). It fosters quick adoption and automation in diverse tasks, enhancing productivity and interoperability among AI models.

Key Features:

  • Standardized Wrapping: Offers an abstraction layer that standardizes tool implementation through the MCP protocol, enhancing compatibility and ease of use.

  • Flexible Use Cases: Provides the ability to effortlessly add or remove tools based on specific project needs, ensuring adaptability.

  • Out-of-the-Box Tools: Comes with pre-built tools for various functions such as Twitter management, cryptocurrency price tracking, weather information, and more, facilitating rapid deployment for common scenarios.


MCPAgentAI ๐Ÿš€

PyPI
Python Versions
License

MCPAgentAI is a standardized tool wrapping framework for implementing and managing diverse tools in a unified way. It helps 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:
    • ๐Ÿฆ Twitter Management: Automate tweeting, replying, and managing Twitter interactions.
    • ๐Ÿ’ธ Crypto: Get the latest cryptocurrency prices.
    • ๐Ÿค– ElizaOS Integration: 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.
    • ๐Ÿ“ฐ News (Work in Progress): 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 standard for context sharing and management across AI models and systemsโ€”a language AI agents use to interact seamlessly.

Why MCP matters:

  • ๐Ÿงฉ Standardization: Enables interoperability by defining how context is shared.
  • โšก Scalability: Handles large-scale AI systems with high throughput.
  • ๐Ÿ”’ Security: Robust authentication and fine-grained access control.
  • ๐ŸŒ Flexibility: Works across diverse systems and AI architectures.

More about MCP: modelcontextprotocol.io/introduction


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 supports automating tweeting, replying, and managing Twitter interactions.

Docker Environment Variables for Twitter Integration

Configure these environment variables when running MCPAgentAI in Docker:

1. Agent Node Client Credentials

Used by the Node.js client within the agent:

TWITTER_USERNAME=
TWITTER_PASSWORD=
TWITTER_EMAIL=

2. Tweepy (Twitter API v2) Credentials

Used for Twitter API v2 interactions:

TWITTER_API_KEY=
TWITTER_API_SECRET=
TWITTER_ACCESS_TOKEN=
TWITTER_ACCESS_SECRET=
TWITTER_CLIENT_ID=
TWITTER_CLIENT_SECRET=
TWITTER_BEARER_TOKEN=

Running MCPAgentAI with .env + scripts/run_agent.sh

Create a .env file in your project root with:

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 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

Then run:

chmod +x scripts/run_agent.sh
bash scripts/run_agent.sh

ElizaOS Integration ๐Ÿค–

MCPAgentAI integrates with ElizaOS for enhanced automation via Eliza Agents.

1. Use Eliza Agents Directly in MCPAgentAI

Embed Eliza functionality without running the Eliza Framework separately:

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
])

2. Run Eliza Framework as a Background Process

Start Eliza Framework separately:

bash src/mcpagentai/tools/eliza/scripts/run.sh
bash src/mcpagentai/tools/eliza/scripts/monitor.sh

Then configure MCPAgentAI with:

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

Only run selected tools by configuring the agents in your server or server.py file:

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()
])

Integration Example: Claude Desktop Configuration

Example claude_desktop_config.json to run MCPAgentAI via Docker:

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

Development ๐Ÿ› ๏ธ

  1. Clone the repository:
    git clone https://github.com/mcpagents-ai/mcpagentai.git
    cd mcpagentai
    
  2. (Optional) Create and activate 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 ๐Ÿค

Contributions welcome! Please open an issue or pull request on the GitHub repository.


License: MIT
Enjoy! ๐ŸŽ‰