mirror of
https://github.com/haris-musa/excel-mcp-server.git
synced 2025-12-08 17:12:41 +08:00
40 lines
944 B
Python
40 lines
944 B
Python
import asyncio
|
|
import typer
|
|
|
|
from .server import run_sse, run_stdio
|
|
|
|
app = typer.Typer(help="Excel MCP Server")
|
|
|
|
@app.command()
|
|
def sse():
|
|
"""Start Excel MCP Server in SSE mode"""
|
|
print("Excel MCP Server - SSE mode")
|
|
print("----------------------")
|
|
print("Press Ctrl+C to exit")
|
|
try:
|
|
asyncio.run(run_sse())
|
|
except KeyboardInterrupt:
|
|
print("\nShutting down server...")
|
|
except Exception as e:
|
|
print(f"\nError: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
finally:
|
|
print("Service stopped.")
|
|
|
|
@app.command()
|
|
def stdio():
|
|
"""Start Excel MCP Server in stdio mode"""
|
|
try:
|
|
run_stdio()
|
|
except KeyboardInterrupt:
|
|
print("\nShutting down server...")
|
|
except Exception as e:
|
|
print(f"\nError: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
finally:
|
|
print("Service stopped.")
|
|
|
|
if __name__ == "__main__":
|
|
app() |