feat: add anthropic mcp endpoint (#5148)

* mcp WIP

* [autofix.ci] apply automated fixes

* logging and flow user check

* mcp stdio client component

* handle disconnect better

* initialization

* session fix and type fix

* [autofix.ci] apply automated fixes

* defensive against mcp server bugs

* [autofix.ci] apply automated fixes

* notifications and sse component

* enabled flags and resource support

* remove unneeded print

* extract json schema util

* [autofix.ci] apply automated fixes

* ruff

* fix tools [] bug and db asysnc session api change

* Tool instead of StructuredTool

* ruff fixes

* ruff

* validation optimization

* fix frontend test

* another playwright fix

* Update src/frontend/tests/extended/features/notifications.spec.ts

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* mcp component descriptions

* mypy fixes

* fix setup_database_url test

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
Sebastián Estévez 2025-01-02 23:45:54 -05:00 • committed by GitHub
commit 63d649b0f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 1229 additions and 525 deletions

View file

@ -1,3 +1,5 @@
import os
import pytest
from langflow.services.deps import get_settings_service
@ -5,14 +7,18 @@ from langflow.services.deps import get_settings_service
@pytest.fixture(autouse=True)
def setup_database_url(tmp_path, monkeypatch):
"""Setup a temporary database URL for testing."""
settings_service = get_settings_service()
db_path = tmp_path / "test_performance.db"
original_value = monkeypatch.delenv("LANGFLOW_DATABASE_URL", raising=False)
original_value = os.getenv("LANGFLOW_DATABASE_URL")
monkeypatch.delenv("LANGFLOW_DATABASE_URL", raising=False)
test_db_url = f"sqlite:///{db_path}"
monkeypatch.setenv("LANGFLOW_DATABASE_URL", test_db_url)
settings_service.set("database_url", test_db_url)
yield
# Restore original value if it existed
if original_value is not None:
monkeypatch.setenv("LANGFLOW_DATABASE_URL", original_value)
settings_service.set("database_url", original_value)
else:
monkeypatch.delenv("LANGFLOW_DATABASE_URL", raising=False)