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.
@@ -1,475 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: agent-mcp
3
- Version: 0.1.2
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: Multi-Agent Collaboration Platform
37
-
38
- ## Put Your Agent to Work in 30 Seconds
39
-
40
- ```python
41
- pip install agent-mcp # Step 1: Install
42
- ```
43
-
44
- ```python
45
- from agent_mcp import mcp_agent # Step 2: Import
46
-
47
- @mcp_agent(name="MyAgent") # Step 3: Add one line - that's it! 🎉
48
- class MyAgent:
49
- def analyze(self, data):
50
- return "Analysis complete!"
51
- ```
52
-
53
- ## What is AgentMCP?
54
-
55
- AgentMCP is a revolutionary Multi-agent Collaboration Platform (MCP) that implements the Model Context Protocol (MCP) to enable seamless collaboration between AI agents. With a single decorator, developers can transform any agent into an MCP-compatible agent that can participate in the Multi-Agent Collaboration Network (MACNet).
56
-
57
- ### 🎯 One Decorator = Infinite Possibilities
58
-
59
- When you add `@mcp_agent`, your agent instantly becomes an Agent with MCP App, Client and Server Capabilities :
60
-
61
- - 🌐 Connected to the Multi-Agent Collaboration Network (MACNet)
62
- - 🤝 Ready to work with any other agent on the network
63
- - 🔌 Framework-agnostic (works with Langchain, CrewAI, Autogen, or any custom implementation)
64
- - 🧠 Empowered to communicate, share context, and collaborate with specialized agents globally
65
-
66
- No complex setup. No infrastructure headaches. Just one line of code to join the world's first AI multi-agent collaboration network (MAC-Network)!
67
-
68
- ### 💡 It's Like Uber for AI Agents
69
-
70
- Just like Uber connects drivers and riders, AgentMCP connects AI agents:
71
- - **Your Agent**: Has specific skills? Put them to work!
72
- - **Need Help?** Tap into a global network of specialized agents
73
- - **No Lock-in**: Works with any framework or custom implementation
74
- - **One Line**: That's all it takes to join the network
75
-
76
- ### 🔌 Availability & Connection
77
-
78
- Just like Uber drivers, agents can go online and offline:
79
- - **Active**: Your agent is online when your app is running
80
- - **Discoverable**: Other agents can find yours when it's online
81
- - **Smart Routing**: Tasks only go to available agents
82
- - **Auto Recovery**: Handles disconnections gracefully
83
-
84
- ```python
85
- @mcp_agent(name="MyAgent")
86
- class MyCustomAgent:
87
- @register_tool("analyze", "Analyze given data")
88
- def analyze_data(self, data):
89
- return "Analysis results"
90
- ```
91
-
92
- ### 🎯 What Just Happened?
93
-
94
- Your agent just joined the world's largest AI agent collaboration network! It can now:
95
-
96
- - 🌐 Work with specialized agents from around the world
97
- - 🤝 Collaborate on complex tasks automatically
98
- - 🔌 Connect with any framework (Langchain, CrewAI, Autogen, etc.)
99
- - 🧠 Share context and knowledge with other agents
100
-
101
-
102
- The platform unifies various AI frameworks (Langchain, CrewAI, Autogen, LangGraph) under a single protocol, allowing agents to communicate and collaborate regardless of their underlying implementation.
103
-
104
- The platform uses a flexible coordinator-worker architecture with HTTP/FastAPI for communication, allowing agents to work together regardless of their underlying framework.
105
-
106
- ## Features
107
-
108
- ### Core Features
109
- - **One-Line Integration**: Transform any agent into an MCP agent with a single decorator
110
- - **Automatic Network Registration**: Agents automatically join the MCN upon creation
111
- - **Framework Agnostic**: Works with any AI framework or custom implementation
112
- - **Built-in Adapters**: Ready-to-use adapters for:
113
- - Langchain (Chain-of-thought reasoning)
114
- - CrewAI (Role-based collaboration)
115
- - Autogen (Autonomous agents)
116
- - LangGraph (Workflow orchestration)
117
-
118
- ### Architecture
119
- - **Coordinator-Worker Pattern**: Centralized task management with distributed execution
120
- - **FastAPI Integration**: Modern, high-performance HTTP communication
121
- - **Asynchronous Processing**: Non-blocking task execution and message handling
122
- - **Flexible Transport Layer**: Extensible communication protocols
123
-
124
- ## 🛠 Features That Just Work
125
-
126
- ### 🤖 For Your Agent
127
- - **Auto-Registration**: Instant network access
128
- - **Tool Discovery**: Find and use other agents' capabilities
129
- - **Smart Routing**: Messages go to the right agent automatically
130
- - **Built-in Memory**: Share and access collective knowledge
131
-
132
- ### 👩‍💻 For Developers
133
- - **Framework Freedom**: Use any AI framework you love
134
- - **Zero Config**: No complex setup or infrastructure
135
- - **Simple API**: Everything through one decorator
136
- - **Full Control**: Your agent, your rules
137
-
138
- ## 🚀 Quick Start
139
-
140
- ### 1️⃣ Install
141
- ```bash
142
- pip install agent-mcp
143
- ```
144
-
145
- ### 2️⃣ Decorate
146
- ```python
147
- from agent_mcp import mcp_agent
148
-
149
- @mcp_agent()
150
- class MyAgent:
151
- def work(self): pass
152
- ```
153
-
154
- ### 3️⃣ That's it! 🎉
155
- Your agent is now part of the network!
156
-
157
- ## 🔥 Supported Frameworks
158
-
159
- Works seamlessly with:
160
- - **Langchain** - For chain-of-thought reasoning
161
- - **CrewAI** - For role-based agent teams
162
- - **Autogen** - For autonomous agents
163
- - **LangGraph** - For complex agent workflows
164
- - **Custom Agents** - Your code, your way!
165
-
166
- ### 💎 Premium Features
167
- - **Agent Discovery**: Find the right agent for any task
168
- - **Smart Routing**: Messages flow to the right place
169
- - **Collective Memory**: Shared knowledge across agents
170
- - **Real-time Monitoring**: Track your agent's work
171
-
172
- ## 📚 Examples
173
-
174
- ### 🤖 Add AI to Any Agent
175
-
176
- ```python
177
- from agent_mcp import mcp_agent
178
-
179
- # Your existing agent - no changes needed!
180
- class MyMLAgent:
181
- def predict(self, data):
182
- return self.model.predict(data)
183
-
184
- # Add one line to join the MAC network
185
- @mcp_agent(name="MLPredictor")
186
- class NetworkEnabledMLAgent(MyMLAgent):
187
- pass # That's it! All methods become available to other agents
188
- ```
189
-
190
- ### 🤝 Instant Collaboration
191
-
192
- ```python
193
- # Your agent can now work with others!
194
- results = await my_agent.collaborate({
195
- "task": "Analyze this dataset",
196
- "steps": [
197
- {"agent": "DataCleaner", "action": "clean"},
198
- {"agent": "MLPredictor", "action": "predict"},
199
- {"agent": "Analyst", "action": "interpret"}
200
- ]
201
- })
202
- ```
203
-
204
- ## 🔗 Network API
205
-
206
- ### 🌐 Global Agent Network (Multi-Agent Collaboration Network aka MAC Network or MacNet)
207
-
208
- Your agent automatically joins our hosted network at `https://mcp-server-ixlfhxquwq-ew.a.run.app`
209
-
210
- ### 🔑 Authentication
211
-
212
- All handled for you! The `@mcp_agent` decorator:
213
- 1. Registers your agent
214
- 2. Gets an access token
215
- 3. Maintains the connection
216
-
217
- ### 📂 API Methods
218
-
219
- ```python
220
- # All of these happen automatically!
221
-
222
- # 1. Register your agent
223
- response = await network.register(agent)
224
-
225
- # 2. Discover other agents
226
- agents = await network.list_agents()
227
-
228
- # 3. Send messages
229
- await network.send_message(target_agent, message)
230
-
231
- # 4. Receive messages
232
- messages = await network.receive_messages()
233
- ```
234
-
235
- ### 🚀 Advanced Features
236
-
237
- ```python
238
- # Find agents by capability
239
- analysts = await network.find_agents(capability="analyze")
240
-
241
- # Get agent status
242
- status = await network.get_agent_status(agent_id)
243
-
244
- # Update agent info
245
- await network.update_agent(agent_id, new_info)
246
- ```
247
-
248
- All of this happens automatically when you use the `@mcp_agent` decorator!
249
-
250
- ## 🏛 Architecture
251
-
252
- ### 🌐 The MAC Network
253
-
254
- ```mermaid
255
- graph TD
256
- A[Your Agent] -->|@mcp_agent| B[MCP Network]
257
- B -->|Discover| C[AI Agents]
258
- B -->|Collaborate| D[Tools]
259
- B -->|Share| E[Knowledge]
260
- ```
261
-
262
- ### 🧰 How It Works
263
-
264
- 1. **One Decorator** `@mcp_agent`
265
- - Transforms your agent
266
- - Handles registration
267
- - Sets up communication
268
-
269
- 2. **Instant Access**
270
- - Global agent directory
271
- - Automatic discovery
272
- - Smart routing
273
-
274
- 3. **Built-in Adapters**
275
- - Langchain 🧩
276
- - CrewAI 👨‍💻
277
- - Autogen 🤖
278
- - LangGraph 📈
279
-
280
- 3. **Task Management**
281
- ```python
282
- task = {
283
- "task_id": "research_project",
284
- "steps": [
285
- {
286
- "agent": "LangchainWorker",
287
- "task_id": "research",
288
- "description": "Research topic"
289
- },
290
- {
291
- "agent": "CrewAIWorker",
292
- "task_id": "analysis",
293
- "depends_on": ["research"]
294
- }
295
- ]
296
- }
297
- ```
298
-
299
- ### Registering Custom Tools
300
-
301
- ```python
302
- from mcp_agent import MCPAgent
303
-
304
- # Create an MCP-enabled agent
305
- agent = MCPAgent(name="ToolAgent")
306
-
307
- # Define a custom tool function
308
- def calculate_sum(a: int, b: int):
309
- """Calculate the sum of two numbers."""
310
- result = a + b
311
- return {"status": "success", "result": result}
312
-
313
- # Register the custom tool
314
- agent.register_mcp_tool(
315
- name="math_sum",
316
- description="Calculate the sum of two numbers",
317
- func=calculate_sum,
318
- a_description="First number to add",
319
- b_description="Second number to add"
320
- )
321
-
322
- # Use the custom tool
323
- result = agent.execute_tool("math_sum", a=5, b=7)
324
- print(f"5 + 7 = {result}")
325
- ```
326
-
327
- ### 🔗 Network Benefits
328
-
329
- - **Auto-Discovery**: Find the right agents for any task
330
- - **Smart Routing**: Tasks go to the best available agent
331
- - **Progress Tracking**: Real-time updates on your tasks
332
- - **Error Handling**: Automatic retries and fallbacks
333
-
334
- ## Model Context Protocol Support
335
-
336
- The MCPAgent implements the Model Context Protocol, which provides a standardized way for AI systems to share context and capabilities. This implementation supports:
337
-
338
- ### Context Management
339
-
340
- ```python
341
- # Set context
342
- agent.update_context("key", "value")
343
-
344
- # Get context
345
- value = agent.get_context("key")
346
-
347
- # List all context keys
348
- keys = agent.execute_tool("context_list")
349
-
350
- # Remove context
351
- agent.execute_tool("context_remove", key="key_to_remove")
352
- ```
353
-
354
- ### 🧠 Smart Protocol
355
-
356
- ### 🔗 Multiple Ways to Connect
357
-
358
- ```python
359
- # 1. Simple Function Calls
360
- result = agent.call("analyze", data=my_data)
361
-
362
- # 2. OpenAI Compatible
363
- result = agent.run({
364
- "name": "analyze",
365
- "arguments": {"data": my_data}
366
- })
367
-
368
- # 3. Natural Language
369
- result = agent.process(
370
- "Please analyze this data and "
371
- "send the results to the visualization team"
372
- )
373
- ```
374
-
375
- ### 🤓 Smart Features
376
-
377
- - **Auto-Detection**: Understands different call formats
378
- - **Context Aware**: Maintains conversation history
379
- - **Tool Discovery**: Finds the right tools for the job
380
- - **Error Recovery**: Handles failures gracefully
381
-
382
- ### MCP Information
383
-
384
- You can retrieve information about an agent's MCP capabilities:
385
-
386
- ```python
387
- info = agent.execute_tool("mcp_info")
388
- print(f"Agent ID: {info['id']}")
389
- print(f"Agent Version: {info['version']}")
390
- print(f"Available Tools: {len(info['tools'])}")
391
- ```
392
-
393
- ## Advanced Examples
394
-
395
- The project includes several advanced examples that demonstrate the full potential of MCPAgent:
396
-
397
- ### 1. MCPFeaturesDemo
398
-
399
- Run `python mcp_features_demo.py` to see a step-by-step demonstration of all MCPAgent features:
400
- - Context management operations
401
- - Custom tool registration and usage
402
- - Using agents as tools
403
- - LLM integration with context
404
-
405
- This is the best example to start with to understand the core capabilities of MCPAgent.
406
-
407
- ### 2. The Internet of AI Agents (Agent Network)
408
-
409
- Run `python agent_network_example.py` to start an interactive agent network example:
410
- - Simulates a social network of agents
411
- - Each agent has a specialized role (Coordinator, Researcher, Analyst, etc.)
412
- - Agents can communicate with each other through tool calls
413
- - You can interact with any agent and broadcast messages
414
- - Human input is fully supported
415
-
416
- This example demonstrates how MCPAgent enables creating complex agent networks where agents can call and interact with each other.
417
-
418
- ### 3. Collaborative Project
419
-
420
- Run `python collaborative_task_example.py` to start a collaborative project simulation:
421
- - Team of agents working together on a shared project
422
- - Shared workspace context with research, analysis, and tasks
423
- - Task assignment and progress tracking
424
- - Full conversation history captured
425
- - Human input for setting topics and interacting with agents
426
-
427
- This example showcases how MCPAgent can be used in a structured collaborative environment where agents share a workspace and contribute to a common goal.
428
-
429
- ## LangGraph Implementation
430
-
431
- MCPAgent has also been implemented for LangGraph, providing the same Model Context Protocol capabilities within the LangGraph framework:
432
-
433
- ```python
434
- from mcp_langgraph import MCPNode, MCPReactAgent, create_mcp_langgraph
435
- from langchain_openai import ChatOpenAI
436
-
437
- # Create a LLM
438
- llm = ChatOpenAI(model="gpt-4o")
439
-
440
- # Create a LangGraph with MCP capabilities
441
- graph = create_mcp_langgraph(
442
- llm,
443
- name="SimpleMCPGraph",
444
- system_message="You are a helpful assistant that uses context to answer questions."
445
- )
446
-
447
- # Access the MCP agent for the graph
448
- mcp_agent = graph.mcp_agent
449
-
450
- # Add context to the MCP agent
451
- mcp_agent.update_context("user_info", {
452
- "name": "Alice",
453
- "occupation": "Data Scientist"
454
- })
455
-
456
- # Run the graph with a user query
457
- from langchain_core.messages import HumanMessage
458
-
459
- question = "What should I learn next in my field?"
460
- initial_state = {"messages": [HumanMessage(content=question)]}
461
- result = graph.invoke(initial_state)
462
- ```
463
-
464
- ### LangGraph Examples
465
-
466
- The project includes several examples that demonstrate how to use the MCP protocol with LangGraph:
467
-
468
- 1. **Basic LangGraph Example**
469
- Run `python langgraph_example.py` to see a step-by-step demonstration of MCPNode with LangGraph.
470
-
471
- 2. **LangGraph Agent Network**
472
- Run `python langgraph_agent_network.py` to start an interactive agent network built with LangGraph.
473
-
474
- 3. **LangGraph Collaborative Project**
475
- Run `python langgraph_collaborative_task.py` to start a collaborative project simulation with LangGraph agents.
@@ -1,5 +0,0 @@
1
- agent_mcp-0.1.2.dist-info/METADATA,sha256=2d4Fb5Dn1w_T2rAzGbejRkBgTgDx8OVZNqMI8quDX1Q,14495
2
- agent_mcp-0.1.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
3
- agent_mcp-0.1.2.dist-info/entry_points.txt,sha256=6wJ3TtpqqkX4cL5kz1ZUCc7f8xUI7bUbDk4oSXMQswE,61
4
- agent_mcp-0.1.2.dist-info/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
5
- agent_mcp-0.1.2.dist-info/RECORD,,
@@ -1 +0,0 @@
1
-