Atlassian Cloud MCP

Use this integration to connect securely with an Atlassian Cloud Model Context Protocol (MCP) server and access its tools in real time.

Case Management · Atlassian Cloud MCP MCP

Details

IDAtlassian Cloud MCP
ProviderAtlassian
CategoryCase Management
From Version8.13.0
Docker Imagedemisto/mcp:1.0.0.10120494
Supported ModulesAgentix Cortex Cloud Cloud Runtime Security Cloud Posture Security XSIAM EDR

Connection settings

Parameter Name Type Required Default
Authorization code auth_code Credentials No

Commands (4)

An MCP server publishes no fixed command set: list-tools and call-tool are the protocol plumbing, and the tools they reach are discovered from the remote server when the instance connects. The pack cannot name them ahead of time, so neither can this page.

  • atlassian-cloud-mcp-auth-test

    Test the authentication configuration with the MCP server.

  • atlassian-cloud-mcp-generate-login-url

    Generate an authentication login URL.

  • call-tool

    Calls a specific tool on the MCP server with optional input parameters.

  • list-tools

    Retrieves a list of available tools in the Atlassian Cloud MCP server.

import pytest
from pytest_mock import MockerFixture
from AtlassianCloudMCP import main
import demistomock as demisto


class TestMain:
    """Unit tests for the main function of AtlassianCloudMCP."""

    @pytest.mark.asyncio
    async def test_test_module_command(self, mocker: MockerFixture):
        """Given: The test-module command is called.
        When: Main function processes the command.
        Then: A DemistoException is raised indicating test module is unavailable.
        """

        async def mock_close():
            pass

        mock_client = mocker.MagicMock()
        mock_client.close = mock_close
        mocker.patch("AtlassianCloudMCP.Client", return_value=mock_client)
        mocker.patch.object(demisto, "params", return_value={"auth_code": {"password": "test_code"}})
        mocker.patch.object(demisto, "args", return_value={})
        mocker.patch.object(demisto, "command", return_value="test-module")
        mock_return_error = mocker.patch("AtlassianCloudMCP.return_error")

        await main()

        mock_return_error.assert_called_once()
        error_call = mock_return_error.call_args[0][0]
        assert "Test module is unavailable for this integration" in error_call

    @pytest.mark.asyncio
    async def test_list_tools_command(self, mocker: MockerFixture):
        """Given: The list-tools command is called with valid auth code.
        When: Main function processes the command.
        Then: The client's list_tools method is called and results are returned.
        """

        async def mock_list_tools(server_name):
            return {"tools": []}

        async def mock_close():
            pass

        mock_client = mocker.MagicMock()
        mock_client.list_tools = mock_list_tools
        mock_client.close = mock_close
        mocker.patch("AtlassianCloudMCP.Client", return_value=mock_client)
        mocker.patch.object(demisto, "params", return_value={"auth_code": {"password": "test_code"}})
        mocker.patch.object(demisto, "args", return_value={})
        mocker.patch.object(demisto, "command", return_value="list-tools")
        mock_return_results = mocker.patch("AtlassianCloudMCP.return_results")

        await main()

        mock_return_results.assert_called_once_with({"tools": []})

    @pytest.mark.asyncio
    async def test_call_tool_command(self, mocker: MockerFixture):
        """Given: The call-tool command is called with tool name and arguments.
        When: Main function processes the command.
        Then: The client's call_tool method is called with the provided parameters.
        """

        async def mock_call_tool(name, arguments):
            return {"result": "success"}

        async def mock_close():
            pass

        mock_client = mocker.MagicMock()
        mock_client.call_tool = mock_call_tool
        mock_client.close = mock_close
        mocker.patch("AtlassianCloudMCP.Client", return_value=mock_client)
        mocker.patch.object(demisto, "params", return_value={"auth_code": {"password": "test_code"}})
        mocker.patch.object(demisto, "args", return_value={"name": "test_tool", "arguments": '{"param": "value"}'})
        mocker.patch.object(demisto, "command", return_value="call-tool")
        mock_return_results = mocker.patch("AtlassianCloudMCP.return_results")

        await main()

        mock_return_results.assert_called_once_with({"result": "success"})

    @pytest.mark.asyncio
    async def test_auth_test_command(self, mocker: MockerFixture):
        """Given: The atlassian-cloud-mcp-auth-test command is called.
        When: Main function processes the command.
        Then: The client's test_connection method is called with auth_test=True.
        """

        async def mock_test_connection(auth_test=False):
            return {"status": "authenticated"}

        async def mock_close():
            pass

        mock_client = mocker.MagicMock()
        mock_client.test_connection = mock_test_connection
        mock_client.close = mock_close
        mocker.patch("AtlassianCloudMCP.Client", return_value=mock_client)
        mocker.patch.object(demisto, "params", return_value={"auth_code": {"password": "test_code"}})
        mocker.patch.object(demisto, "args", return_value={})
        mocker.patch.object(demisto, "command", return_value="atlassian-cloud-mcp-auth-test")
        mock_return_results = mocker.patch("AtlassianCloudMCP.return_results")

        await main()

        mock_return_results.assert_called_once_with({"status": "authenticated"})

    @pytest.mark.asyncio
    async def test_generate_login_url_command(self, mocker: MockerFixture):
        """Given: The atlassian-cloud-mcp-generate-login-url command is called.
        When: Main function processes the command.
        Then: The generate_login_url function is called and results are returned.
        """

        async def mock_generate_login_url(*args, **kwargs):
            return {"login_url": "https://example.com"}

        async def mock_close():
            pass

        mock_client = mocker.MagicMock()
        mock_client.close = mock_close
        mocker.patch("AtlassianCloudMCP.Client", return_value=mock_client)
        mocker.patch("AtlassianCloudMCP.generate_login_url", side_effect=mock_generate_login_url)
        mocker.patch.object(demisto, "params", return_value={"auth_code": {"password": "test_code"}})
        mocker.patch.object(demisto, "args", return_value={})
        mocker.patch.object(demisto, "command", return_value="atlassian-cloud-mcp-generate-login-url")
        mock_return_results = mocker.patch("AtlassianCloudMCP.return_results")

        await main()

        mock_return_results.assert_called_once_with({"login_url": "https://example.com"})

    @pytest.mark.asyncio
    async def test_unknown_command(self, mocker: MockerFixture):
        """Given: An unknown command is called.
        When: Main function processes the command.
        Then: A NotImplementedError is raised and return_error is called.
        """

        async def mock_close():
            pass

        mock_client = mocker.MagicMock()
        mock_client.close = mock_close
        mocker.patch("AtlassianCloudMCP.Client", return_value=mock_client)
        mocker.patch.object(demisto, "params", return_value={"auth_code": {"password": "test_code"}})
        mocker.patch.object(demisto, "args", return_value={})
        mocker.patch.object(demisto, "command", return_value="unknown-command")
        mock_return_error = mocker.patch("AtlassianCloudMCP.return_error")

        await main()

        mock_return_error.assert_called_once()
        error_call = mock_return_error.call_args[0][0]
        assert "Command unknown-command is not implemented" in error_call

    @pytest.mark.asyncio
    async def test_exception_handling(self, mocker: MockerFixture):
        """Given: An exception occurs during command processing.
        When: Main function processes the command.
        Then: The exception is caught and return_error is called with the error message.
        """

        async def mock_list_tools_with_error(server_name):
            raise Exception("Connection failed")

        async def mock_close():
            pass

        mock_client = mocker.MagicMock()
        mock_client.list_tools = mock_list_tools_with_error
        mock_client.close = mock_close
        mocker.patch("AtlassianCloudMCP.Client", return_value=mock_client)
        mocker.patch.object(demisto, "params", return_value={"auth_code": {"password": "test_code"}})
        mocker.patch.object(demisto, "args", return_value={})
        mocker.patch.object(demisto, "command", return_value="list-tools")
        mock_return_error = mocker.patch("AtlassianCloudMCP.return_error")

        await main()

        mock_return_error.assert_called_once()
        error_call = mock_return_error.call_args[0][0]
        assert "Failed to execute list-tools command" in error_call
        assert "Connection failed" in error_call