45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
from fastapi import FastAPI
|
|
import os
|
|
|
|
app = FastAPI(
|
|
title="Cryptophys MCP Server",
|
|
description="Model Context Protocol Server for Cryptophys Platform",
|
|
version="1.0.0"
|
|
)
|
|
|
|
@app.get("/healthz")
|
|
def healthz():
|
|
return {"status": "ok", "service": "cryptophys-mcp"}
|
|
|
|
@app.get("/")
|
|
def root():
|
|
return {
|
|
"message": "Cryptophys MCP Server",
|
|
"version": "1.0.0",
|
|
"autonomous": True,
|
|
"gitops": True
|
|
}
|
|
|
|
@app.post("/mcp")
|
|
async def mcp_endpoint(request: dict = {}):
|
|
method = request.get("method", "")
|
|
|
|
if method == "tools/list":
|
|
return {
|
|
"jsonrpc": "2.0",
|
|
"result": {
|
|
"tools": [
|
|
{"name": "read_ssot", "description": "Read from SSOT"},
|
|
{"name": "write_ledger", "description": "Write to ledger"},
|
|
{"name": "query_k8s", "description": "Query Kubernetes resources"}
|
|
]
|
|
},
|
|
"id": request.get("id", 1)
|
|
}
|
|
|
|
return {"jsonrpc": "2.0", "result": {}, "id": request.get("id", 1)}
|
|
|
|
if __name__ == "__main__":
|
|
import uvicorn
|
|
uvicorn.run(app, host="0.0.0.0", port=8088)
|