MCPcopy
hub / github.com/vectorize-io/hindsight / Server

Class Server

hindsight-all/hindsight/server.py:32–217  ·  view source on GitHub ↗

Hindsight server that runs in a background thread. Example: ```python from hindsight import Server server = Server( db_url="pg0", llm_provider="groq", llm_api_key="your-api-key", llm_model="openai/gpt-oss-120b"

Source from the content-addressed store, hash-verified

30
31
32class Server:
33 """
34 Hindsight server that runs in a background thread.
35
36 Example:
37 ```python
38 from hindsight import Server
39
40 server = Server(
41 db_url="pg0",
42 llm_provider="groq",
43 llm_api_key="your-api-key",
44 llm_model="openai/gpt-oss-120b"
45 )
46 server.start()
47
48 print(f"Server running at {server.url}")
49
50 # Use the server...
51
52 server.stop()
53 ```
54 """
55
56 def __init__(
57 self,
58 db_url: str = "pg0",
59 llm_provider: str = "groq",
60 llm_api_key: str = "",
61 llm_model: str = "openai/gpt-oss-120b",
62 llm_base_url: Optional[str] = None,
63 host: str = "127.0.0.1",
64 port: Optional[int] = None,
65 mcp_enabled: bool = False,
66 log_level: str = "info",
67 ):
68 """
69 Initialize the Hindsight server.
70
71 Args:
72 db_url: Database URL. Use "pg0" for embedded PostgreSQL.
73 llm_provider: LLM provider ("groq", "openai", "ollama", "gemini", "anthropic", "lmstudio")
74 llm_api_key: API key for the LLM provider
75 llm_model: Model name to use
76 llm_base_url: Optional custom base URL for LLM API
77 host: Host to bind to (default: 127.0.0.1)
78 port: Port to bind to (default: auto-select free port)
79 mcp_enabled: Whether to enable MCP server
80 log_level: Uvicorn log level (default: warning)
81 """
82 self.db_url = db_url
83 self.llm_provider = llm_provider
84 self.llm_api_key = llm_api_key
85 self.llm_model = llm_model
86 self.llm_base_url = llm_base_url
87 self.host = host
88 self.port = port or _find_free_port()
89 self.mcp_enabled = mcp_enabled

Callers 1

start_serverFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected