#!/usr/bin/env python3
"""Test script to check if main server.py has OKR tools."""
import sys
import os
# Add the current directory to Python path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
def test_main_server_structure():
"""Test if main server.py has the correct structure."""
try:
print("Testing main server.py structure...")
# Read the server.py file and check for OKR tools
with open('server.py', 'r') as f:
content = f.read()
# Check for OKR-related function definitions
okr_indicators = [
'async def create_objective',
'async def create_key_result',
'async def update_objective',
'async def update_key_result',
'async def get_objectives_by_board_id',
'async def get_key_results_by_objective_id',
'async def connect_activities_to_key_result',
'async def create_activity',
'async def list_activities'
]
print("\nChecking for OKR functions in server.py:")
found_count = 0
for indicator in okr_indicators:
if indicator in content:
print(f" ✓ Found: {indicator}")
found_count += 1
else:
print(f" ✗ Missing: {indicator}")
# Check for tool decorators
tool_decorators = content.count('@mcp.tool()')
print(f"\nTool decorators found: {tool_decorators}")
# Check for import statements
import_okr = 'okr' in content and 'from agileplace_mcp.tools import' in content
import_activities = 'okr_activities' in content and 'from agileplace_mcp.tools import' in content
print(f"\nImport statements:")
print(f" ✓ OKR tools imported: {import_okr}")
print(f" ✓ Activity tools imported: {import_activities}")
# Check if tools directory exists and has OKR files
tools_dir = 'tools'
if os.path.exists(tools_dir):
tools_files = os.listdir(tools_dir)
okr_files = [f for f in tools_files if 'okr' in f]
print(f"\nTools directory files: {tools_files}")
print(f"OKR-related files: {okr_files}")
else:
print(f"\n✗ Tools directory not found!")
return False
if found_count >= 8 and import_okr and import_activities:
print(f"\n✓ Main server.py appears to have OKR tools!")
return True
else:
print(f"\n✗ Main server.py missing OKR tools!")
return False
except Exception as e:
print(f"✗ Error: {e}")
return False
def test_can_import_modules():
"""Test if we can import the modules without FastMCP."""
try:
print("\nTesting module imports...")
# Test importing tools
from agileplace_mcp.tools import okr, okr_activities
print(" ✓ Can import okr module")
print(" ✓ Can import okr_activities module")
# Test importing models
from agileplace_mcp.models import Objective, KeyResult, WorkItemContainer
print(" ✓ Can import models")
return True
except ImportError as e:
print(f" ✗ Import error: {e}")
return False
except Exception as e:
print(f" ✗ Error: {e}")
return False
if __name__ == "__main__":
print("Testing AgilePlace MCP Server - Main Server")
print("=" * 50)
structure_ok = test_main_server_structure()
imports_ok = test_can_import_modules()
if structure_ok and imports_ok:
print("\n✓ All tests passed!")
print("\nThe main server.py should now have the OKR tools.")
print("You may need to restart Claude Desktop for the changes to take effect.")
else:
print("\n✗ Some tests failed!")
sys.exit(1)