From 248ba74592fe4697d16746f38c382505e7e30685 Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Thu, 11 Dec 2025 18:18:42 +0100 Subject: [PATCH 1/9] test: remove codify-related stuff from mcp test --- cognee-mcp/src/test_client.py | 110 +--------------------------------- 1 file changed, 2 insertions(+), 108 deletions(-) diff --git a/cognee-mcp/src/test_client.py b/cognee-mcp/src/test_client.py index 23160d8b2..93a040e38 100755 --- a/cognee-mcp/src/test_client.py +++ b/cognee-mcp/src/test_client.py @@ -3,7 +3,7 @@ Test client for Cognee MCP Server functionality. This script tests all the tools and functions available in the Cognee MCP server, -including cognify, codify, search, prune, status checks, and utility functions. +including cognify, search, prune, status checks, and utility functions. Usage: # Set your OpenAI API key first @@ -35,7 +35,7 @@ from src.server import ( load_class, ) -# Set timeout for cognify/codify to complete in +# Set timeout for cognify to complete in TIMEOUT = 5 * 60 # 5 min in seconds @@ -151,12 +151,9 @@ DEBUG = True expected_tools = { "cognify", - "codify", "search", "prune", "cognify_status", - "codify_status", - "cognee_add_developer_rules", "list_data", "delete", } @@ -247,106 +244,6 @@ DEBUG = True } print(f"โŒ {test_name} test failed: {e}") - async def test_codify(self): - """Test the codify functionality using MCP client.""" - print("\n๐Ÿงช Testing codify functionality...") - try: - async with self.mcp_server_session() as session: - codify_result = await session.call_tool( - "codify", arguments={"repo_path": self.test_repo_dir} - ) - - start = time.time() # mark the start - while True: - try: - # Wait a moment - await asyncio.sleep(5) - - # Check if codify processing is finished - status_result = await session.call_tool("codify_status", arguments={}) - if hasattr(status_result, "content") and status_result.content: - status_text = ( - status_result.content[0].text - if status_result.content - else str(status_result) - ) - else: - status_text = str(status_result) - - if str(PipelineRunStatus.DATASET_PROCESSING_COMPLETED) in status_text: - break - elif time.time() - start > TIMEOUT: - raise TimeoutError("Codify did not complete in 5min") - except DatabaseNotCreatedError: - if time.time() - start > TIMEOUT: - raise TimeoutError("Database was not created in 5min") - - self.test_results["codify"] = { - "status": "PASS", - "result": codify_result, - "message": "Codify executed successfully", - } - print("โœ… Codify test passed") - - except Exception as e: - self.test_results["codify"] = { - "status": "FAIL", - "error": str(e), - "message": "Codify test failed", - } - print(f"โŒ Codify test failed: {e}") - - async def test_cognee_add_developer_rules(self): - """Test the cognee_add_developer_rules functionality using MCP client.""" - print("\n๐Ÿงช Testing cognee_add_developer_rules functionality...") - try: - async with self.mcp_server_session() as session: - result = await session.call_tool( - "cognee_add_developer_rules", arguments={"base_path": self.test_data_dir} - ) - - start = time.time() # mark the start - while True: - try: - # Wait a moment - await asyncio.sleep(5) - - # Check if developer rule cognify processing is finished - status_result = await session.call_tool("cognify_status", arguments={}) - if hasattr(status_result, "content") and status_result.content: - status_text = ( - status_result.content[0].text - if status_result.content - else str(status_result) - ) - else: - status_text = str(status_result) - - if str(PipelineRunStatus.DATASET_PROCESSING_COMPLETED) in status_text: - break - elif time.time() - start > TIMEOUT: - raise TimeoutError( - "Cognify of developer rules did not complete in 5min" - ) - except DatabaseNotCreatedError: - if time.time() - start > TIMEOUT: - raise TimeoutError("Database was not created in 5min") - - self.test_results["cognee_add_developer_rules"] = { - "status": "PASS", - "result": result, - "message": "Developer rules addition executed successfully", - } - print("โœ… Developer rules test passed") - - except Exception as e: - self.test_results["cognee_add_developer_rules"] = { - "status": "FAIL", - "error": str(e), - "message": "Developer rules test failed", - } - print(f"โŒ Developer rules test failed: {e}") - async def test_search_functionality(self): """Test the search functionality with different search types using MCP client.""" print("\n๐Ÿงช Testing search functionality...") @@ -681,9 +578,6 @@ class TestModel: test_name="Cognify2", ) - await self.test_codify() - await self.test_cognee_add_developer_rules() - # Test list_data and delete functionality await self.test_list_data() await self.test_delete() From 0f50c993ac502da598db0f77ce2bcd510b79ce22 Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Thu, 11 Dec 2025 18:20:07 +0100 Subject: [PATCH 2/9] chore: add quick option to isolate mcp CI test --- .github/workflows/test_mcp.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test_mcp.yml b/.github/workflows/test_mcp.yml index 09c8db69d..d667ed5f9 100644 --- a/.github/workflows/test_mcp.yml +++ b/.github/workflows/test_mcp.yml @@ -1,6 +1,9 @@ name: test | mcp on: + push: + branches: + - feature/cog-3543-remove-anything-codify-related-from-mcp-test workflow_call: jobs: From e211e66275919d6d56bd1dadfc7dc3e536fe10cc Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Thu, 11 Dec 2025 18:29:17 +0100 Subject: [PATCH 3/9] chore: remove quick option to isolate mcp CI test --- .github/workflows/test_mcp.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test_mcp.yml b/.github/workflows/test_mcp.yml index d667ed5f9..09c8db69d 100644 --- a/.github/workflows/test_mcp.yml +++ b/.github/workflows/test_mcp.yml @@ -1,9 +1,6 @@ name: test | mcp on: - push: - branches: - - feature/cog-3543-remove-anything-codify-related-from-mcp-test workflow_call: jobs: From 3b8a607b5fa524dd77fea2fe157ef01f0313159f Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Fri, 12 Dec 2025 11:37:27 +0100 Subject: [PATCH 4/9] test: fix errors in mcp test --- .github/workflows/test_mcp.yml | 3 +++ cognee-mcp/src/test_client.py | 18 ++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test_mcp.yml b/.github/workflows/test_mcp.yml index 09c8db69d..d667ed5f9 100644 --- a/.github/workflows/test_mcp.yml +++ b/.github/workflows/test_mcp.yml @@ -1,6 +1,9 @@ name: test | mcp on: + push: + branches: + - feature/cog-3543-remove-anything-codify-related-from-mcp-test workflow_call: jobs: diff --git a/cognee-mcp/src/test_client.py b/cognee-mcp/src/test_client.py index 93a040e38..c4e5b0573 100755 --- a/cognee-mcp/src/test_client.py +++ b/cognee-mcp/src/test_client.py @@ -256,7 +256,7 @@ DEBUG = True # Go through all Cognee search types for search_type in SearchType: # Don't test these search types - if search_type in [SearchType.NATURAL_LANGUAGE, SearchType.CYPHER]: + if search_type in [SearchType.NATURAL_LANGUAGE, SearchType.CYPHER, SearchType.TRIPLET_COMPLETION]: break try: async with self.mcp_server_session() as session: @@ -420,15 +420,13 @@ DEBUG = True if invalid_result.content and len(invalid_result.content) > 0: invalid_content = invalid_result.content[0].text - if "Invalid UUID format" in invalid_content: - self.test_results["delete_error_handling"] = { - "status": "PASS", - "result": invalid_content, - "message": "delete error handling works correctly", - } - print("โœ… delete error handling test passed") - else: - raise Exception(f"Expected UUID error not found: {invalid_content}") + assert("Invalid UUID format" in invalid_content) + self.test_results["delete_error_handling"] = { + "status": "PASS", + "result": invalid_content, + "message": "delete error handling works correctly", + } + print("โœ… delete error handling test passed") else: raise Exception("Delete error test returned no content") From c48b2745712fe0c02a5e0f6c1d148ba77b68ddfb Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Fri, 12 Dec 2025 11:53:40 +0100 Subject: [PATCH 5/9] test: remove delete error from mcp test --- cognee-mcp/src/test_client.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/cognee-mcp/src/test_client.py b/cognee-mcp/src/test_client.py index c4e5b0573..b03fef0db 100755 --- a/cognee-mcp/src/test_client.py +++ b/cognee-mcp/src/test_client.py @@ -408,25 +408,24 @@ DEBUG = True else: # Test with invalid UUIDs to check error handling - invalid_result = await session.call_tool( - "delete", - arguments={ - "data_id": "invalid-uuid", - "dataset_id": "another-invalid-uuid", - "mode": "soft", - }, - ) - - if invalid_result.content and len(invalid_result.content) > 0: - invalid_content = invalid_result.content[0].text - - assert("Invalid UUID format" in invalid_content) + try: + await session.call_tool( + "delete", + arguments={ + "data_id": "invalid-uuid", + "dataset_id": "another-invalid-uuid", + "mode": "soft", + }, + ) + except Exception as e: + assert ("Invalid UUID format" in e) self.test_results["delete_error_handling"] = { "status": "PASS", - "result": invalid_content, + "result": e, "message": "delete error handling works correctly", } print("โœ… delete error handling test passed") + else: raise Exception("Delete error test returned no content") From bce6094010ef53af2130ed5ca045df7b5971ed8c Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Fri, 12 Dec 2025 12:43:54 +0100 Subject: [PATCH 6/9] test: change logger --- cognee-mcp/src/test_client.py | 42 +++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/cognee-mcp/src/test_client.py b/cognee-mcp/src/test_client.py index b03fef0db..5ef8a8be4 100755 --- a/cognee-mcp/src/test_client.py +++ b/cognee-mcp/src/test_client.py @@ -23,6 +23,7 @@ import tempfile import time from contextlib import asynccontextmanager from cognee.shared.logging_utils import setup_logging +from logging import ERROR, INFO from mcp import ClientSession, StdioServerParameters from mcp.client.stdio import stdio_client @@ -407,27 +408,32 @@ DEBUG = True raise Exception("Delete returned no content") else: + logger = setup_logging(log_level=INFO) # Test with invalid UUIDs to check error handling - try: - await session.call_tool( - "delete", - arguments={ - "data_id": "invalid-uuid", - "dataset_id": "another-invalid-uuid", - "mode": "soft", - }, - ) - except Exception as e: - assert ("Invalid UUID format" in e) - self.test_results["delete_error_handling"] = { - "status": "PASS", - "result": e, - "message": "delete error handling works correctly", - } - print("โœ… delete error handling test passed") + invalid_result = await session.call_tool( + "delete", + arguments={ + "data_id": "invalid-uuid", + "dataset_id": "another-invalid-uuid", + "mode": "soft", + }, + ) + if invalid_result.content and len(invalid_result.content) > 0: + invalid_content = invalid_result.content[0].text + + if "Invalid UUID format" in invalid_content: + self.test_results["delete_error_handling"] = { + "status": "PASS", + "result": invalid_content, + "message": "delete error handling works correctly", + } + print("โœ… delete error handling test passed") + else: + raise Exception(f"Expected UUID error not found: {invalid_content}") else: raise Exception("Delete error test returned no content") + logger = setup_logging(log_level=ERROR) except Exception as e: self.test_results["delete"] = { @@ -630,7 +636,5 @@ async def main(): if __name__ == "__main__": - from logging import ERROR - logger = setup_logging(log_level=ERROR) asyncio.run(main()) From a337f4e54ca323e7c4dc060dadf7b78efe7b63f3 Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Fri, 12 Dec 2025 13:02:55 +0100 Subject: [PATCH 7/9] test: testing logger --- cognee-mcp/src/test_client.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cognee-mcp/src/test_client.py b/cognee-mcp/src/test_client.py index 5ef8a8be4..ed779a106 100755 --- a/cognee-mcp/src/test_client.py +++ b/cognee-mcp/src/test_client.py @@ -408,7 +408,6 @@ DEBUG = True raise Exception("Delete returned no content") else: - logger = setup_logging(log_level=INFO) # Test with invalid UUIDs to check error handling invalid_result = await session.call_tool( "delete", @@ -433,7 +432,6 @@ DEBUG = True raise Exception(f"Expected UUID error not found: {invalid_content}") else: raise Exception("Delete error test returned no content") - logger = setup_logging(log_level=ERROR) except Exception as e: self.test_results["delete"] = { @@ -636,5 +634,5 @@ async def main(): if __name__ == "__main__": - logger = setup_logging(log_level=ERROR) + logger = setup_logging(log_level=INFO) asyncio.run(main()) From a225d7fc61afb86f0cc7303bdd7869f6d5730907 Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Fri, 12 Dec 2025 13:44:58 +0100 Subject: [PATCH 8/9] test: revert some changes --- .github/workflows/test_mcp.yml | 3 --- cognee-mcp/src/test_client.py | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test_mcp.yml b/.github/workflows/test_mcp.yml index d667ed5f9..09c8db69d 100644 --- a/.github/workflows/test_mcp.yml +++ b/.github/workflows/test_mcp.yml @@ -1,9 +1,6 @@ name: test | mcp on: - push: - branches: - - feature/cog-3543-remove-anything-codify-related-from-mcp-test workflow_call: jobs: diff --git a/cognee-mcp/src/test_client.py b/cognee-mcp/src/test_client.py index ed779a106..06c1fceeb 100755 --- a/cognee-mcp/src/test_client.py +++ b/cognee-mcp/src/test_client.py @@ -634,5 +634,5 @@ async def main(): if __name__ == "__main__": - logger = setup_logging(log_level=INFO) + logger = setup_logging(log_level=ERROR) asyncio.run(main()) From 116b6f1eeb4cc6e068abadc8b42bee31dff40609 Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Fri, 12 Dec 2025 13:46:16 +0100 Subject: [PATCH 9/9] chore: formatting --- cognee-mcp/src/test_client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cognee-mcp/src/test_client.py b/cognee-mcp/src/test_client.py index 06c1fceeb..bce7f807f 100755 --- a/cognee-mcp/src/test_client.py +++ b/cognee-mcp/src/test_client.py @@ -257,7 +257,11 @@ DEBUG = True # Go through all Cognee search types for search_type in SearchType: # Don't test these search types - if search_type in [SearchType.NATURAL_LANGUAGE, SearchType.CYPHER, SearchType.TRIPLET_COMPLETION]: + if search_type in [ + SearchType.NATURAL_LANGUAGE, + SearchType.CYPHER, + SearchType.TRIPLET_COMPLETION, + ]: break try: async with self.mcp_server_session() as session: