autoreg-skills-max: initial public release (restored, redacted, hardened)
This commit is contained in:
66
skills/atxp-autoreg/scripts/batch-mcp-inbox-check.py
Normal file
66
skills/atxp-autoreg/scripts/batch-mcp-inbox-check.py
Normal file
@@ -0,0 +1,66 @@
|
||||
# Batch MCP Inbox Check Script
|
||||
|
||||
## Purpose
|
||||
Check email inbox for all accounts in the pool via direct MCP API calls.
|
||||
|
||||
## Script (Python)
|
||||
```python
|
||||
import json, re, urllib.request, urllib.error
|
||||
|
||||
with open('C:/workspace/atxp-pool.json', 'r', encoding='utf-8') as f:
|
||||
data = json.load(f)
|
||||
|
||||
total_with_messages = 0
|
||||
for i, acc in enumerate(data):
|
||||
cs = acc.get('connection_string', '')
|
||||
match = re.search(r'connection_token=([^&]+)', cs)
|
||||
token = [REDACTED]) if match else None
|
||||
acct_id = acc.get('atxp_account_id')
|
||||
|
||||
if not token:
|
||||
[REDACTED]
|
||||
|
||||
auth = f'https://accounts.atxp.ai?connection_token={token}&account_id={acct_id}'
|
||||
body = json.dumps({
|
||||
'jsonrpc': '2.0',
|
||||
'id': 1,
|
||||
'method': 'tools/call',
|
||||
'params': {'name': 'email_check_inbox', 'arguments': {}}
|
||||
}).encode()
|
||||
|
||||
req = urllib.request.Request(
|
||||
'https://email.mcp.atxp.ai/',
|
||||
data=body,
|
||||
headers={
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json, text/event-stream',
|
||||
'Authorization': f'Bearer {auth}'
|
||||
}
|
||||
)
|
||||
|
||||
try:
|
||||
with urllib.request.urlopen(req, timeout=10) as resp:
|
||||
result = resp.read().decode()
|
||||
for line in result.split('\n'):
|
||||
if line.startswith('data: '):
|
||||
msg_data = json.loads(line[6:])
|
||||
content = msg_data.get('result', {}).get('content', [{}])[0].get('text', '{}')
|
||||
inbox = json.loads(content)
|
||||
msgs = inbox.get('messages', [])
|
||||
if msgs:
|
||||
total_with_messages += 1
|
||||
print(f'{i}: {acct_id} | messages: {len(msgs)}')
|
||||
for m in msgs[:2]:
|
||||
print(f' - {m.get("subject", "no subject")[:50]} from {m.get("from", "unknown")}')
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
print(f'\nTotal accounts with messages: {total_with_messages} / {len(data)}')
|
||||
```
|
||||
|
||||
## Notes
|
||||
- Requires `Accept: application/json, text/event-stream` header
|
||||
- Response is SSE format: `event: message\ndata: {...}`
|
||||
- Works for all account types (main and agent)
|
||||
- FREE operation (no cost)
|
||||
- Timeout 10s per request is sufficient
|
||||
Reference in New Issue
Block a user