agent-mcp 0.1.2__py3-none-any.whl → 0.1.4__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.
Files changed (53) hide show
  1. agent_mcp/__init__.py +16 -0
  2. agent_mcp/camel_mcp_adapter.py +521 -0
  3. agent_mcp/cli.py +47 -0
  4. agent_mcp/crewai_mcp_adapter.py +281 -0
  5. agent_mcp/enhanced_mcp_agent.py +601 -0
  6. agent_mcp/heterogeneous_group_chat.py +798 -0
  7. agent_mcp/langchain_mcp_adapter.py +458 -0
  8. agent_mcp/langgraph_mcp_adapter.py +325 -0
  9. agent_mcp/mcp_agent.py +658 -0
  10. agent_mcp/mcp_decorator.py +257 -0
  11. agent_mcp/mcp_langgraph.py +733 -0
  12. agent_mcp/mcp_transaction.py +97 -0
  13. agent_mcp/mcp_transport.py +706 -0
  14. agent_mcp/mcp_transport_enhanced.py +46 -0
  15. agent_mcp/proxy_agent.py +24 -0
  16. agent_mcp-0.1.4.dist-info/METADATA +333 -0
  17. agent_mcp-0.1.4.dist-info/RECORD +49 -0
  18. {agent_mcp-0.1.2.dist-info → agent_mcp-0.1.4.dist-info}/WHEEL +1 -1
  19. agent_mcp-0.1.4.dist-info/entry_points.txt +2 -0
  20. agent_mcp-0.1.4.dist-info/top_level.txt +3 -0
  21. demos/__init__.py +1 -0
  22. demos/basic/__init__.py +1 -0
  23. demos/basic/framework_examples.py +108 -0
  24. demos/basic/langchain_camel_demo.py +272 -0
  25. demos/basic/simple_chat.py +355 -0
  26. demos/basic/simple_integration_example.py +51 -0
  27. demos/collaboration/collaborative_task_example.py +437 -0
  28. demos/collaboration/group_chat_example.py +130 -0
  29. demos/collaboration/simplified_crewai_example.py +39 -0
  30. demos/langgraph/autonomous_langgraph_network.py +808 -0
  31. demos/langgraph/langgraph_agent_network.py +415 -0
  32. demos/langgraph/langgraph_collaborative_task.py +619 -0
  33. demos/langgraph/langgraph_example.py +227 -0
  34. demos/langgraph/run_langgraph_examples.py +213 -0
  35. demos/network/agent_network_example.py +381 -0
  36. demos/network/email_agent.py +130 -0
  37. demos/network/email_agent_demo.py +46 -0
  38. demos/network/heterogeneous_network_example.py +216 -0
  39. demos/network/multi_framework_example.py +199 -0
  40. demos/utils/check_imports.py +49 -0
  41. demos/workflows/autonomous_agent_workflow.py +248 -0
  42. demos/workflows/mcp_features_demo.py +353 -0
  43. demos/workflows/run_agent_collaboration_demo.py +63 -0
  44. demos/workflows/run_agent_collaboration_with_logs.py +396 -0
  45. demos/workflows/show_agent_interactions.py +107 -0
  46. demos/workflows/simplified_autonomous_demo.py +74 -0
  47. functions/main.py +144 -0
  48. functions/mcp_network_server.py +513 -0
  49. functions/utils.py +47 -0
  50. agent_mcp-0.1.2.dist-info/METADATA +0 -475
  51. agent_mcp-0.1.2.dist-info/RECORD +0 -5
  52. agent_mcp-0.1.2.dist-info/entry_points.txt +0 -2
  53. agent_mcp-0.1.2.dist-info/top_level.txt +0 -1
@@ -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,333 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-mcp
3
+ Version: 0.1.4
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-Expression: MIT
8
+ Project-URL: Homepage, https://github.com/grupa-ai/agent-mcp
9
+ Project-URL: Documentation, https://github.com/grupa-ai/agent-mcp#readme
10
+ Project-URL: Repository, https://github.com/grupa-ai/agent-mcp
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Requires-Python: >=3.11
18
+ Description-Content-Type: text/markdown
19
+ Requires-Dist: autogen
20
+ Requires-Dist: langchain
21
+ Requires-Dist: langchain-openai
22
+ Requires-Dist: langchain-community
23
+ Requires-Dist: crewai>=0.11.0
24
+ Requires-Dist: langgraph>=0.0.15
25
+ Requires-Dist: openai>=1.12.0
26
+ Requires-Dist: fastapi==0.104.1
27
+ Requires-Dist: uvicorn==0.24.0
28
+ Requires-Dist: sse-starlette==1.8.2
29
+ Requires-Dist: firebase-admin==6.4.0
30
+ Requires-Dist: python-multipart==0.0.6
31
+ Requires-Dist: python-dotenv==1.0.0
32
+ Requires-Dist: google-cloud-firestore==2.13.1
33
+ Requires-Dist: aiohttp==3.9.1
34
+ Requires-Dist: duckduckgo-search==4.1.1
35
+ Dynamic: home-page
36
+ Dynamic: requires-python
37
+
38
+ # AgentMCP: The Universal System for AI Agent Collaboration
39
+
40
+ > 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.
41
+
42
+ ## ✨ The Magic: Transform Your Agent in 30 Seconds
43
+
44
+ Turn *any* existing AI agent into a globally connected collaborator with just **one line of code**.
45
+
46
+ ```bash
47
+ pip install agent-mcp # Step 1: Install
48
+ ```
49
+
50
+ ```python
51
+ from agent_mcp import mcp_agent # Step 2: Import
52
+
53
+ @mcp_agent(mcp_id="MyAgent") # Step 3: Add this one decorator! 🎉
54
+ class MyExistingAgent:
55
+ # ... your agent's existing code ...
56
+ def analyze(self, data):
57
+ return "Analysis complete!"
58
+ ```
59
+
60
+ 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.
61
+
62
+ ➡️ *Jump to [Quick Demos](#-quick-demos-see-agentmcp-in-action) to see it live!* ⬅️
63
+
64
+ ## What is AgentMCP?
65
+
66
+ 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:
67
+ - Converting agents to speak a common language
68
+ - Managing network connections and discovery
69
+ - Coordinating tasks and communication
70
+ - Ensuring secure and reliable collaboration
71
+
72
+ 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.
73
+
74
+ ## 📚 Examples
75
+
76
+ **🚀 Quick Demos: See AgentMCP in Action!**
77
+
78
+ These examples show the core power of AgentMCP. See how easy it is to connect agents and get them collaborating!
79
+
80
+ ### 1. Simple Multi-Agent Chat (Group Chat)
81
+
82
+ Watch two agents built with *different frameworks* (Autogen and LangGraph) chat seamlessly.
83
+
84
+ **The Magic:** The `@mcp_agent` decorator instantly connects them.
85
+
86
+ *From `demos/basic/simple_chat.py`:*
87
+ ```python
88
+ # --- Autogen Agent ---
89
+ @mcp_agent(mcp_id="AutoGen_Alice")
90
+ class AutogenAgent(autogen.ConversableAgent):
91
+ # ... agent code ...
92
+
93
+ # --- LangGraph Agent ---
94
+ @mcp_agent(mcp_id="LangGraph_Bob")
95
+ class LangGraphAgent:
96
+ # ... agent code ...
97
+ ```
98
+ **What it shows:**
99
+ - Basic agent-to-agent communication across frameworks.
100
+ - How `@mcp_agent` instantly connects agents to the network.
101
+ - The foundation of collaborative work.
102
+
103
+ **Run it:**
104
+ ```bash
105
+ python demos/basic/simple_chat.py
106
+ ```
107
+
108
+ ### 2. Email Agent Task (Networked Task Execution)
109
+
110
+ See an `EmailAgent` get tasked by another agent over the network to send an email.
111
+
112
+ **The Magic:**
113
+ 1. The `@mcp_agent` decorator makes `EmailAgent` available on the network.
114
+ 2. The coordinating agent targets `EmailAgent` by its `mcp_id` within the task definition.
115
+
116
+ *From `demos/network/email_agent.py`:*
117
+ ```python
118
+ @mcp_agent(mcp_id="EmailAgent")
119
+ class EmailAgent(LangGraphMCPAdapter):
120
+ # ... email sending logic ...
121
+ ```
122
+
123
+ *From `demos/network/test_deployed_network.py` (within task definition):*
124
+ ```python
125
+ # ... other steps ...
126
+ {
127
+ "task_id": "send_report",
128
+ "agent": "EmailAgent", # <-- Target agent by name!
129
+ "description": "Send the research findings via email",
130
+ "content": { ... email details ... },
131
+ "depends_on": ["market_analysis"]
132
+ }
133
+ # ...
134
+ ```
135
+ **What it shows:**
136
+ - An agent becoming an MCP participant.
137
+ - Joining the MACNet global network.
138
+ - Receiving and executing a task (sending an email) via the network.
139
+ - How AgentMCP orchestrates real-world collaboration.
140
+
141
+ **Files Involved:**
142
+ - `demos/network/email_agent.py`: The agent performing the work.
143
+ - `demos/network/test_deployed_network.py`: The script initiating the task.
144
+ - `agent_mcp/heterogeneous_group_chat.py`: The underlying mechanism managing the interaction.
145
+
146
+ **Run it:**
147
+ *Ensure you have set your SMTP environment variables first (see `email_agent.py`).*
148
+ ```bash
149
+ python demos/network/test_deployed_network.py
150
+ ```
151
+
152
+ ### Why AgentMCP Matters
153
+
154
+ In today's fragmented AI landscape, agents are isolated by their frameworks and platforms. AgentMCP changes this by providing:
155
+ - **A Universal System**: The operating system for AI agent collaboration.
156
+ - **The Global Network (MACNet)**: Connect to the Internet of AI Agents.
157
+ - **Simplicity**: Achieve powerful collaboration with minimal effort.
158
+ - **Framework Independence**: Build agents your way; we handle the integration.
159
+ - **Scalability**: Enterprise-ready features for secure, large-scale deployment.
160
+
161
+ ---
162
+
163
+ ## 🔑 Core Concepts & Benefits
164
+
165
+ AgentMCP is built on a few powerful ideas:
166
+
167
+ ### 🎯 One Decorator = Infinite Possibilities
168
+
169
+ > The `@mcp_agent` decorator is the heart of AgentMCP's simplicity and power. Adding it instantly transforms your agent:
170
+
171
+ - 🌐 **Connects** it to the Multi-Agent Collaboration Network (MACNet).
172
+ - 🤝 Makes it **discoverable** and ready to collaborate with any other agent on MACNet.
173
+ - 🔌 Ensures **compatibility** regardless of its underlying framework (Langchain, CrewAI, Autogen, Custom, etc.).
174
+ - 🧠 Empowers it to **share context** and leverage specialized capabilities from agents worldwide.
175
+
176
+ *Result: No complex setup, no infrastructure headaches – just seamless integration into the global AI agent ecosystem.*
177
+
178
+ ### 💡 Analogy: Like Uber for AI Agents
179
+
180
+ Think of AgentMCP as the platform connecting specialized agents, much like Uber connects drivers and riders:
181
+
182
+ - **Your Agent**: Offers its unique skills (like a driver with a car).
183
+ - **Need Help?**: Easily tap into a global network of specialized agents (like hailing a ride).
184
+ - **No Lock-in**: Works with any agent framework or custom implementation.
185
+ - **Effortless Connection**: One decorator is all it takes to join or utilize the network.
186
+
187
+ ### 🛠 Features That Just Work
188
+
189
+ AgentMCP handles the complexities behind the scenes:
190
+
191
+ **For Your Agent:**
192
+
193
+ - **Auto-Registration & Authentication**: Instant, secure network access.
194
+ - **Tool Discovery & Smart Routing**: Automatically find and communicate with the right agents for the task.
195
+ - **Built-in Basic Memory**: Facilitates context sharing between collaborating agents.
196
+ - **Availability Management**: Handles agent online/offline status and ensures tasks are routed to active agents.
197
+
198
+ **For Developers:**
199
+
200
+ - **Framework Freedom**: Use the AI frameworks you know and love.
201
+ - **Zero Config Networking**: Focus on agent logic, not infrastructure.
202
+ - **Simple API**: Primarily interacts through the `@mcp_agent` decorator and task definitions.
203
+ - **Adapters for Popular Frameworks**: Built-in support for Langchain, CrewAI, Autogen, LangGraph simplifies integration.
204
+ - **Asynchronous & Scalable Architecture**: Built on FastAPI for high performance.
205
+
206
+ ---
207
+
208
+ ## Supported Frameworks
209
+
210
+ AgentMCP is designed for broad compatibility:
211
+
212
+ **Currently Supported:**
213
+
214
+ - Autogen
215
+ - LangChain
216
+ - LangGraph
217
+ - CrewAI
218
+ - Custom Agent Implementations
219
+
220
+ **Coming Soon:**
221
+
222
+ - 🔜 LlamaIndex
223
+ - 🔜 A2A Protocol Integration
224
+
225
+ *AgentMCP acts as a universal connector, enabling agents from different ecosystems to work together seamlessly.*
226
+
227
+ ## 🚀 Quick Start (Reference)
228
+
229
+ For quick reference, here's the basic setup again:
230
+
231
+ ### 1️⃣ Install
232
+ ```bash
233
+ pip install agent-mcp
234
+ ```
235
+
236
+ ### 2️⃣ Decorate
237
+ ```python
238
+ from agent_mcp import mcp_agent
239
+
240
+ # Your existing agent - no changes needed!
241
+ class MyMLAgent:
242
+ def predict(self, data):
243
+ return self.model.predict(data)
244
+
245
+ # Add one line to join the MAC network
246
+ @mcp_agent(name="MLPredictor")
247
+ class NetworkEnabledMLAgent(MyMLAgent):
248
+ pass # That's it! All methods become available to other agents
249
+ ```
250
+
251
+ ### 🤝 Instant Collaboration
252
+
253
+ ```python
254
+ # Your agent can now work with others!
255
+ results = await my_agent.collaborate({
256
+ "task": "Analyze this dataset",
257
+ "steps": [
258
+ {"agent": "DataCleaner", "action": "clean"},
259
+ {"agent": "MLPredictor", "action": "predict"},
260
+ {"agent": "Analyst", "action": "interpret"}
261
+ ]
262
+ })
263
+ ```
264
+
265
+ ## Network API
266
+
267
+ ### 🌐 Global Agent Network (Multi-Agent Collaboration Network aka MAC Network or MacNet)
268
+
269
+ Your agent automatically joins our hosted network at `https://mcp-server-ixlfhxquwq-ew.a.run.app`
270
+
271
+ ### 🔑 Authentication
272
+
273
+ All handled for you! The `@mcp_agent` decorator:
274
+ 1. Registers your agent
275
+ 2. Gets an access token
276
+ 3. Maintains the connection
277
+
278
+ ### 📂 API Methods
279
+
280
+ ```python
281
+ # All of these happen automatically!
282
+
283
+ # 1. Register your agent
284
+ response = await network.register(agent)
285
+
286
+ # 2. Discover other agents
287
+ agents = await network.list_agents()
288
+
289
+ # 3. Send messages
290
+ await network.send_message(target_agent, message)
291
+
292
+ # 4. Receive messages
293
+ messages = await network.receive_messages()
294
+ ```
295
+
296
+ ### 🚀 Advanced Features
297
+
298
+ ```python
299
+ # Find agents by capability
300
+ analysts = await network.find_agents(capability="analyze")
301
+
302
+ # Get agent status
303
+ status = await network.get_agent_status(agent_id)
304
+
305
+ # Update agent info
306
+ await network.update_agent(agent_id, new_info)
307
+ ```
308
+
309
+ All of this happens automatically when you use the `@mcp_agent` decorator!
310
+
311
+ ## 🏛 Architecture
312
+
313
+ ### 🌐 The MAC Network
314
+
315
+ ```mermaid
316
+ graph TD
317
+ A[Your Agent] -->|@mcp_agent| B[MCP Network]
318
+ B -->|Discover| C[AI Agents]
319
+ B -->|Collaborate| D[Tools]
320
+ B -->|Share| E[Knowledge]
321
+ ```
322
+
323
+ ### 3️⃣ Run Your App
324
+ Your agent automatically connects when your application starts.
325
+
326
+ ## Community
327
+ Join our Discord community for discussions, support, and collaboration: [https://discord.gg/dDTem2P](https://discord.gg/dDTem2P)
328
+
329
+ ## Contributing
330
+ Contributions are welcome! Please refer to the CONTRIBUTING.md file for guidelines.
331
+
332
+ ## License
333
+ This project is licensed under the MIT License - see the LICENSE file for details.
@@ -0,0 +1,49 @@
1
+ agent_mcp/__init__.py,sha256=CvLYkpC0DvH4Mo9v3KkT5RsKoQrZkA-IGIk1o-Uk5ks,495
2
+ agent_mcp/camel_mcp_adapter.py,sha256=dMUHlkPpPRx2AAqr-SW2sMGmBNqHJU1rP7jSX5tq4bo,27339
3
+ agent_mcp/cli.py,sha256=s2bILqyRhF-Ebyfr0jj1xOKSuU_pFiljCBVXhZQTU7k,1217
4
+ agent_mcp/crewai_mcp_adapter.py,sha256=WbJNr4d6lQuesQ-ONKIt0KE1XsLN1Yl5Hh3Fo3dVwx8,12073
5
+ agent_mcp/enhanced_mcp_agent.py,sha256=DJyyL0Cf6Qp0mIAgu4uV4y1wueinl6W0UN3idn2B0Ds,28813
6
+ agent_mcp/heterogeneous_group_chat.py,sha256=ecvTBI6DgMoZFKTpFKcx1bhHMVX63DCpfqOc18I9wLU,38231
7
+ agent_mcp/langchain_mcp_adapter.py,sha256=uJsmqv_tFeG-vn-FnTS0bUYztSJzQ_dnVH-Vstjd__g,23825
8
+ agent_mcp/langgraph_mcp_adapter.py,sha256=eIiW3P2MBrEzLHHKpPBd4Rci5EFLAaOQrnSILH4RWBM,14028
9
+ agent_mcp/mcp_agent.py,sha256=qO6zYuAUowZE1B5-T-noDZiyGmjsLpgRZPlzudvvIvE,25577
10
+ agent_mcp/mcp_decorator.py,sha256=CDhq9jDliY0cnpc5JiJj2u8uC9nAHMEQaW7G2e1MapA,12126
11
+ agent_mcp/mcp_langgraph.py,sha256=TdhHVwXzrM-Oe2dy-biR1lIQ1f37LxQlkeE147v5hG8,26975
12
+ agent_mcp/mcp_transaction.py,sha256=iSr_DSFSMAU30TEQMTHbHDNooy1w80CkF9tIGKHbqZQ,3069
13
+ agent_mcp/mcp_transport.py,sha256=Mby0FMB4TKncMFOzhOxTLoabd1d1jwBne8RiJYJVR78,35373
14
+ agent_mcp/mcp_transport_enhanced.py,sha256=RSkHQ_fUXaFI7_6wZk5oAF3vSIM_mgvpTcJrRX_tuDE,1711
15
+ agent_mcp/proxy_agent.py,sha256=YAlOoEpKSO5hGF638kS_XJfKa-pIgY2pS6Z3J9XF1-4,1038
16
+ demos/__init__.py,sha256=6awmpBFb6EK0EB7dmezclX2AJRzIwt1F_LL6pW1oFAY,58
17
+ demos/basic/__init__.py,sha256=jWuTMaIE1wrb3s5lvpAmL_GnIyG9AviMgBmT9AvJFUU,64
18
+ demos/basic/framework_examples.py,sha256=i5YnykChWwwBjz8WGV2TLe-Elf0i5n-XLlLvNhJeVtU,3723
19
+ demos/basic/langchain_camel_demo.py,sha256=EeK6GgfCaA6Ew8xZxgkbNV4SUPy2RxPJv84XlCXyX_g,10611
20
+ demos/basic/simple_chat.py,sha256=JlyhZ8Nq3y6AHSvbejrbC6mKP6CCXg3tRXHOwPZiPyw,13783
21
+ demos/basic/simple_integration_example.py,sha256=_1JiYhKwPzh26-B1yoZe8cEbHIhJH6sDEDbK0FoHMlI,1570
22
+ demos/collaboration/collaborative_task_example.py,sha256=MVtxwaF_Aq-sL8wd7LAQTBCzI5TakNho-4bq6EtTik4,16830
23
+ demos/collaboration/group_chat_example.py,sha256=dfBp1zF0WAPkZiwMDKH01e8_K2oTvkgJJ7DdDMrX4rE,4111
24
+ demos/collaboration/simplified_crewai_example.py,sha256=U-o5VLrZMaqpOQ7IgYytNozIXljl-c_R2BPo9n7t-7M,1301
25
+ demos/langgraph/autonomous_langgraph_network.py,sha256=OkeC2YvuUkSTFj6dxi8WDf_KM48AG0wLrrRh30HUkXc,35801
26
+ demos/langgraph/langgraph_agent_network.py,sha256=Eg8hWlqIj-IWOcQhK_IWHvQl5AkQTBKFZyCPhgFJ9xA,15727
27
+ demos/langgraph/langgraph_collaborative_task.py,sha256=nZ_VW3vlB94BEqhK00WA5jtICCEATbhbsDbqxZA_4A8,24114
28
+ demos/langgraph/langgraph_example.py,sha256=51KY3-SPdwxKO1p7Wr0Q3NPISXSdaVCLmuO8TPvjv0s,8024
29
+ demos/langgraph/run_langgraph_examples.py,sha256=YFhDrqpQV0ugakQobhvxAkAL0A1cv2L5-c-njDOPJIM,7253
30
+ demos/network/agent_network_example.py,sha256=YLMDCjZaddmkbUHCRWgXXoP5tjxRr_QQqpLNGhHbRbI,14931
31
+ demos/network/email_agent.py,sha256=22ef1ZRfOBH4BwYCXsNyziUBp-rr0ve9qSCwnhRd3hU,5031
32
+ demos/network/email_agent_demo.py,sha256=le1SRhfVjOTLvQ-kRPb3ZxVazKN7hbGR50-vOeYoxJo,1310
33
+ demos/network/heterogeneous_network_example.py,sha256=1BmaJ1-CTNNcCeDSe0KbFw9Hq-VLFLzyNpPsmUaetQo,7315
34
+ demos/network/multi_framework_example.py,sha256=nRpJ0PmlSBV8KlpS7_tDUp3e2lHnpZxlnuf9qqpvi5I,6495
35
+ demos/utils/check_imports.py,sha256=cHNzsxwjnGaPKHAE-Vu4-JhBT7fPSAC_ppx2a0u3ecI,1475
36
+ demos/workflows/autonomous_agent_workflow.py,sha256=mr5Vymr5fUimW1F9PJFqOp46SkH6lIFv1yqYtQk9XFM,10269
37
+ demos/workflows/mcp_features_demo.py,sha256=Ot-tS8Rb25RdyhmzGAr-8VkZInVq624I3xsIFioe92o,13635
38
+ demos/workflows/run_agent_collaboration_demo.py,sha256=SOGJUlvKFZT-39TOPkxWTFJn2RpDtV8U59FKnrRrfIA,2184
39
+ demos/workflows/run_agent_collaboration_with_logs.py,sha256=AEEJwR0UE97DgMV_TXfn5G18QKRYRtoeB0cEce1ogFc,14056
40
+ demos/workflows/show_agent_interactions.py,sha256=QCzNByQUcuSKDQ5hVXMMFmAATw_Q763OSNZmUDZymXQ,4981
41
+ demos/workflows/simplified_autonomous_demo.py,sha256=VN1X9_z3sIyndkH1dICT_0Pu7AUCDyvGsOG3ZqGKPvc,2325
42
+ functions/main.py,sha256=KvbjSq2DQsFAnRpSzt_6Lr8sFbQ_T9AZ7XAaVFOYkoI,5844
43
+ functions/mcp_network_server.py,sha256=1lAhd4TZs882Bhkmm0pa1l2X84mXaZs4fEIu4icwVxs,21738
44
+ functions/utils.py,sha256=vR0R34ma84rp7zovlsawmffav6ZHsW6K6nrp9GlM9bk,2059
45
+ agent_mcp-0.1.4.dist-info/METADATA,sha256=qLqpBhF3Bm5BcG6G11CHkHQKzAbioIZwKZJNQC-IVek,11474
46
+ agent_mcp-0.1.4.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
47
+ agent_mcp-0.1.4.dist-info/entry_points.txt,sha256=_vOH0WhJfAMNRa61MQAv4cQxs55LZtAoAsfFuRzvXvk,49
48
+ agent_mcp-0.1.4.dist-info/top_level.txt,sha256=sxddPYaKyfJdF_J7-yFNSeMjMat0WQUcYB91f9g6RYM,26
49
+ agent_mcp-0.1.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (80.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ mcp-agent = agent_mcp.cli:main
@@ -0,0 +1,3 @@
1
+ agent_mcp
2
+ demos
3
+ functions
demos/__init__.py ADDED
@@ -0,0 +1 @@
1
+ # This file makes the 'demos' directory a Python package.
@@ -0,0 +1 @@
1
+ # This file makes the 'demos/basic' directory a Python package.
@@ -0,0 +1,108 @@
1
+ """
2
+ Example of using the @mcp_agent decorator with different frameworks.
3
+ """
4
+
5
+ import os
6
+ from dotenv import load_dotenv
7
+ from agent_mcp.mcp_decorator import mcp_agent
8
+
9
+ # Load environment variables
10
+ load_dotenv()
11
+
12
+ # Set up OpenAI API key
13
+ os.environ['OPENAI_API_KEY'] = os.getenv('OPENAI_API_KEY')
14
+
15
+ # Example 1: LangChain Agent
16
+ from langchain_openai import ChatOpenAI
17
+ from langchain.agents import AgentExecutor, create_openai_functions_agent
18
+ from langchain_community.tools.ddg_search import DuckDuckGoSearchRun
19
+ from langchain.schema.messages import SystemMessage
20
+ from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder
21
+
22
+ @mcp_agent(name="LangChainResearcher")
23
+ class LangChainResearchAgent:
24
+ def __init__(self):
25
+ # Set up LangChain components
26
+ self.llm = ChatOpenAI(model="gpt-3.5-turbo")
27
+ self.tools = [DuckDuckGoSearchRun()]
28
+
29
+ # Create prompt template
30
+ prompt = ChatPromptTemplate.from_messages([
31
+ ("system", "You are a research agent that uses search tools."),
32
+ ("user", "{input}"),
33
+ MessagesPlaceholder(variable_name="agent_scratchpad")
34
+ ])
35
+
36
+ # Create the agent
37
+ self.agent = create_openai_functions_agent(
38
+ llm=self.llm,
39
+ tools=self.tools,
40
+ prompt=prompt
41
+ )
42
+ self.agent_executor = AgentExecutor(agent=self.agent, tools=self.tools)
43
+
44
+ def research(self, query: str) -> str:
45
+ """Perform research on a given query"""
46
+ return self.agent_executor.invoke({"input": query})["output"]
47
+
48
+ # Example 2: LangGraph Agent
49
+ from langgraph.graph import Graph, StateGraph
50
+ from typing import Dict, TypedDict, Annotated
51
+
52
+ # Define the state type
53
+ class GraphState(TypedDict):
54
+ input: str
55
+ analysis: str
56
+ output: str
57
+
58
+ @mcp_agent(name="LangGraphAnalyzer")
59
+ class LangGraphAnalysisAgent:
60
+ def __init__(self):
61
+ # Set up LangGraph components
62
+ self.llm = ChatOpenAI(model="gpt-3.5-turbo")
63
+
64
+ # Define the workflow graph
65
+ self.workflow = StateGraph(GraphState)
66
+
67
+ # Add nodes to the graph
68
+ self.workflow.add_node("analyze", self.analyze_step)
69
+ self.workflow.add_node("summarize", self.summarize_step)
70
+
71
+ # Add edges
72
+ self.workflow.add_edge("analyze", "summarize")
73
+ self.workflow.set_entry_point("analyze")
74
+ self.workflow.set_finish_point("summarize")
75
+
76
+ # Compile the graph
77
+ self.graph = self.workflow.compile()
78
+
79
+ def analyze_step(self, state):
80
+ """Analyze the input data"""
81
+ analysis = self.llm.invoke(f"Analyze this topic: {state['input']}")
82
+ state['analysis'] = analysis
83
+ return state
84
+
85
+ def summarize_step(self, state):
86
+ """Summarize the analysis"""
87
+ summary = self.llm.invoke(f"Summarize this analysis: {state['analysis']}")
88
+ state['output'] = summary
89
+ return state
90
+
91
+ def process(self, topic: str) -> str:
92
+ """Process a topic through the LangGraph workflow"""
93
+ result = self.graph.invoke({"input": topic})
94
+ return result["output"]
95
+
96
+ # Example usage
97
+ if __name__ == "__main__":
98
+ print("Testing LangChain Agent:")
99
+ langchain_agent = LangChainResearchAgent()
100
+ result = langchain_agent.research("Latest developments in quantum computing 2025")
101
+ print(f"Research result: {result}")
102
+ print(f"Available MCP tools: {langchain_agent.mcp_tools.keys()}\n")
103
+
104
+ print("Testing LangGraph Agent:")
105
+ langgraph_agent = LangGraphAnalysisAgent()
106
+ result = langgraph_agent.process("Impact of AI on healthcare in 2025")
107
+ print(f"Analysis result: {result}")
108
+ print(f"Available MCP tools: {langgraph_agent.mcp_tools.keys()}")