Skip to content

Implement configuration function to customize MCP server#3796

Merged
KoolADE85 merged 4 commits into
mcpfrom
feature/mcp-configuration-function
Jun 3, 2026
Merged

Implement configuration function to customize MCP server#3796
KoolADE85 merged 4 commits into
mcpfrom
feature/mcp-configuration-function

Conversation

@KoolADE85
Copy link
Copy Markdown
Contributor

This PR adds a function to configure the MCP server behaviour:

Rather than add a growing list of constructor args around the MCP server, this PR implements a single configure_mcp_server() function that allows users to toggle various parts of the server with arguments:

def configure_mcp_server(
    *,
    include_layout: bool = True,
    include_callbacks: bool = True,
    include_clientside_callbacks: bool = True,
    include_pages: bool = True,
    expose_callback_docstrings: bool = False,
) -> None:

The existing mcp_expose_docstrings constructor arg has been removed and replaced by this function.

@camdecoster camdecoster self-assigned this May 28, 2026
Copy link
Copy Markdown
Contributor

@camdecoster camdecoster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a couple of suggestions, but nothing huge. Could you add a changelog entry for this update? Specifically describing the way the user facing API changed.

Comment thread dash/mcp/_configure.py Outdated
Comment thread dash/mcp/_configure.py Outdated
Comment thread tests/integration/mcp/conftest.py
Comment thread dash/mcp/_configure.py Outdated
Comment thread dash/dash.py
self._callback_list: list = []
self.callback_api_paths: dict = {}
self.mcp_decorated_functions: dict = {}
self.mcp_callback_map: Any = None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.mcp_callback_map: Any = None
self.mcp_callback_map: Optional["CallbackAdapterCollection"] = None

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually needs to be Any for now because of Python < 3.10.
CallbackAdapterCollection imports from the mcp module which cannot be installed on 3.8. Therefore, if we import it here for typing, it will break on older python versions.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stupid backward compatibility!

Comment thread dash/mcp/_configure.py Outdated
@KoolADE85 KoolADE85 force-pushed the feature/mcp-configuration-function branch from ee9afe7 to c5c4829 Compare June 3, 2026 17:50
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 3, 2026

@KoolADE85 KoolADE85 merged commit 28fd89d into mcp Jun 3, 2026
30 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants