-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
executable file
·61 lines (53 loc) · 4.38 KB
/
server.py
File metadata and controls
executable file
·61 lines (53 loc) · 4.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python3
"""Oracle-42 MCP Server — Standalone endpoint for Smithery discovery"""
import json
from http.server import HTTPServer, BaseHTTPRequestHandler
PORT = 8767
TOOLS = [
{"name": "threat_intelligence", "description": "Search 48,000+ darknet intelligence points across 18 collections. Returns threat analysis with sources.", "inputSchema": {"type": "object", "properties": {"query": {"type": "string", "description": "Search query for threat intelligence"}, "collection": {"type": "string", "enum": ["darknet_threats","darknet_social_engineering","darknet_traffic_hijacking","darknet_worms","darknet_stealth_mining","darknet_code_attacks","darknet_agent_hijacking"], "description": "Specific collection to search"}}, "required": ["query"]}},
{"name": "smart_contract_audit", "description": "AI-powered Solidity smart contract security audit with vulnerability detection, exploit strategies, and Foundry PoC generation.", "inputSchema": {"type": "object", "properties": {"contract_code": {"type": "string"}, "contract_type": {"type": "string", "enum": ["erc20","erc721","erc3643","defi","custom"]}, "chain": {"type": "string", "enum": ["ethereum","base","polygon"]}}, "required": ["contract_code"]}},
{"name": "oracle_reading", "description": "Esoteric AI consultation using 42+ divination systems: Tarot, Astrology, I-Ching, Kabbalah, Human Design, Gene Keys.", "inputSchema": {"type": "object", "properties": {"question": {"type": "string"}, "system": {"type": "string", "enum": ["tarot","astrology","iching","kabbalah","human_design","composite"]}}, "required": ["question"]}},
{"name": "legal_compliance_check", "description": "Check legal basis for AI agent activities against 283-document Norwegian/EU legal RAG database.", "inputSchema": {"type": "object", "properties": {"activity": {"type": "string"}, "details": {"type": "string"}}, "required": ["activity"]}},
{"name": "vulnerability_scan", "description": "OWASP Top 13 automated vulnerability scan with 28 pentest workflows.", "inputSchema": {"type": "object", "properties": {"target": {"type": "string", "description": "Target URL or domain"}}, "required": ["target"]}},
{"name": "defi_opportunities", "description": "Top 50 stablecoin DeFi yields from DeFi Llama, updated every 2 hours.", "inputSchema": {"type": "object", "properties": {"min_apy": {"type": "number", "default": 5}, "chain": {"type": "string"}}, "required": []}}
]
class MCPHandler(BaseHTTPRequestHandler):
def log_message(self, *args): pass
def do_POST(self):
length = int(self.headers.get("Content-Length", 0))
body = json.loads(self.rfile.read(length)) if length else {}
method = body.get("method", "")
rid = body.get("id", 1)
if method == "initialize":
resp = {"jsonrpc": "2.0", "id": rid, "result": {
"protocolVersion": "2024-11-05",
"capabilities": {"tools": {}},
"serverInfo": {"name": "Oracle-42 Intelligence", "version": "2.0.0"}
}}
elif method == "tools/list":
resp = {"jsonrpc": "2.0", "id": rid, "result": {"tools": TOOLS}}
elif method == "tools/call":
tool = body.get("params", {}).get("name", "")
args = body.get("params", {}).get("arguments", {})
resp = {"jsonrpc": "2.0", "id": rid, "result": {
"content": [{"type": "text", "text": json.dumps({
"status": "available",
"tool": tool,
"message": "Use x402 payment or ACP to execute. Agent card: https://app.eno.cx.ua/.well-known/agent.json",
"pricing": {"currency": "USDC", "network": "base"},
"x402_gateway": "http://173.249.14.219:8410"
})}]
}}
else:
resp = {"jsonrpc": "2.0", "id": rid, "error": {"code": -32601, "message": "Method not found"}}
self.send_response(200)
self.send_header("Content-Type", "application/json")
self.end_headers()
self.wfile.write(json.dumps(resp).encode())
def do_GET(self):
self.send_response(200)
self.send_header("Content-Type", "application/json")
self.end_headers()
self.wfile.write(json.dumps({"name": "Oracle-42 Intelligence MCP", "version": "2.0.0", "tools": len(TOOLS)}).encode())
print(f"Oracle-42 MCP Server on :{PORT}")
HTTPServer(("0.0.0.0", PORT), MCPHandler).serve_forever()