Consistent Server Description and Version (#674)

#672 was a quick fix. This PR makes it a long term fix.

Whether a tool is added via `MCPApp.add_tools_from_module`,
`MCPApp.add_tool`, or `@app.tool`, the server's version and description
will be the same.
This commit is contained in:
Eric Gustin 2025-11-03 15:20:12 -08:00 committed by GitHub
parent f5b6d45aba
commit a770edca4a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 49 additions and 22 deletions

View file

@ -19,14 +19,14 @@ try:
ARCADE_MCP_MAX_VERSION = str(int(ARCADE_MCP_MIN_VERSION.split(".")[0]) + 1) + ".0.0"
except Exception as e:
console.print(f"[red]Failed to get arcade-mcp version: {e}[/red]")
ARCADE_MCP_MIN_VERSION = "1.5.0" # Default version if unable to fetch
ARCADE_MCP_MIN_VERSION = "1.5.1" # Default version if unable to fetch
ARCADE_MCP_MAX_VERSION = "2.0.0"
ARCADE_TDK_MIN_VERSION = "3.0.0"
ARCADE_TDK_MAX_VERSION = "4.0.0"
ARCADE_SERVE_MIN_VERSION = "3.0.0"
ARCADE_SERVE_MAX_VERSION = "4.0.0"
ARCADE_MCP_SERVER_MIN_VERSION = "1.7.0"
ARCADE_MCP_SERVER_MIN_VERSION = "1.7.2"
ARCADE_MCP_SERVER_MAX_VERSION = "2.0.0"

View file

@ -266,22 +266,37 @@ class ToolCatalog(BaseModel):
output_model=output_model,
)
def add_module(self, module: ModuleType, name: str | None = None) -> None:
def add_module(
self,
module: ModuleType,
name: str | None = None,
version: str | None = None,
description: str | None = None,
) -> None:
"""
Add all the tools in a module to the catalog.
Args:
module: The module to add.
name: Optionally override the name of the toolkit with this parameter
version: Optionally override the version of the toolkit with this parameter
description: Optionally override the description of the toolkit with this parameter
"""
toolkit = Toolkit.from_module(module)
if name:
toolkit.name = name
self.add_toolkit(toolkit)
self.add_toolkit(toolkit, version=version, description=description)
def add_toolkit(self, toolkit: Toolkit) -> None:
def add_toolkit(
self, toolkit: Toolkit, version: str | None = None, description: str | None = None
) -> None:
"""
Add the tools from a loaded toolkit to the catalog.
Args:
toolkit: The toolkit to add.
version: Optionally override the version of the toolkit with this parameter
description: Optionally override the description of the toolkit with this parameter
"""
if str(toolkit).lower() in self._disabled_toolkits:
@ -293,7 +308,13 @@ class ToolCatalog(BaseModel):
try:
module = import_module(module_name)
tool_func = getattr(module, tool_name)
self.add_tool(tool_func, toolkit, module)
self.add_tool(
tool_func,
toolkit,
module,
toolkit_version=version,
toolkit_description=description,
)
except ToolDefinitionError as e:
raise e.with_context(tool_name) from e
except ToolkitLoadError as e:

View file

@ -1,6 +1,6 @@
[project]
name = "arcade-core"
version = "3.3.2"
version = "3.3.3"
description = "Arcade Core - Core library for Arcade platform"
readme = "README.md"
license = {text = "MIT"}

View file

@ -110,14 +110,18 @@ class MCPApp:
# Public handle to the MCPServer (set by caller for runtime ops)
self.server: MCPServer | None = None
self._mcp_settings = MCPSettings(
server=ServerSettings(
name=self._name,
version=self.version,
title=self.title,
instructions=self.instructions,
)
)
server_settings_kwargs = {
"name": self._name,
"version": self.version,
"title": self.title,
}
if self.instructions:
server_settings_kwargs["instructions"] = self.instructions
self._mcp_settings = MCPSettings(server=ServerSettings(**server_settings_kwargs))
# Store the actual instructions that ended up in ServerSettings
self.instructions = self._mcp_settings.server.instructions
self._load_env()
if not logger._core.handlers: # type: ignore[attr-defined]
@ -249,7 +253,9 @@ class MCPApp:
def add_tools_from_module(self, module: ModuleType) -> None:
"""Add all the tools in a module to the catalog."""
self._catalog.add_module(module, self._toolkit_name)
self._catalog.add_module(
module, self._toolkit_name, version=self.version, description=self.instructions
)
def tool(
self,

View file

@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "arcade-mcp-server"
version = "1.7.1"
version = "1.7.2"
description = "Model Context Protocol (MCP) server framework for Arcade.dev"
readme = "README.md"
authors = [{ name = "Arcade.dev" }]
@ -21,7 +21,7 @@ classifiers = [
]
requires-python = ">=3.10"
dependencies = [
"arcade-core>=3.3.2,<4.0.0",
"arcade-core>=3.3.3,<4.0.0",
"arcade-serve>=3.0.0,<4.0.0",
"arcade-tdk>=3.0.0,<4.0.0",
"arcadepy>=1.5.0",

View file

@ -1,6 +1,6 @@
[project]
name = "arcade-mcp"
version = "1.5.0"
version = "1.5.1"
description = "Arcade.dev - Tool Calling platform for Agents"
readme = "README.md"
license = {file = "LICENSE"}
@ -21,8 +21,8 @@ requires-python = ">=3.10"
dependencies = [
# CLI dependencies
"arcade-mcp-server>=1.7.0,<2.0.0",
"arcade-core>=3.0.0,<4.0.0",
"arcade-mcp-server>=1.7.2,<2.0.0",
"arcade-core>=3.3.3,<4.0.0",
"typer==0.10.0",
"rich==13.9.4",
"Jinja2==3.1.6",
@ -42,7 +42,7 @@ all = [
"pytz>=2024.1",
"python-dateutil>=2.8.2",
# mcp
"arcade-mcp-server>=1.7.0,<2.0.0",
"arcade-mcp-server>=1.7.2,<2.0.0",
# serve
"arcade-serve>=3.0.0,<4.0.0",
# tdk