Skip to main content
Glama

Project Synapse

test_setup.pyโ€ข6.24 kB
#!/usr/bin/env python3 """ Quick test script to verify Project Synapse setup and basic functionality. """ import asyncio import sys import os from pathlib import Path # Add src to path for imports sys.path.insert(0, str(Path(__file__).parent / 'src')) async def test_basic_imports(): """Test that all core modules can be imported.""" print("๐Ÿงช Testing basic imports...") try: from synapse_mcp.utils.logging_config import setup_logging print("โœ… Logging config import OK") from synapse_mcp.data_pipeline.text_processor import TextProcessor print("โœ… Text processor import OK") from synapse_mcp.semantic.montague_parser import MontagueParser print("โœ… Montague parser import OK") from synapse_mcp.core.knowledge_graph import KnowledgeGraph print("โœ… Knowledge graph import OK") from synapse_mcp.zettelkasten.insight_engine import InsightEngine print("โœ… Insight engine import OK") from synapse_mcp.knowledge.knowledge_types import Entity, Fact, Insight print("โœ… Knowledge types import OK") return True except ImportError as e: print(f"โŒ Import failed: {e}") return False async def test_text_processor(): """Test text processor basic functionality.""" print("\n๐Ÿงช Testing text processor...") try: from synapse_mcp.data_pipeline.text_processor import TextProcessor processor = TextProcessor() await processor.initialize() # Test basic text processing test_text = "This is a test sentence. It contains some information." result = await processor.process_text(test_text, "test") assert 'text_id' in result assert 'sentences' in result assert 'facts' in result assert len(result['facts']) > 0 print("โœ… Text processor functionality OK") return True except Exception as e: print(f"โŒ Text processor test failed: {e}") return False async def test_montague_parser(): """Test Montague parser without spaCy if not available.""" print("\n๐Ÿงช Testing Montague parser...") try: from synapse_mcp.semantic.montague_parser import MontagueParser parser = MontagueParser() # Test if spaCy is available try: await parser.initialize() # Test basic parsing test_text = "John likes apples." result = await parser.parse_text(test_text) assert 'entities' in result assert 'relations' in result assert 'logical_form' in result print("โœ… Montague parser with spaCy OK") except OSError: print("โš ๏ธ spaCy model not available - run: uv run python -m spacy download en_core_web_sm") print("โœ… Montague parser structure OK") return True except Exception as e: print(f"โŒ Montague parser test failed: {e}") return False async def test_knowledge_types(): """Test knowledge type classes.""" print("\n๐Ÿงช Testing knowledge types...") try: from synapse_mcp.knowledge.knowledge_types import Entity, Fact, Insight, KnowledgeUtils # Test entity creation entity = Entity( id="test_entity", name="Test Entity", type="Test", confidence=0.9 ) assert entity.id == "test_entity" assert entity.confidence == 0.9 # Test fact creation fact = Fact( id="test_fact", content="This is a test fact", confidence=0.8 ) assert fact.content == "This is a test fact" # Test utilities entity_id = KnowledgeUtils.generate_entity_id("Test Name", "Person") assert entity_id.startswith("person_") print("โœ… Knowledge types functionality OK") return True except Exception as e: print(f"โŒ Knowledge types test failed: {e}") return False async def test_server_structure(): """Test that server can be imported and structured correctly.""" print("\n๐Ÿงช Testing server structure...") try: from synapse_mcp.server import mcp, SynapseServer # Check that MCP server is configured assert mcp is not None assert hasattr(mcp, 'run') # Check that server class exists server = SynapseServer() assert hasattr(server, 'initialize') assert hasattr(server, 'cleanup') print("โœ… Server structure OK") return True except Exception as e: print(f"โŒ Server structure test failed: {e}") return False async def main(): """Run all tests.""" print("๐Ÿง  Project Synapse - Quick Setup Test") print("=" * 50) tests = [ test_basic_imports, test_text_processor, test_montague_parser, test_knowledge_types, test_server_structure ] results = [] for test in tests: try: result = await test() results.append(result) except Exception as e: print(f"โŒ Test failed with exception: {e}") results.append(False) print("\n" + "=" * 50) passed = sum(results) total = len(results) if passed == total: print(f"๐ŸŽ‰ All tests passed ({passed}/{total})!") print("\nโœ… Project Synapse is ready to run") print("\nNext steps:") print("1. Start Neo4j: sudo systemctl start neo4j") print("2. Configure .env file") print("3. Run server: uv run python -m synapse_mcp.server") return 0 else: print(f"โš ๏ธ Some tests failed ({passed}/{total})") print("\nPlease fix the issues above before running the server.") return 1 if __name__ == "__main__": exit_code = asyncio.run(main()) sys.exit(exit_code)

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/angrysky56/project-synapse-mcp'

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