66from mcp .server .fastmcp import FastMCP
77
88from deepset_mcp .api .client import AsyncDeepsetClient
9- from deepset_mcp .mcp .initialize_embedding_model import get_initialized_model
10- from deepset_mcp .mcp .tool_factory import WorkspaceMode , register_workspace_tools
9+ from deepset_mcp .tool_factory import WorkspaceMode , register_all_tools
1110from deepset_mcp .tools .doc_search import (
1211 get_docs_config ,
1312 search_docs as search_docs_tool ,
1413)
15- from deepset_mcp .tools .haystack_service import (
16- get_component_definition as get_component_definition_tool ,
17- get_custom_components as get_custom_components_tool ,
18- list_component_families as list_component_families_tool ,
19- search_component_definition as search_component_definition_tool ,
20- )
21- from deepset_mcp .tools .secrets import (
22- get_secret as get_secret_tool ,
23- list_secrets as list_secrets_tool ,
24- )
25-
26- INITIALIZED_MODEL = get_initialized_model ()
2714
2815# Initialize MCP Server
2916mcp = FastMCP ("Deepset Cloud MCP" )
@@ -37,90 +24,6 @@ async def deepset_copilot() -> str:
3724 return prompt_path .read_text ()
3825
3926
40- @mcp .tool ()
41- async def list_component_families () -> str :
42- """
43- Returns a list of all component families available in deepset alongside their descriptions.
44-
45- Use this as a starting point for when you are unsure what types of components are available.
46- """
47- async with AsyncDeepsetClient () as client :
48- response = await list_component_families_tool (client )
49-
50- return response
51-
52-
53- @mcp .tool ()
54- async def get_component_definition (component_type : str ) -> str :
55- """Use this to get the full definition of a specific component.
56-
57- The component type is the fully qualified import path of the component class.
58- For example: haystack.components.converters.xlsx.XLSXToDocument
59- The component definition contains a description, parameters, and example usage of the component.
60- """
61- async with AsyncDeepsetClient () as client :
62- response = await get_component_definition_tool (client , component_type )
63-
64- return response
65-
66-
67- @mcp .tool ()
68- async def search_component_definitions (query : str ) -> str :
69- """Use this to search for components in deepset.
70-
71- You can use full natural language queries to find components.
72- You can also use simple keywords.
73- Use this if you want to find the definition for a component,
74- but you are not sure what the exact name of the component is.
75- """
76- async with AsyncDeepsetClient () as client :
77- response = await search_component_definition_tool (client = client , query = query , model = INITIALIZED_MODEL )
78-
79- return response
80-
81-
82- @mcp .tool ()
83- async def get_custom_components () -> str :
84- """Retrieves a list of all installed custom components.
85-
86- Use this when you need to know what custom components are available in the workspace.
87- Custom components are identified by having a package_version in their schema.
88- This returns detailed information about each custom component including version, type, and parameters.
89- """
90- async with AsyncDeepsetClient () as client :
91- response = await get_custom_components_tool (client )
92-
93- return response
94-
95-
96- @mcp .tool ()
97- async def list_secrets (limit : int = 10 ) -> str :
98- """Lists all secrets available in the deepset workspace.
99-
100- Use this tool to retrieve a list of secrets with their names and IDs.
101- This is useful for getting an overview of all secrets before retrieving specific ones.
102-
103- :param limit: Maximum number of secrets to return (default: 10).
104- """
105- async with AsyncDeepsetClient () as client :
106- response = await list_secrets_tool (client , limit )
107- return response
108-
109-
110- @mcp .tool ()
111- async def get_secret (secret_id : str ) -> str :
112- """Retrieves detailed information about a specific secret by its ID.
113-
114- Use this tool to get information about a specific secret when you know its ID.
115- The secret value itself is not returned for security reasons, only metadata.
116-
117- :param secret_id: The unique identifier of the secret to retrieve.
118- """
119- async with AsyncDeepsetClient () as client :
120- response = await get_secret_tool (client , secret_id )
121- return response
122-
123-
12427# Check if docs search should be enabled
12528docs_config = get_docs_config ()
12629if docs_config :
@@ -220,8 +123,8 @@ def main() -> None:
220123 if docs_api_key :
221124 os .environ ["DEEPSET_DOCS_API_KEY" ] = docs_api_key
222125
223- # Register tools based on configuration
224- register_workspace_tools (mcp , workspace_mode , workspace )
126+ # Register all tools based on configuration
127+ register_all_tools (mcp , workspace_mode , workspace )
225128
226129 # run with SSE transport (HTTP+Server-Sent Events)
227130 mcp .run (transport = "stdio" )
0 commit comments