Skip to main content
Glama
by hsgui
run_mcp_server.py1.5 kB
from __future__ import annotations import argparse import sys from pathlib import Path from typing import Any ROOT_DIR = Path(__file__).resolve().parents[1] sys.path.insert(0, str(ROOT_DIR)) from app.mcp.server import mcp def parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser(description="Run the Daily Work MCP server") parser.add_argument( "--transport", choices=["stdio", "http", "sse", "streamable-http"], help="Transport protocol to use (default: stdio)", ) parser.add_argument("--host", help="Host to bind when使用 HTTP/SSE/Streamable transports") parser.add_argument( "--port", type=int, help="Port to bind when使用 HTTP/SSE/Streamable transports", ) parser.add_argument( "--path", help="Path prefix for HTTP transports (optional)", ) return parser.parse_args() def main() -> None: args = parse_args() run_kwargs: dict[str, Any] = {} if args.transport: run_kwargs["transport"] = args.transport if args.host: run_kwargs["host"] = args.host if args.port: run_kwargs["port"] = args.port if args.path: run_kwargs["path"] = args.path if args.transport in {"http", "streamable-http"}: # Streamable HTTP 默认需要 session ID。启用 stateless 模式即可让 /mcp 无需登录态。 run_kwargs["stateless_http"] = True mcp.run(**run_kwargs) if __name__ == "__main__": main()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hsgui/daily-work-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server