-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_server.py
More file actions
78 lines (63 loc) · 2.15 KB
/
test_server.py
File metadata and controls
78 lines (63 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python3
"""
Test script for Codebase State Manager MCP Server
"""
import sys
import os
from pathlib import Path
# Add src to path
project_root = Path(__file__).parent
sys.path.insert(0, str(project_root / "src"))
from mcp_server.config import get_settings, reset_settings
from mcp_server.repositories.sqlite_repository import create_sqlite_repositories
from mcp_server.services.git_manager import GitManager
from mcp_server.services.state_service import StateService
from mcp_server.tools import genesis, get_current_state_number, total_states
def main():
print("Testing Codebase State Manager MCP Server...")
# Reset settings to reload from env
reset_settings()
# Get settings
settings = get_settings()
print(f"Database mode: {settings.db_mode}")
print(f"NEO4J_ENABLED env: {os.getenv('NEO4J_ENABLED')}")
print(f"DB_MODE env: {os.getenv('DB_MODE')}")
# Create repositories
state_repo, transition_repo = create_sqlite_repositories(
path=settings.sqlite_path,
settings=settings,
)
# Create services
git_manager = GitManager()
state_service = StateService(
state_repo=state_repo,
transition_repo=transition_repo,
git_manager=git_manager,
settings=settings,
)
print("Services initialized successfully!")
# Test basic functions
try:
# Test genesis
print("\nTesting genesis...")
result = genesis(
state_service=state_service,
project_path=str(project_root),
volume_path="/tmp/test_volume",
)
print(f"Genesis result: {result}")
# Test current state
print("\nTesting get_current_state_number...")
result = get_current_state_number(state_service=state_service)
print(f"Current state: {result}")
# Test total states
print("\nTesting total_states...")
result = total_states(state_service=state_service)
print(f"Total states: {result}")
print("\nAll tests passed!")
except Exception as e:
print(f"Error: {e}")
import traceback
traceback.print_exc()
if __name__ == "__main__":
main()