Skip to main content
Glama
test_connection.py1.36 kB
#!/usr/bin/env python3 """Test Neo4j connection""" from neo4j import GraphDatabase import os from dotenv import load_dotenv # Load environment variables load_dotenv() uri = os.getenv('NEO4J_URI') user = os.getenv('NEO4J_USER') pwd = os.getenv('NEO4J_PASSWORD') print("=" * 50) print("Neo4j Connection Test") print("=" * 50) print(f"URI: {uri}") print(f"User: {user}") print(f"Password: {'*' * len(pwd) if pwd else 'NOT SET'}") print() print("Testing connection...") try: driver = GraphDatabase.driver(uri, auth=(user, pwd)) driver.verify_connectivity() print("[SUCCESS] Connected to Neo4j!") print() # Test a simple query print("Testing query...") with driver.session() as session: result = session.run("RETURN 1 as test") record = result.single() print(f"[SUCCESS] Query result: {record['test']}") print() print("=" * 50) print("Connection test completed successfully!") print("=" * 50) driver.close() except Exception as e: print(f"[ERROR] {e}") print() print("Troubleshooting:") print("1. Check your .env file has correct NEO4J_URI, NEO4J_USER, NEO4J_PASSWORD") print("2. Verify the database is running") print("3. Check firewall settings") print("4. For Aura Free tier, IP filtering is not available - should work from any IP") exit(1)

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/apexneural-hansika/graphiti_mcp'

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