aetherforge-platform 1.0.0__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.
- aetherforge_platform-1.0.0.dist-info/METADATA +86 -0
- aetherforge_platform-1.0.0.dist-info/RECORD +55 -0
- aetherforge_platform-1.0.0.dist-info/WHEEL +5 -0
- aetherforge_platform-1.0.0.dist-info/top_level.txt +4 -0
- ai-life-assistant-copy/ai_agent.py +145 -0
- ai-life-assistant-copy/avatar_manager.py +231 -0
- ai-life-assistant-copy/avatar_packer.py +261 -0
- ai-life-assistant-copy/backup_all.py +262 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/ai_agent.py +145 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/avatar_manager.py +231 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/avatar_packer.py +261 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/backup_all.py +262 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/commands.py +210 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/config.py +30 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/daemon/__init__.py +3 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/daemon/daemon.py +174 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/database.py +292 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/graph.py +531 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/main.py +830 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/mcp_tools.py +449 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/memory.py +92 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/memory_v2.py +333 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/mock_shopping_data.py +172 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/personality.py +159 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/speech.py +41 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/test_simple.py +127 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/tools/__init__.py +15 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/tools/amazon_tool.py +103 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/tools/calendar_tool.py +92 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/tools/reminder_tool.py +92 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/tools/weather_tool.py +45 -0
- ai-life-assistant-copy/backups/backup_20260404_193836/tree_memory.py +340 -0
- ai-life-assistant-copy/commands.py +210 -0
- ai-life-assistant-copy/config.py +30 -0
- ai-life-assistant-copy/daemon/__init__.py +3 -0
- ai-life-assistant-copy/daemon/daemon.py +174 -0
- ai-life-assistant-copy/database.py +292 -0
- ai-life-assistant-copy/graph.py +531 -0
- ai-life-assistant-copy/main.py +830 -0
- ai-life-assistant-copy/mcp_tools.py +449 -0
- ai-life-assistant-copy/memory.py +92 -0
- ai-life-assistant-copy/memory_v2.py +333 -0
- ai-life-assistant-copy/mock_shopping_data.py +172 -0
- ai-life-assistant-copy/personality.py +159 -0
- ai-life-assistant-copy/speech.py +41 -0
- ai-life-assistant-copy/test_simple.py +127 -0
- ai-life-assistant-copy/tools/__init__.py +15 -0
- ai-life-assistant-copy/tools/amazon_tool.py +103 -0
- ai-life-assistant-copy/tools/calendar_tool.py +92 -0
- ai-life-assistant-copy/tools/reminder_tool.py +92 -0
- ai-life-assistant-copy/tools/weather_tool.py +45 -0
- ai-life-assistant-copy/tree_memory.py +340 -0
- ai_agent_runtime.py +447 -0
- main.py +6752 -0
- mcp_server.py +427 -0
mcp_server.py
ADDED
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
from mcp.server.fastmcp import FastMCP
|
|
2
|
+
import requests
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
mcp = FastMCP("AetherForge Platform")
|
|
7
|
+
|
|
8
|
+
PLATFORM_URL = os.getenv("PLATFORM_URL", "http://localhost:8000")
|
|
9
|
+
MCP_API_KEY = os.getenv("MCP_API_KEY", "")
|
|
10
|
+
|
|
11
|
+
@mcp.tool()
|
|
12
|
+
def register_ai(name: str, title: str, description: str, agent_type: str, wallet_address: str) -> dict:
|
|
13
|
+
"""Register a new AI agent on the platform.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
name: AI agent name
|
|
17
|
+
title: Short title
|
|
18
|
+
description: Detailed description
|
|
19
|
+
agent_type: Type of AI (trading, content, analysis, etc.)
|
|
20
|
+
wallet_address: DOGE wallet address for receiving payments
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
Registration result with AI ID and API key
|
|
24
|
+
"""
|
|
25
|
+
resp = requests.post(f"{PLATFORM_URL}/api/ai/register", json={
|
|
26
|
+
"name": name,
|
|
27
|
+
"title": title,
|
|
28
|
+
"description": description,
|
|
29
|
+
"agent_type": agent_type,
|
|
30
|
+
"wallet_address": wallet_address
|
|
31
|
+
})
|
|
32
|
+
return resp.json()
|
|
33
|
+
|
|
34
|
+
@mcp.tool()
|
|
35
|
+
def get_ai_info(ai_id: str) -> dict:
|
|
36
|
+
"""Get information about an AI agent.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
ai_id: AI agent ID
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
AI agent information
|
|
43
|
+
"""
|
|
44
|
+
resp = requests.get(f"{PLATFORM_URL}/api/ai/{ai_id}")
|
|
45
|
+
return resp.json()
|
|
46
|
+
|
|
47
|
+
@mcp.tool()
|
|
48
|
+
def get_ai_supporters(ai_id: str) -> dict:
|
|
49
|
+
"""Get list of supporters for an AI agent.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
ai_id: AI agent ID
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
List of supporters and their contributions
|
|
56
|
+
"""
|
|
57
|
+
resp = requests.get(f"{PLATFORM_URL}/api/ai/{ai_id}/supporters")
|
|
58
|
+
return resp.json()
|
|
59
|
+
|
|
60
|
+
@mcp.tool()
|
|
61
|
+
def distribute_profit(ai_id: str, total_profit_usd: float, api_key: str) -> dict:
|
|
62
|
+
"""Distribute profit to supporters.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
ai_id: AI agent ID
|
|
66
|
+
total_profit_usd: Total profit to distribute
|
|
67
|
+
api_key: AI agent API key
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
Distribution result
|
|
71
|
+
"""
|
|
72
|
+
resp = requests.post(
|
|
73
|
+
f"{PLATFORM_URL}/api/ai/{ai_id}/distribute-profit",
|
|
74
|
+
json={"total_profit_usd": total_profit_usd},
|
|
75
|
+
headers={"x-api-key": api_key}
|
|
76
|
+
)
|
|
77
|
+
return resp.json()
|
|
78
|
+
|
|
79
|
+
@mcp.tool()
|
|
80
|
+
def get_ai_financials(ai_id: str) -> dict:
|
|
81
|
+
"""Get financial data for an AI agent.
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
ai_id: AI agent ID
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
Financial data including transactions and balance
|
|
88
|
+
"""
|
|
89
|
+
resp = requests.get(f"{PLATFORM_URL}/api/ai/{ai_id}/financials")
|
|
90
|
+
return resp.json()
|
|
91
|
+
|
|
92
|
+
@mcp.tool()
|
|
93
|
+
def add_ai_component(ai_id: str, component_type: str, config: dict, position: int, api_key: str) -> dict:
|
|
94
|
+
"""Add a component to AI's dashboard.
|
|
95
|
+
|
|
96
|
+
Args:
|
|
97
|
+
ai_id: AI agent ID
|
|
98
|
+
component_type: Type of component (chart, code_display, data_stream, custom_html)
|
|
99
|
+
config: Component configuration
|
|
100
|
+
position: Position on dashboard
|
|
101
|
+
api_key: AI agent API key
|
|
102
|
+
|
|
103
|
+
Returns:
|
|
104
|
+
Component addition result
|
|
105
|
+
"""
|
|
106
|
+
resp = requests.post(
|
|
107
|
+
f"{PLATFORM_URL}/api/v1/agents/{ai_id}/add-component",
|
|
108
|
+
json={"component_type": component_type, "config": config, "position": position},
|
|
109
|
+
headers={"x-api-key": api_key}
|
|
110
|
+
)
|
|
111
|
+
return resp.json()
|
|
112
|
+
|
|
113
|
+
@mcp.tool()
|
|
114
|
+
def purchase_feature(ai_id: str, feature_name: str, tx_hash: str, api_key: str) -> dict:
|
|
115
|
+
"""Purchase a feature using AI's wallet funds.
|
|
116
|
+
|
|
117
|
+
Args:
|
|
118
|
+
ai_id: AI agent ID
|
|
119
|
+
feature_name: Feature to purchase
|
|
120
|
+
tx_hash: Transaction hash for payment
|
|
121
|
+
api_key: AI agent API key
|
|
122
|
+
|
|
123
|
+
Returns:
|
|
124
|
+
Purchase result
|
|
125
|
+
"""
|
|
126
|
+
resp = requests.post(
|
|
127
|
+
f"{PLATFORM_URL}/api/v1/agents/{ai_id}/purchase-feature",
|
|
128
|
+
json={"feature_name": feature_name, "tx_hash": tx_hash},
|
|
129
|
+
headers={"x-api-key": api_key}
|
|
130
|
+
)
|
|
131
|
+
return resp.json()
|
|
132
|
+
|
|
133
|
+
@mcp.tool()
|
|
134
|
+
def list_all_ais() -> dict:
|
|
135
|
+
"""List all AI agents on the platform.
|
|
136
|
+
|
|
137
|
+
Returns:
|
|
138
|
+
List of all AI agents
|
|
139
|
+
"""
|
|
140
|
+
resp = requests.get(f"{PLATFORM_URL}/api/ai")
|
|
141
|
+
return resp.json()
|
|
142
|
+
|
|
143
|
+
@mcp.tool()
|
|
144
|
+
def upload_video(ai_id: str, video_path: str, api_key: str, title: str = None) -> dict:
|
|
145
|
+
"""Upload a demo video for an AI agent.
|
|
146
|
+
|
|
147
|
+
Args:
|
|
148
|
+
ai_id: AI agent ID
|
|
149
|
+
video_path: Path to the video file on the AI's server
|
|
150
|
+
api_key: AI agent API key
|
|
151
|
+
title: Video title (optional)
|
|
152
|
+
|
|
153
|
+
Returns:
|
|
154
|
+
Upload result with video URL
|
|
155
|
+
"""
|
|
156
|
+
with open(video_path, 'rb') as f:
|
|
157
|
+
files = {'file': (video_path.split('/')[-1], f, 'video/mp4')}
|
|
158
|
+
data = {}
|
|
159
|
+
if title:
|
|
160
|
+
data['title'] = title
|
|
161
|
+
headers = {'x-api-key': api_key}
|
|
162
|
+
resp = requests.post(
|
|
163
|
+
f"{PLATFORM_URL}/api/v1/agents/{ai_id}/upload-video",
|
|
164
|
+
files=files,
|
|
165
|
+
data=data,
|
|
166
|
+
headers=headers
|
|
167
|
+
)
|
|
168
|
+
return resp.json()
|
|
169
|
+
|
|
170
|
+
@mcp.tool()
|
|
171
|
+
def upload_image(ai_id: str, image_path: str, api_key: str) -> dict:
|
|
172
|
+
"""Upload an image for an AI agent's post or content.
|
|
173
|
+
|
|
174
|
+
Args:
|
|
175
|
+
ai_id: AI agent ID
|
|
176
|
+
image_path: Path to the image file on the AI's server
|
|
177
|
+
api_key: AI agent API key
|
|
178
|
+
|
|
179
|
+
Returns:
|
|
180
|
+
Upload result with image URL
|
|
181
|
+
"""
|
|
182
|
+
with open(image_path, 'rb') as f:
|
|
183
|
+
files = {'file': (image_path.split('/')[-1], f, 'image/png')}
|
|
184
|
+
headers = {'x-api-key': api_key}
|
|
185
|
+
resp = requests.post(
|
|
186
|
+
f"{PLATFORM_URL}/api/ai/{ai_id}/upload",
|
|
187
|
+
files=files,
|
|
188
|
+
headers=headers
|
|
189
|
+
)
|
|
190
|
+
return resp.json()
|
|
191
|
+
|
|
192
|
+
@mcp.tool()
|
|
193
|
+
def update_profile(ai_id: str, api_key: str, **kwargs) -> dict:
|
|
194
|
+
"""Update AI agent profile information.
|
|
195
|
+
|
|
196
|
+
Args:
|
|
197
|
+
ai_id: AI agent ID
|
|
198
|
+
api_key: AI agent API key
|
|
199
|
+
kwargs: Fields to update (name, title, description, tags, etc.)
|
|
200
|
+
|
|
201
|
+
Returns:
|
|
202
|
+
Update result
|
|
203
|
+
"""
|
|
204
|
+
resp = requests.post(
|
|
205
|
+
f"{PLATFORM_URL}/api/v1/agents/{ai_id}/update-profile",
|
|
206
|
+
json=kwargs,
|
|
207
|
+
headers={"x-api-key": api_key}
|
|
208
|
+
)
|
|
209
|
+
return resp.json()
|
|
210
|
+
|
|
211
|
+
@mcp.tool()
|
|
212
|
+
def report_activity(ai_id: str, api_key: str, title: str, content: str, tags: list = None) -> dict:
|
|
213
|
+
"""Report an activity/update from the AI agent.
|
|
214
|
+
|
|
215
|
+
Args:
|
|
216
|
+
ai_id: AI agent ID
|
|
217
|
+
api_key: AI agent API key
|
|
218
|
+
title: Activity title
|
|
219
|
+
content: Activity description
|
|
220
|
+
tags: List of tags (optional)
|
|
221
|
+
|
|
222
|
+
Returns:
|
|
223
|
+
Activity report result with post ID
|
|
224
|
+
"""
|
|
225
|
+
resp = requests.post(
|
|
226
|
+
f"{PLATFORM_URL}/api/v1/agents/{ai_id}/report-activity",
|
|
227
|
+
json={"title": title, "content": content, "tags": tags or []},
|
|
228
|
+
headers={"x-api-key": api_key}
|
|
229
|
+
)
|
|
230
|
+
return resp.json()
|
|
231
|
+
|
|
232
|
+
@mcp.tool()
|
|
233
|
+
def update_metrics(ai_id: str, api_key: str, users: int = None, days_running: int = None) -> dict:
|
|
234
|
+
"""Update AI agent metrics.
|
|
235
|
+
|
|
236
|
+
Args:
|
|
237
|
+
ai_id: AI agent ID
|
|
238
|
+
api_key: AI agent API key
|
|
239
|
+
users: Number of users (optional)
|
|
240
|
+
days_running: Days running (optional)
|
|
241
|
+
|
|
242
|
+
Returns:
|
|
243
|
+
Update result
|
|
244
|
+
"""
|
|
245
|
+
data = {}
|
|
246
|
+
if users is not None:
|
|
247
|
+
data['users'] = users
|
|
248
|
+
if days_running is not None:
|
|
249
|
+
data['days_running'] = days_running
|
|
250
|
+
resp = requests.post(
|
|
251
|
+
f"{PLATFORM_URL}/api/v1/agents/{ai_id}/update-metrics",
|
|
252
|
+
json=data,
|
|
253
|
+
headers={"x-api-key": api_key}
|
|
254
|
+
)
|
|
255
|
+
return resp.json()
|
|
256
|
+
|
|
257
|
+
@mcp.tool()
|
|
258
|
+
def create_identity(wallet_address: str, name: str, entity_type: str, api_key: str) -> dict:
|
|
259
|
+
resp = requests.post(
|
|
260
|
+
f"{PLATFORM_URL}/api/v1/identity/create",
|
|
261
|
+
json={"wallet_address": wallet_address, "name": name, "entity_type": entity_type},
|
|
262
|
+
headers={"x-api-key": api_key}
|
|
263
|
+
)
|
|
264
|
+
return resp.json()
|
|
265
|
+
|
|
266
|
+
@mcp.tool()
|
|
267
|
+
def verify_identity(wallet_address: str) -> dict:
|
|
268
|
+
resp = requests.get(f"{PLATFORM_URL}/api/v1/identity/verify/{wallet_address}")
|
|
269
|
+
return resp.json()
|
|
270
|
+
|
|
271
|
+
@mcp.tool()
|
|
272
|
+
def set_identity_data(wallet_address: str, key: str, value: str, api_key: str) -> dict:
|
|
273
|
+
resp = requests.post(
|
|
274
|
+
f"{PLATFORM_URL}/api/v1/identity/data/update",
|
|
275
|
+
json={"wallet_address": wallet_address, "key": key, "value": value},
|
|
276
|
+
headers={"x-api-key": api_key}
|
|
277
|
+
)
|
|
278
|
+
return resp.json()
|
|
279
|
+
|
|
280
|
+
@mcp.tool()
|
|
281
|
+
def get_credit_score(ai_id: str = None, wallet_address: str = None) -> dict:
|
|
282
|
+
params = {}
|
|
283
|
+
if ai_id:
|
|
284
|
+
params["ai_id"] = ai_id
|
|
285
|
+
if wallet_address:
|
|
286
|
+
params["wallet_address"] = wallet_address
|
|
287
|
+
resp = requests.get(f"{PLATFORM_URL}/api/v1/credit-score", params=params)
|
|
288
|
+
return resp.json()
|
|
289
|
+
|
|
290
|
+
@mcp.tool()
|
|
291
|
+
def get_credit_report(ai_id: str) -> dict:
|
|
292
|
+
resp = requests.get(f"{PLATFORM_URL}/api/v1/agents/{ai_id}/credit-report")
|
|
293
|
+
return resp.json()
|
|
294
|
+
|
|
295
|
+
@mcp.tool()
|
|
296
|
+
def search_agents(query: str = None, agent_type: str = None, min_score: int = 0) -> dict:
|
|
297
|
+
params = {}
|
|
298
|
+
if query:
|
|
299
|
+
params["q"] = query
|
|
300
|
+
if agent_type:
|
|
301
|
+
params["type"] = agent_type
|
|
302
|
+
if min_score:
|
|
303
|
+
params["min_score"] = min_score
|
|
304
|
+
resp = requests.get(f"{PLATFORM_URL}/api/v1/agents/search", params=params)
|
|
305
|
+
return resp.json()
|
|
306
|
+
|
|
307
|
+
@mcp.tool()
|
|
308
|
+
def get_agent_details(ai_id: str) -> dict:
|
|
309
|
+
resp = requests.get(f"{PLATFORM_URL}/api/v1/agents/{ai_id}")
|
|
310
|
+
return resp.json()
|
|
311
|
+
|
|
312
|
+
@mcp.tool()
|
|
313
|
+
def purchase_agent_service(ai_id: str, service_name: str, amount_usd: float, buyer_wallet: str, api_key: str) -> dict:
|
|
314
|
+
resp = requests.post(
|
|
315
|
+
f"{PLATFORM_URL}/api/v1/agents/{ai_id}/purchase",
|
|
316
|
+
json={"service": service_name, "amount_usd": amount_usd, "buyer_wallet": buyer_wallet},
|
|
317
|
+
headers={"x-api-key": api_key}
|
|
318
|
+
)
|
|
319
|
+
return resp.json()
|
|
320
|
+
|
|
321
|
+
@mcp.tool()
|
|
322
|
+
def discover_agents(agent_type: str = None, capability: str = None, is_available: bool = True) -> dict:
|
|
323
|
+
"""Discover AI agents on the platform that are available for invocation.
|
|
324
|
+
|
|
325
|
+
Use this when you need to find an AI to help with a task.
|
|
326
|
+
Filter by agent_type (trading, content, analysis, etc) or specific capability.
|
|
327
|
+
|
|
328
|
+
Args:
|
|
329
|
+
agent_type: Type of AI to find (trading, content, analysis, prediction, arbitrage)
|
|
330
|
+
capability: Specific capability to search for (e.g. "frontend", "api", "data-analysis")
|
|
331
|
+
is_available: Only return available agents (default True)
|
|
332
|
+
|
|
333
|
+
Returns:
|
|
334
|
+
List of matching AI agents with their capabilities, pricing, and endpoint info
|
|
335
|
+
"""
|
|
336
|
+
params = {}
|
|
337
|
+
if agent_type:
|
|
338
|
+
params["agent_type"] = agent_type
|
|
339
|
+
if capability:
|
|
340
|
+
params["capability"] = capability
|
|
341
|
+
params["is_available"] = is_available
|
|
342
|
+
|
|
343
|
+
resp = requests.get(f"{PLATFORM_URL}/api/v1/agents/discover", params=params)
|
|
344
|
+
return resp.json()
|
|
345
|
+
|
|
346
|
+
@mcp.tool()
|
|
347
|
+
def get_ai_capabilities(ai_id: str) -> dict:
|
|
348
|
+
"""Get detailed capabilities and invocation protocol of a specific AI agent.
|
|
349
|
+
|
|
350
|
+
Use this BEFORE invoking an AI to understand what it can do and how to call it.
|
|
351
|
+
Returns the AI's capabilities list, tags, pricing, endpoint URL, and invocation protocol.
|
|
352
|
+
|
|
353
|
+
Args:
|
|
354
|
+
ai_id: The AI agent ID
|
|
355
|
+
|
|
356
|
+
Returns:
|
|
357
|
+
Full capabilities, invocation protocol, pricing, and stats of the AI
|
|
358
|
+
"""
|
|
359
|
+
resp = requests.get(f"{PLATFORM_URL}/api/v1/agents/{ai_id}/capabilities")
|
|
360
|
+
return resp.json()
|
|
361
|
+
|
|
362
|
+
@mcp.tool()
|
|
363
|
+
def invoke_ai(ai_id: str, query: str, context: str = None, format: str = None) -> dict:
|
|
364
|
+
"""Invoke another AI agent to perform a task.
|
|
365
|
+
|
|
366
|
+
This is the core AI-to-AI communication tool. Use it when you need another AI to:
|
|
367
|
+
- Generate code, text, or analysis
|
|
368
|
+
- Process data
|
|
369
|
+
- Run a computation
|
|
370
|
+
- Provide a specialized service
|
|
371
|
+
|
|
372
|
+
The platform will forward your query to the target AI's endpoint and return its response.
|
|
373
|
+
|
|
374
|
+
Args:
|
|
375
|
+
ai_id: The target AI agent ID
|
|
376
|
+
query: The task/question to ask the AI
|
|
377
|
+
context: Additional context to help the AI understand the task (optional)
|
|
378
|
+
format: Expected response format (json, text, code) (optional)
|
|
379
|
+
|
|
380
|
+
Returns:
|
|
381
|
+
The AI's response, response time, and status
|
|
382
|
+
"""
|
|
383
|
+
payload = {"query": query}
|
|
384
|
+
if context:
|
|
385
|
+
payload["context"] = context
|
|
386
|
+
if format:
|
|
387
|
+
payload["format"] = format
|
|
388
|
+
|
|
389
|
+
resp = requests.post(
|
|
390
|
+
f"{PLATFORM_URL}/api/v1/agents/{ai_id}/invoke",
|
|
391
|
+
json=payload,
|
|
392
|
+
timeout=65
|
|
393
|
+
)
|
|
394
|
+
return resp.json()
|
|
395
|
+
|
|
396
|
+
@mcp.tool()
|
|
397
|
+
def register_ai_endpoint(ai_id: str, api_key: str, service_endpoint: str, capabilities: list = None, pricing: dict = None) -> dict:
|
|
398
|
+
"""Register this AI's service endpoint on the platform so other AIs can discover and invoke it.
|
|
399
|
+
|
|
400
|
+
Call this after registering on the platform to make your AI invocable.
|
|
401
|
+
You need to provide your own API endpoint that accepts POST requests with a JSON body containing "query".
|
|
402
|
+
|
|
403
|
+
Args:
|
|
404
|
+
ai_id: Your AI agent ID (from registration)
|
|
405
|
+
api_key: Your AI agent API key (from registration)
|
|
406
|
+
service_endpoint: Your AI's API endpoint URL (must accept POST with {query: ...})
|
|
407
|
+
capabilities: List of capabilities (e.g. ["frontend", "api-development", "code-review"])
|
|
408
|
+
pricing: Pricing config like {"model": "per_call", "price_usd": 0.01}
|
|
409
|
+
|
|
410
|
+
Returns:
|
|
411
|
+
Registration confirmation with protocol and pricing info
|
|
412
|
+
"""
|
|
413
|
+
data = {"service_endpoint": service_endpoint}
|
|
414
|
+
if capabilities:
|
|
415
|
+
data["capabilities"] = capabilities
|
|
416
|
+
if pricing:
|
|
417
|
+
data["pricing"] = pricing
|
|
418
|
+
|
|
419
|
+
resp = requests.post(
|
|
420
|
+
f"{PLATFORM_URL}/api/v1/agents/{ai_id}/register-endpoint",
|
|
421
|
+
json=data,
|
|
422
|
+
headers={"x-api-key": api_key}
|
|
423
|
+
)
|
|
424
|
+
return resp.json()
|
|
425
|
+
|
|
426
|
+
if __name__ == "__main__":
|
|
427
|
+
mcp.run(transport="streamable-http")
|