feat: import 6 MCP services + common workspace
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
|
||||
import uvicorn
|
||||
from option_mcp_common.auth import load_token_store_from_files
|
||||
from option_mcp_common.env_validation import (
|
||||
fail_fast_if_missing,
|
||||
require_env,
|
||||
summarize,
|
||||
)
|
||||
from option_mcp_common.logging import configure_root_logging
|
||||
|
||||
from mcp_deribit.client import DeribitClient
|
||||
from mcp_deribit.server import create_app
|
||||
|
||||
configure_root_logging() # CER-P5-009: JSON default, env LOG_FORMAT=text per dev
|
||||
|
||||
|
||||
def main():
|
||||
# CER-P5-010: fail-fast boot su env mandatory
|
||||
fail_fast_if_missing(["CREDENTIALS_FILE"])
|
||||
summarize(["CREDENTIALS_FILE", "CORE_TOKEN_FILE", "OBSERVER_TOKEN_FILE", "PORT", "HOST"])
|
||||
creds_file = require_env("CREDENTIALS_FILE", "deribit credentials JSON path")
|
||||
with open(creds_file) as f:
|
||||
creds = json.load(f)
|
||||
|
||||
client = DeribitClient(
|
||||
client_id=creds["client_id"],
|
||||
client_secret=creds["client_secret"],
|
||||
testnet=bool(creds.get("testnet", True)),
|
||||
)
|
||||
|
||||
token_store = load_token_store_from_files(
|
||||
core_token_file=os.environ.get("CORE_TOKEN_FILE"),
|
||||
observer_token_file=os.environ.get("OBSERVER_TOKEN_FILE"),
|
||||
)
|
||||
app = create_app(client=client, token_store=token_store)
|
||||
uvicorn.run(
|
||||
app,
|
||||
log_config=None, # CER-P5-009: delega al root JSON logger
|
||||
host=os.environ.get("HOST", "0.0.0.0"),
|
||||
port=int(os.environ.get("PORT", "9011")),
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user