feat: import 6 MCP services + common workspace
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
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.logging import configure_root_logging
|
||||
|
||||
from mcp_alpaca.client import AlpacaClient
|
||||
from mcp_alpaca.server import create_app
|
||||
|
||||
|
||||
configure_root_logging()
|
||||
|
||||
|
||||
def main():
|
||||
creds_file = os.environ["ALPACA_CREDENTIALS_FILE"]
|
||||
with open(creds_file) as f:
|
||||
creds = json.load(f)
|
||||
|
||||
paper_env = os.environ.get("ALPACA_PAPER", "true").lower()
|
||||
paper = paper_env not in ("0", "false", "no")
|
||||
|
||||
client = AlpacaClient(
|
||||
api_key=creds["api_key_id"],
|
||||
secret_key=creds["secret_key"],
|
||||
paper=paper,
|
||||
)
|
||||
|
||||
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,
|
||||
host=os.environ.get("HOST", "0.0.0.0"),
|
||||
port=int(os.environ.get("PORT", "9020")),
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user