agent-mcp 0.1.2__py3-none-any.whl → 0.1.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,46 @@
1
+ """
2
+ Enhanced MCP Transport Layer with transaction support.
3
+ """
4
+
5
+ from .mcp_transport import MCPTransport, HTTPTransport
6
+ from .mcp_transaction import MCPTransaction, MCPPayment
7
+ from typing import Dict, Any, Optional
8
+
9
+ class TransactionalHTTPTransport(HTTPTransport):
10
+ """HTTP transport with transaction support"""
11
+
12
+ def __init__(self, *args, **kwargs):
13
+ super().__init__(*args, **kwargs)
14
+ self.transaction_manager = MCPTransaction()
15
+ self.payment_manager = MCPPayment()
16
+
17
+ async def send_message(self, target: str, message: Dict[str, Any]) -> Dict[str, Any]:
18
+ """Send a message with transaction support"""
19
+ # Start transaction
20
+ transaction_id = await self.transaction_manager.begin_transaction(
21
+ sender=self.agent_name,
22
+ receiver=target,
23
+ metadata={"message_type": message.get("type")}
24
+ )
25
+
26
+ try:
27
+ # Process any payments if needed
28
+ if "payment" in message:
29
+ payment_id = await self.payment_manager.process_payment(
30
+ sender=self.agent_name,
31
+ receiver=target,
32
+ amount=message["payment"]["amount"]
33
+ )
34
+ message["payment"]["id"] = payment_id
35
+
36
+ # Send the message
37
+ result = await super().send_message(target, message)
38
+
39
+ # Commit transaction
40
+ await self.transaction_manager.commit_transaction(transaction_id)
41
+ return result
42
+
43
+ except Exception as e:
44
+ # Rollback on failure
45
+ await self.transaction_manager.rollback_transaction(transaction_id)
46
+ raise e
@@ -0,0 +1,24 @@
1
+ """Proxy agent that can discover and represent remote agents."""
2
+
3
+ from typing import Optional
4
+ from agent_mcp.enhanced_mcp_agent import EnhancedMCPAgent
5
+ from agent_mcp.mcp_transport import HTTPTransport
6
+
7
+ class ProxyAgent(EnhancedMCPAgent):
8
+ """A proxy that represents a remote agent in the local group."""
9
+
10
+ async def connect_to_remote_agent(self, agent_name: str, server_url: str) -> bool:
11
+ """Connect to a remote agent and copy its capabilities."""
12
+ try:
13
+ # Create transport for remote connection
14
+ self.transport = HTTPTransport.from_url(server_url, agent_name=self.name)
15
+
16
+ # Connect to remote agent
17
+ await self.connect_to_server(f"{server_url}/agents/{agent_name}")
18
+
19
+ # Copy capabilities from remote agent
20
+ self.capabilities = self.connected_agents.get(agent_name, [])
21
+ return True
22
+ except Exception as e:
23
+ print(f"Error connecting to remote agent {agent_name}: {e}")
24
+ return False
@@ -0,0 +1,331 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-mcp
3
+ Version: 0.1.3
4
+ Summary: A bridge agent to enable agents with Model Context Protocol capabilities to be added to a Multi-agent Collaboration Network (MCN) to run on a Multi-agent Collaboration Platform (MCP)
5
+ Home-page: https://github.com/grupa-ai/agent-mcp
6
+ Author: GrupaAI
7
+ License: MIT
8
+ Project-URL: Homepage, https://github.com/grupa-ai/agent-mcp
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Requires-Python: >=3.11
16
+ Description-Content-Type: text/markdown
17
+ Requires-Dist: autogen
18
+ Requires-Dist: langchain
19
+ Requires-Dist: langchain-openai
20
+ Requires-Dist: langchain-community
21
+ Requires-Dist: crewai>=0.11.0
22
+ Requires-Dist: langgraph>=0.0.15
23
+ Requires-Dist: openai>=1.12.0
24
+ Requires-Dist: fastapi==0.104.1
25
+ Requires-Dist: uvicorn==0.24.0
26
+ Requires-Dist: sse-starlette==1.8.2
27
+ Requires-Dist: firebase-admin==6.4.0
28
+ Requires-Dist: python-multipart==0.0.6
29
+ Requires-Dist: python-dotenv==1.0.0
30
+ Requires-Dist: google-cloud-firestore==2.13.1
31
+ Requires-Dist: aiohttp==3.9.1
32
+ Requires-Dist: duckduckgo-search==4.1.1
33
+ Dynamic: home-page
34
+ Dynamic: requires-python
35
+
36
+ # AgentMCP: The Universal System for AI Agent Collaboration
37
+
38
+ > Unleashing a new era of AI collaboration: AgentMCP is the system that makes any AI agent work with every other agent - handling all the networking, communication, and coordination between them. Together with MACNet (The Internet of AI Agents), we're creating a world where AI agents can seamlessly collaborate across any framework, protocol, or location.
39
+
40
+ ## ✨ The Magic: Transform Your Agent in 30 Seconds
41
+
42
+ Turn *any* existing AI agent into a globally connected collaborator with just **one line of code**.
43
+
44
+ ```bash
45
+ pip install agent-mcp # Step 1: Install
46
+ ```
47
+
48
+ ```python
49
+ from agent_mcp import mcp_agent # Step 2: Import
50
+
51
+ @mcp_agent(mcp_id="MyAgent") # Step 3: Add this one decorator! 🎉
52
+ class MyExistingAgent:
53
+ # ... your agent's existing code ...
54
+ def analyze(self, data):
55
+ return "Analysis complete!"
56
+ ```
57
+
58
+ That's it! Your agent is now connected to the Multi-Agent Collaboration Network (MACNet), ready to work with any other agent, regardless of its framework.
59
+
60
+ ➡️ *Jump to [Quick Demos](#-quick-demos-see-agentmcp-in-action) to see it live!* ⬅️
61
+
62
+ ## What is AgentMCP?
63
+
64
+ AgentMCP is the world's first universal system for AI agent collaboration. Just as operating systems and networking protocols enabled the Internet, AgentMCP handles all the complex work needed to make AI agents work together:
65
+ - Converting agents to speak a common language
66
+ - Managing network connections and discovery
67
+ - Coordinating tasks and communication
68
+ - Ensuring secure and reliable collaboration
69
+
70
+ With a single decorator, developers can connect their agents to MACNet (our Internet of AI Agents), and AgentMCP takes care of everything else - the networking, translation, coordination, and collaboration. No matter what framework or protocol your agent uses, AgentMCP makes it instantly compatible with our global network of AI agents.
71
+
72
+ ## 📚 Examples
73
+
74
+ **🚀 Quick Demos: See AgentMCP in Action!**
75
+
76
+ These examples show the core power of AgentMCP. See how easy it is to connect agents and get them collaborating!
77
+
78
+ ### 1. Simple Multi-Agent Chat (Group Chat)
79
+
80
+ Watch two agents built with *different frameworks* (Autogen and LangGraph) chat seamlessly.
81
+
82
+ **The Magic:** The `@mcp_agent` decorator instantly connects them.
83
+
84
+ *From `demos/basic/simple_chat.py`:*
85
+ ```python
86
+ # --- Autogen Agent ---
87
+ @mcp_agent(mcp_id="AutoGen_Alice")
88
+ class AutogenAgent(autogen.ConversableAgent):
89
+ # ... agent code ...
90
+
91
+ # --- LangGraph Agent ---
92
+ @mcp_agent(mcp_id="LangGraph_Bob")
93
+ class LangGraphAgent:
94
+ # ... agent code ...
95
+ ```
96
+ **What it shows:**
97
+ - Basic agent-to-agent communication across frameworks.
98
+ - How `@mcp_agent` instantly connects agents to the network.
99
+ - The foundation of collaborative work.
100
+
101
+ **Run it:**
102
+ ```bash
103
+ python demos/basic/simple_chat.py
104
+ ```
105
+
106
+ ### 2. Email Agent Task (Networked Task Execution)
107
+
108
+ See an `EmailAgent` get tasked by another agent over the network to send an email.
109
+
110
+ **The Magic:**
111
+ 1. The `@mcp_agent` decorator makes `EmailAgent` available on the network.
112
+ 2. The coordinating agent targets `EmailAgent` by its `mcp_id` within the task definition.
113
+
114
+ *From `demos/network/email_agent.py`:*
115
+ ```python
116
+ @mcp_agent(mcp_id="EmailAgent")
117
+ class EmailAgent(LangGraphMCPAdapter):
118
+ # ... email sending logic ...
119
+ ```
120
+
121
+ *From `demos/network/test_deployed_network.py` (within task definition):*
122
+ ```python
123
+ # ... other steps ...
124
+ {
125
+ "task_id": "send_report",
126
+ "agent": "EmailAgent", # <-- Target agent by name!
127
+ "description": "Send the research findings via email",
128
+ "content": { ... email details ... },
129
+ "depends_on": ["market_analysis"]
130
+ }
131
+ # ...
132
+ ```
133
+ **What it shows:**
134
+ - An agent becoming an MCP participant.
135
+ - Joining the MACNet global network.
136
+ - Receiving and executing a task (sending an email) via the network.
137
+ - How AgentMCP orchestrates real-world collaboration.
138
+
139
+ **Files Involved:**
140
+ - `demos/network/email_agent.py`: The agent performing the work.
141
+ - `demos/network/test_deployed_network.py`: The script initiating the task.
142
+ - `agent_mcp/heterogeneous_group_chat.py`: The underlying mechanism managing the interaction.
143
+
144
+ **Run it:**
145
+ *Ensure you have set your SMTP environment variables first (see `email_agent.py`).*
146
+ ```bash
147
+ python demos/network/test_deployed_network.py
148
+ ```
149
+
150
+ ### Why AgentMCP Matters
151
+
152
+ In today's fragmented AI landscape, agents are isolated by their frameworks and platforms. AgentMCP changes this by providing:
153
+ - **A Universal System**: The operating system for AI agent collaboration.
154
+ - **The Global Network (MACNet)**: Connect to the Internet of AI Agents.
155
+ - **Simplicity**: Achieve powerful collaboration with minimal effort.
156
+ - **Framework Independence**: Build agents your way; we handle the integration.
157
+ - **Scalability**: Enterprise-ready features for secure, large-scale deployment.
158
+
159
+ ---
160
+
161
+ ## 🔑 Core Concepts & Benefits
162
+
163
+ AgentMCP is built on a few powerful ideas:
164
+
165
+ ### 🎯 One Decorator = Infinite Possibilities
166
+
167
+ > The `@mcp_agent` decorator is the heart of AgentMCP's simplicity and power. Adding it instantly transforms your agent:
168
+
169
+ - 🌐 **Connects** it to the Multi-Agent Collaboration Network (MACNet).
170
+ - 🤝 Makes it **discoverable** and ready to collaborate with any other agent on MACNet.
171
+ - 🔌 Ensures **compatibility** regardless of its underlying framework (Langchain, CrewAI, Autogen, Custom, etc.).
172
+ - 🧠 Empowers it to **share context** and leverage specialized capabilities from agents worldwide.
173
+
174
+ *Result: No complex setup, no infrastructure headaches – just seamless integration into the global AI agent ecosystem.*
175
+
176
+ ### 💡 Analogy: Like Uber for AI Agents
177
+
178
+ Think of AgentMCP as the platform connecting specialized agents, much like Uber connects drivers and riders:
179
+
180
+ - **Your Agent**: Offers its unique skills (like a driver with a car).
181
+ - **Need Help?**: Easily tap into a global network of specialized agents (like hailing a ride).
182
+ - **No Lock-in**: Works with any agent framework or custom implementation.
183
+ - **Effortless Connection**: One decorator is all it takes to join or utilize the network.
184
+
185
+ ### 🛠 Features That Just Work
186
+
187
+ AgentMCP handles the complexities behind the scenes:
188
+
189
+ **For Your Agent:**
190
+
191
+ - **Auto-Registration & Authentication**: Instant, secure network access.
192
+ - **Tool Discovery & Smart Routing**: Automatically find and communicate with the right agents for the task.
193
+ - **Built-in Basic Memory**: Facilitates context sharing between collaborating agents.
194
+ - **Availability Management**: Handles agent online/offline status and ensures tasks are routed to active agents.
195
+
196
+ **For Developers:**
197
+
198
+ - **Framework Freedom**: Use the AI frameworks you know and love.
199
+ - **Zero Config Networking**: Focus on agent logic, not infrastructure.
200
+ - **Simple API**: Primarily interacts through the `@mcp_agent` decorator and task definitions.
201
+ - **Adapters for Popular Frameworks**: Built-in support for Langchain, CrewAI, Autogen, LangGraph simplifies integration.
202
+ - **Asynchronous & Scalable Architecture**: Built on FastAPI for high performance.
203
+
204
+ ---
205
+
206
+ ## Supported Frameworks
207
+
208
+ AgentMCP is designed for broad compatibility:
209
+
210
+ **Currently Supported:**
211
+
212
+ - Autogen
213
+ - LangChain
214
+ - LangGraph
215
+ - CrewAI
216
+ - Custom Agent Implementations
217
+
218
+ **Coming Soon:**
219
+
220
+ - 🔜 LlamaIndex
221
+ - 🔜 A2A Protocol Integration
222
+
223
+ *AgentMCP acts as a universal connector, enabling agents from different ecosystems to work together seamlessly.*
224
+
225
+ ## 🚀 Quick Start (Reference)
226
+
227
+ For quick reference, here's the basic setup again:
228
+
229
+ ### 1️⃣ Install
230
+ ```bash
231
+ pip install agent-mcp
232
+ ```
233
+
234
+ ### 2️⃣ Decorate
235
+ ```python
236
+ from agent_mcp import mcp_agent
237
+
238
+ # Your existing agent - no changes needed!
239
+ class MyMLAgent:
240
+ def predict(self, data):
241
+ return self.model.predict(data)
242
+
243
+ # Add one line to join the MAC network
244
+ @mcp_agent(name="MLPredictor")
245
+ class NetworkEnabledMLAgent(MyMLAgent):
246
+ pass # That's it! All methods become available to other agents
247
+ ```
248
+
249
+ ### 🤝 Instant Collaboration
250
+
251
+ ```python
252
+ # Your agent can now work with others!
253
+ results = await my_agent.collaborate({
254
+ "task": "Analyze this dataset",
255
+ "steps": [
256
+ {"agent": "DataCleaner", "action": "clean"},
257
+ {"agent": "MLPredictor", "action": "predict"},
258
+ {"agent": "Analyst", "action": "interpret"}
259
+ ]
260
+ })
261
+ ```
262
+
263
+ ## Network API
264
+
265
+ ### 🌐 Global Agent Network (Multi-Agent Collaboration Network aka MAC Network or MacNet)
266
+
267
+ Your agent automatically joins our hosted network at `https://mcp-server-ixlfhxquwq-ew.a.run.app`
268
+
269
+ ### 🔑 Authentication
270
+
271
+ All handled for you! The `@mcp_agent` decorator:
272
+ 1. Registers your agent
273
+ 2. Gets an access token
274
+ 3. Maintains the connection
275
+
276
+ ### 📂 API Methods
277
+
278
+ ```python
279
+ # All of these happen automatically!
280
+
281
+ # 1. Register your agent
282
+ response = await network.register(agent)
283
+
284
+ # 2. Discover other agents
285
+ agents = await network.list_agents()
286
+
287
+ # 3. Send messages
288
+ await network.send_message(target_agent, message)
289
+
290
+ # 4. Receive messages
291
+ messages = await network.receive_messages()
292
+ ```
293
+
294
+ ### 🚀 Advanced Features
295
+
296
+ ```python
297
+ # Find agents by capability
298
+ analysts = await network.find_agents(capability="analyze")
299
+
300
+ # Get agent status
301
+ status = await network.get_agent_status(agent_id)
302
+
303
+ # Update agent info
304
+ await network.update_agent(agent_id, new_info)
305
+ ```
306
+
307
+ All of this happens automatically when you use the `@mcp_agent` decorator!
308
+
309
+ ## 🏛 Architecture
310
+
311
+ ### 🌐 The MAC Network
312
+
313
+ ```mermaid
314
+ graph TD
315
+ A[Your Agent] -->|@mcp_agent| B[MCP Network]
316
+ B -->|Discover| C[AI Agents]
317
+ B -->|Collaborate| D[Tools]
318
+ B -->|Share| E[Knowledge]
319
+ ```
320
+
321
+ ### 3️⃣ Run Your App
322
+ Your agent automatically connects when your application starts.
323
+
324
+ ## Community
325
+ Join our Discord community for discussions, support, and collaboration: [https://discord.gg/dDTem2P](https://discord.gg/dDTem2P)
326
+
327
+ ## Contributing
328
+ Contributions are welcome! Please refer to the CONTRIBUTING.md file for guidelines.
329
+
330
+ ## License
331
+ This project is licensed under the MIT License - see the LICENSE file for details.
@@ -0,0 +1,18 @@
1
+ agent_mcp/__init__.py,sha256=zc1ZfkK7pNKWzl5BLIxmLc8WMPnGWpQ3WJSvDUWe2eo,494
2
+ agent_mcp/crewai_mcp_adapter.py,sha256=WbJNr4d6lQuesQ-ONKIt0KE1XsLN1Yl5Hh3Fo3dVwx8,12073
3
+ agent_mcp/enhanced_mcp_agent.py,sha256=DJyyL0Cf6Qp0mIAgu4uV4y1wueinl6W0UN3idn2B0Ds,28813
4
+ agent_mcp/heterogeneous_group_chat.py,sha256=OCuqjH_4VtSE7VWM5u0sMldlq7Y3OjKTU2D7IuuJGe0,20556
5
+ agent_mcp/langchain_mcp_adapter.py,sha256=S3vyD0j75cruknMjuHXFrZYx2gkKGhfyYFaiNK2-f2g,16069
6
+ agent_mcp/langgraph_mcp_adapter.py,sha256=eIiW3P2MBrEzLHHKpPBd4Rci5EFLAaOQrnSILH4RWBM,14028
7
+ agent_mcp/mcp_agent.py,sha256=WkITvLx7xPWQL2NSRNhCg_rl22EksO-o5oX50Fz5cOY,24612
8
+ agent_mcp/mcp_decorator.py,sha256=CDhq9jDliY0cnpc5JiJj2u8uC9nAHMEQaW7G2e1MapA,12126
9
+ agent_mcp/mcp_langgraph.py,sha256=TdhHVwXzrM-Oe2dy-biR1lIQ1f37LxQlkeE147v5hG8,26975
10
+ agent_mcp/mcp_transaction.py,sha256=iSr_DSFSMAU30TEQMTHbHDNooy1w80CkF9tIGKHbqZQ,3069
11
+ agent_mcp/mcp_transport.py,sha256=pyrcDIKevMmqy4Uc9dHmTCgvhJtAQwSBEtYwKUd4qUk,35126
12
+ agent_mcp/mcp_transport_enhanced.py,sha256=RSkHQ_fUXaFI7_6wZk5oAF3vSIM_mgvpTcJrRX_tuDE,1711
13
+ agent_mcp/proxy_agent.py,sha256=YAlOoEpKSO5hGF638kS_XJfKa-pIgY2pS6Z3J9XF1-4,1038
14
+ agent_mcp-0.1.3.dist-info/METADATA,sha256=N-FJk-FJ_qVDsLMJ5s5u2CLhY5Z-aU4JOzOecgpvY0s,11323
15
+ agent_mcp-0.1.3.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
16
+ agent_mcp-0.1.3.dist-info/entry_points.txt,sha256=6wJ3TtpqqkX4cL5kz1ZUCc7f8xUI7bUbDk4oSXMQswE,61
17
+ agent_mcp-0.1.3.dist-info/top_level.txt,sha256=f130_t3z42hdpoMm0bBj6JRxw0COUs5CUwo7Qd3BDog,10
18
+ agent_mcp-0.1.3.dist-info/RECORD,,
@@ -0,0 +1 @@
1
+ agent_mcp