fix: update cognee-mcp script alias and Dockerfile entrypoint (#1471)
<!-- .github/pull_request_template.md --> ## Description Running cognee-mcp as a docker container currently fails when using latest main version: ``` (cognee-mcp) daulet@Mac cognee-claude % docker run -e TRANSPORT_MODE=sse -p 8001:8000 cognee/cognee-mcp:main Debug mode: Environment: Transport mode: sse Debug port: 5678 HTTP port: 8000 Running database migrations... 2025-09-25T21:15:17.065171 [info ] Logging initialized [cognee.shared.logging_utils] cognee_version=0.3.2 database_path=/app/.venv/lib/python3.12/site-packages/cognee/.cognee_system/databases graph_database_name= os_info='Linux 6.12.5-linuxkit (#1 SMP Tue Jan 21 10:23:32 UTC 2025)' python_version=3.12.11 relational_config=cognee_db structlog_version=25.4.0 vector_config=lancedb 2025-09-25T21:15:17.065330 [info ] Database storage: /app/.venv/lib/python3.12/site-packages/cognee/.cognee_system/databases [cognee.shared.logging_utils] generated new fontManager Database migrations done. Starting Cognee MCP Server with transport mode: sse 2025-09-25T21:15:24.204708 [info ] Logging initialized [cognee.shared.logging_utils] cognee_version=0.3.2 database_path=/app/.venv/lib/python3.12/site-packages/cognee/.cognee_system/databases graph_database_name= os_info='Linux 6.12.5-linuxkit (#1 SMP Tue Jan 21 10:23:32 UTC 2025)' python_version=3.12.11 relational_config=cognee_db structlog_version=25.4.0 vector_config=lancedb 2025-09-25T21:15:24.204863 [info ] Database storage: /app/.venv/lib/python3.12/site-packages/cognee/.cognee_system/databases [cognee.shared.logging_utils] Usage: cognee [-h] [--version] [--debug] [-ui] {add,search,cognify,delete,config} ... cognee: error: argument command: invalid choice: 'sse' (choose from add, search, cognify, delete, config) (cognee-mcp) daulet@Mac cognee-claude % ``` This is due to both `cognee-mcp` and `cognee` (v0.3.2) projects defining their CLI script aliases as `cognee`. `entrypoint.sh` uses `cognee` cli, assuming it's `cognee-mcp`, which is failing (see logs above). While in later version of cognee we define `cognee-cli` instead of `cognee`, it's still important to be safer and be more explicit in `cognee-mcp` cli alias. ## Testing the fix ``` (cognee-mcp) daulet@Mac cognee-claude % docker run -e TRANSPORT_MODE=sse -p 8001:8000 cognee/cognee-mcp:daulet-dev Debug mode: Environment: Transport mode: sse Debug port: 5678 HTTP port: 8000 Running database migrations... 2025-09-25T21:18:45.855092 [info ] Logging initialized [cognee.shared.logging_utils] cognee_version=0.3.2 database_path=/app/.venv/lib/python3.12/site-packages/cognee/.cognee_system/databases graph_database_name= os_info='Linux 6.12.5-linuxkit (#1 SMP Tue Jan 21 10:23:32 UTC 2025)' python_version=3.12.11 relational_config=cognee_db structlog_version=25.4.0 vector_config=lancedb 2025-09-25T21:18:45.855270 [info ] Database storage: /app/.venv/lib/python3.12/site-packages/cognee/.cognee_system/databases [cognee.shared.logging_utils] generated new fontManager Database migrations done. Starting Cognee MCP Server with transport mode: sse 2025-09-25T21:18:53.188498 [info ] Logging initialized [cognee.shared.logging_utils] cognee_version=0.3.2 database_path=/app/.venv/lib/python3.12/site-packages/cognee/.cognee_system/databases graph_database_name= os_info='Linux 6.12.5-linuxkit (#1 SMP Tue Jan 21 10:23:32 UTC 2025)' python_version=3.12.11 relational_config=cognee_db structlog_version=25.4.0 vector_config=lancedb 2025-09-25T21:18:53.188665 [info ] Database storage: /app/.venv/lib/python3.12/site-packages/cognee/.cognee_system/databases [cognee.shared.logging_utils] 2025-09-25T21:18:54.272533 [info ] Starting MCP server with transport: sse [cognee.shared.logging_utils] 2025-09-25T21:18:54.272661 [info ] Running MCP server with SSE transport on 0.0.0.0:8000 [cognee.shared.logging_utils] INFO: Started server process [1] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) ``` <!-- Please provide a clear, human-generated description of the changes in this PR. DO NOT use AI-generated descriptions. We want to understand your thought process and reasoning. --> ## Type of Change <!-- Please check the relevant option --> - [x] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [ ] Code refactoring - [ ] Performance improvement - [ ] Other (please specify): ## Screenshots/Videos (if applicable) <!-- Add screenshots or videos to help explain your changes --> ## Pre-submission Checklist <!-- Please check all boxes that apply before submitting your PR --> - [ ] **I have tested my changes thoroughly before submitting this PR** - [ ] **This PR contains minimal changes necessary to address the issue/feature** - [ ] My code follows the project's coding standards and style guidelines - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have added necessary documentation (if applicable) - [ ] All new and existing tests pass - [ ] I have searched existing PRs to ensure this change hasn't been submitted already - [ ] I have linked any relevant issues in the description - [ ] My commits have clear and descriptive messages ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin.
This commit is contained in:
commit
be453dc850
3 changed files with 31 additions and 10 deletions
|
|
@ -48,27 +48,27 @@ if [ "$ENVIRONMENT" = "dev" ] || [ "$ENVIRONMENT" = "local" ]; then
|
|||
if [ "$DEBUG" = "true" ]; then
|
||||
echo "Waiting for the debugger to attach..."
|
||||
if [ "$TRANSPORT_MODE" = "sse" ]; then
|
||||
exec python -m debugpy --wait-for-client --listen 0.0.0.0:$DEBUG_PORT -m cognee --transport sse --host 0.0.0.0 --port $HTTP_PORT --no-migration
|
||||
exec python -m debugpy --wait-for-client --listen 0.0.0.0:$DEBUG_PORT -m cognee-mcp --transport sse --host 0.0.0.0 --port $HTTP_PORT --no-migration
|
||||
elif [ "$TRANSPORT_MODE" = "http" ]; then
|
||||
exec python -m debugpy --wait-for-client --listen 0.0.0.0:$DEBUG_PORT -m cognee --transport http --host 0.0.0.0 --port $HTTP_PORT --no-migration
|
||||
exec python -m debugpy --wait-for-client --listen 0.0.0.0:$DEBUG_PORT -m cognee-mcp --transport http --host 0.0.0.0 --port $HTTP_PORT --no-migration
|
||||
else
|
||||
exec python -m debugpy --wait-for-client --listen 0.0.0.0:$DEBUG_PORT -m cognee --transport stdio --no-migration
|
||||
exec python -m debugpy --wait-for-client --listen 0.0.0.0:$DEBUG_PORT -m cognee-mcp --transport stdio --no-migration
|
||||
fi
|
||||
else
|
||||
if [ "$TRANSPORT_MODE" = "sse" ]; then
|
||||
exec cognee --transport sse --host 0.0.0.0 --port $HTTP_PORT --no-migration
|
||||
exec cognee-mcp --transport sse --host 0.0.0.0 --port $HTTP_PORT --no-migration
|
||||
elif [ "$TRANSPORT_MODE" = "http" ]; then
|
||||
exec cognee --transport http --host 0.0.0.0 --port $HTTP_PORT --no-migration
|
||||
exec cognee-mcp --transport http --host 0.0.0.0 --port $HTTP_PORT --no-migration
|
||||
else
|
||||
exec cognee --transport stdio --no-migration
|
||||
exec cognee-mcp --transport stdio --no-migration
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ "$TRANSPORT_MODE" = "sse" ]; then
|
||||
exec cognee --transport sse --host 0.0.0.0 --port $HTTP_PORT --no-migration
|
||||
exec cognee-mcp --transport sse --host 0.0.0.0 --port $HTTP_PORT --no-migration
|
||||
elif [ "$TRANSPORT_MODE" = "http" ]; then
|
||||
exec cognee --transport http --host 0.0.0.0 --port $HTTP_PORT --no-migration
|
||||
exec cognee-mcp --transport http --host 0.0.0.0 --port $HTTP_PORT --no-migration
|
||||
else
|
||||
exec cognee --transport stdio --no-migration
|
||||
exec cognee-mcp --transport stdio --no-migration
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -37,3 +37,4 @@ allow-direct-references = true
|
|||
|
||||
[project.scripts]
|
||||
cognee = "src:main"
|
||||
cognee-mcp = "src:main_mcp"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,28 @@
|
|||
from .server import main as server_main
|
||||
import warnings
|
||||
|
||||
|
||||
def main():
|
||||
"""Main entry point for the package."""
|
||||
"""Deprecated main entry point for the package."""
|
||||
import asyncio
|
||||
|
||||
# Show deprecation warning
|
||||
warnings.warn(
|
||||
"The 'cognee' command for cognee-mcp is deprecated and will be removed in a future version. "
|
||||
"Please use 'cognee-mcp' instead to avoid conflicts with the main cognee library.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
print("⚠️ DEPRECATION WARNING: Use 'cognee-mcp' command instead of 'cognee'")
|
||||
print(" This avoids conflicts with the main cognee library.")
|
||||
print()
|
||||
|
||||
asyncio.run(server_main())
|
||||
|
||||
|
||||
def main_mcp():
|
||||
"""Clean main entry point for cognee-mcp command."""
|
||||
import asyncio
|
||||
|
||||
asyncio.run(server_main())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue