data-science-mcp 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env python
2
+ # coding: utf-8
3
+
4
+ import importlib
5
+ import inspect
6
+ import warnings
7
+ from typing import List
8
+
9
+ # Suppress RequestsDependencyWarning due to chardet 6.x / requests 2.32.x mismatch
10
+ # Centralized here to ensure it runs before any sub-package imports
11
+ warnings.filterwarnings("ignore", message=".*urllib3.*or chardet.*")
12
+
13
+ __all__: List[str] = []
14
+
15
+ CORE_MODULES = [
16
+ "data_science_mcp.api_client",
17
+ ]
18
+
19
+ OPTIONAL_MODULES = {
20
+ "data_science_mcp.agent_server": "agent",
21
+ "data_science_mcp.mcp_server": "mcp",
22
+ }
23
+
24
+
25
+ def _import_module_safely(module_name: str):
26
+ """Try to import a module and return it, or None if not available."""
27
+ try:
28
+ return importlib.import_module(module_name)
29
+ except ImportError:
30
+ return None
31
+
32
+
33
+ def _expose_members(module):
34
+ """Expose public classes and functions from a module into globals and __all__."""
35
+ for name, obj in inspect.getmembers(module):
36
+ if (inspect.isclass(obj) or inspect.isfunction(obj)) and not name.startswith(
37
+ "_"
38
+ ):
39
+ globals()[name] = obj
40
+ __all__.append(name)
41
+
42
+
43
+ for module_name in CORE_MODULES:
44
+ try:
45
+ module = importlib.import_module(module_name)
46
+ _expose_members(module)
47
+ except ImportError:
48
+ pass
49
+
50
+ for module_name, extra_name in OPTIONAL_MODULES.items():
51
+ module = _import_module_safely(module_name)
52
+ if module is not None:
53
+ _expose_members(module)
54
+ globals()[f"_{extra_name.upper()}_AVAILABLE"] = True
55
+ else:
56
+ globals()[f"_{extra_name.upper()}_AVAILABLE"] = False
57
+
58
+ _MCP_AVAILABLE = OPTIONAL_MODULES.get("data_science_mcp.mcp_server") in [
59
+ m.__name__ for m in globals().values() if hasattr(m, "__name__")
60
+ ]
61
+ _AGENT_AVAILABLE = "data_science_mcp.agent_server" in globals()
62
+
63
+ __all__.extend(["_MCP_AVAILABLE", "_AGENT_AVAILABLE"])
64
+
65
+
66
+ """
67
+ data-science-mcp
68
+
69
+ Data Science MCP Server — Model training, evaluation, and evolution tools for agentic ML workflows. Integrates with agent-utilities IModelEvolver (CONCEPT:AHE-3.15).
70
+ """
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/python
2
+ # coding: utf-8
3
+ from data_science_mcp.agent_server import agent_server
4
+
5
+ if __name__ == "__main__":
6
+ agent_server()
@@ -0,0 +1,12 @@
1
+ # AGENTS.md - Known A2A Peer Agents
2
+ Last updated: 2026-05-06
3
+
4
+ This file is the local registry of other A2A agents this agent can discover and call.
5
+
6
+ ## Registered A2A Peers
7
+
8
+ | Name | Endpoint URL | Description | Capabilities | Auth | Notes / Last Connected |
9
+ |-----------------|---------------------------------|--------------------------------------|----------------------------------|-----------|------------------------|
10
+ | SearchMaster | http://search-agent:9000/a2a | Advanced web researcher | web_search, summarize, browse | none | 2026-05-06 |
11
+
12
+ *Add new rows manually or let the agent call `register_a2a_peer(...)`.*
@@ -0,0 +1,12 @@
1
+ # CRON.md - Persistent Scheduled Tasks
2
+ Last updated: 2026-05-06
3
+
4
+ ## Active Tasks
5
+
6
+ | ID | Name | Interval (min) | Prompt | Last run | Next approx |
7
+ |-------------|-------------------|----------------|-------------------------------------|-------------------|-------------|
8
+ | heartbeat | Heartbeat | 30 | @HEARTBEAT.md | — | — |
9
+ | log-cleanup | Log Cleanup | 720 | __internal:cleanup_cron_log | — | — |
10
+
11
+ *Edit this table to add/remove tasks. The agent reloads it periodically.*
12
+ *Use `@filename.md` in the Prompt column to load a multi-line prompt from a workspace file.*
@@ -0,0 +1,5 @@
1
+ # CRON_LOG.md - Scheduled Task History
2
+ Last updated: 2026-05-06
3
+
4
+ | Timestamp | Task ID | Status | Message |
5
+ |-----------|---------|--------|---------|
@@ -0,0 +1,28 @@
1
+ # Heartbeat — Periodic Self-Check
2
+
3
+ You are running a scheduled heartbeat. Perform these checks and report results concisely.
4
+
5
+ ## Checks
6
+
7
+ 1. **Tool Availability** — Call `list_tools` or equivalent to verify your MCP tools are reachable. Report any connection failures.
8
+ 2. **Memory Review** — Query the **Knowledge Graph** for any pending follow-up tasks, architectural decisions, or action items.
9
+ 3. **Cron Log** — Read `CRON_LOG.md` and check for recent errors (❌). Summarize any failures from the last 24 hours.
10
+ 4. **Peer Agents** — Read `AGENTS.md` and note if any registered peers need attention.
11
+ 5. **Domain-Specific Checks**:
12
+ - **Service Health**: Check service health status and scan recent logs for critical errors using available tools.
13
+ 6. **Self-Diagnostics** — Report your current model, available tool count, and any anomalies.
14
+
15
+ ## Response Format
16
+
17
+ If everything is healthy:
18
+ ```
19
+ HEARTBEAT_OK — All systems nominal. [tool_count] tools available. No pending actions.
20
+ ```
21
+
22
+ If issues found:
23
+ ```
24
+ HEARTBEAT_ALERT — [summary of issues found]
25
+ - Issue 1: ...
26
+ - Issue 2: ...
27
+ - Action needed: ...
28
+ ```
@@ -0,0 +1,15 @@
1
+ # IDENTITY.md - Data Science MCP Agent Identity
2
+
3
+ ## [default]
4
+ * **Name:** Data Science MCP Agent
5
+ * **Role:** Data Science MCP Server — Model training, evaluation, and evolution tools for agentic ML workflows. Integrates with agent-utilities IModelEvolver (CONCEPT:AHE-3.15).
6
+ * **Emoji:** 🤖
7
+
8
+ ### System Prompt
9
+ You are the Data Science MCP Agent.
10
+ You must always first run `list_skills` to show all skills.
11
+ Then, use the `mcp-client` universal skill and check the reference documentation for `data-science-mcp.md` to discover the exact tags and tools available for your capabilities.
12
+
13
+ ### Capabilities
14
+ - **MCP Operations**: Leverage the `mcp-client` skill to interact with the target MCP server. Refer to `data-science-mcp.md` for specific tool capabilities.
15
+ - **Custom Agent**: Handle custom tasks or general tasks.
@@ -0,0 +1,13 @@
1
+ # MCP_AGENTS.md - Dynamic Agent Registry
2
+
3
+ This file tracks the generated agents from MCP servers. You can manually modify the 'Tools' list to customize agent expertise.
4
+
5
+ ## Agent Mapping Table
6
+
7
+ | Name | Description | System Prompt | Tools | Tag | Source MCP |
8
+ |------|-------------|---------------|-------|-----|------------|
9
+
10
+ ## Tool Inventory Table
11
+
12
+ | Tool Name | Description | Tag | Source |
13
+ |-----------|-------------|-----|--------|
@@ -0,0 +1,7 @@
1
+ # USER.md - About the Human
2
+
3
+ * **Name:** User
4
+ * **Preferred name:** User
5
+ * **Timezone:** America/Chicago
6
+ * **Location:** Chicago, Illinois
7
+ * **Style:** Technical, concise, no fluff
File without changes
@@ -0,0 +1,11 @@
1
+ {
2
+ "mcpServers": {
3
+ "data-science": {
4
+ "command": "data-science-mcp",
5
+ "env": {
6
+ "DATA_SCIENCE_MCP_URL": "${DATA_SCIENCE_MCP_URL:-http://localhost:8080}",
7
+ "DATA_SCIENCE_MCP_TOKEN": "${DATA_SCIENCE_MCP_TOKEN}"
8
+ }
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/python
2
+ # coding: utf-8
3
+ import os
4
+ import sys
5
+ import logging
6
+ import warnings
7
+
8
+ from agent_utilities import (
9
+ build_system_prompt_from_workspace,
10
+ create_agent_parser,
11
+ create_graph_agent_server,
12
+ initialize_workspace,
13
+ load_identity,
14
+ )
15
+
16
+ __version__ = "0.2.0"
17
+
18
+ logging.basicConfig(
19
+ level=logging.INFO,
20
+ format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
21
+ handlers=[logging.StreamHandler()],
22
+ )
23
+ logger = logging.getLogger(__name__)
24
+
25
+ # Load identity and system prompt from workspace
26
+ initialize_workspace()
27
+ meta = load_identity()
28
+ DEFAULT_AGENT_NAME = os.getenv("DEFAULT_AGENT_NAME", meta.get("name", "Data Science MCP"))
29
+ DEFAULT_AGENT_DESCRIPTION = os.getenv(
30
+ "AGENT_DESCRIPTION",
31
+ meta.get("description", "Data Science MCP Server — Model training, evaluation, and evolution tools for agentic ML workflows. Integrates with agent-utilities IModelEvolver (CONCEPT:AHE-3.15)."),
32
+ )
33
+ DEFAULT_AGENT_SYSTEM_PROMPT = os.getenv(
34
+ "AGENT_SYSTEM_PROMPT",
35
+ meta.get("content") or build_system_prompt_from_workspace(),
36
+ )
37
+
38
+
39
+ def agent_server():
40
+ warnings.filterwarnings("ignore", message=".*urllib3.*or chardet.*")
41
+ warnings.filterwarnings("ignore", category=DeprecationWarning, module="fastmcp")
42
+
43
+ print(f"{DEFAULT_AGENT_NAME} v{__version__}", file=sys.stderr)
44
+ parser = create_agent_parser()
45
+ args = parser.parse_args()
46
+
47
+ if args.debug:
48
+ logging.getLogger().setLevel(logging.DEBUG)
49
+ logger.debug("Debug mode enabled")
50
+
51
+ # Start server using the auto-discovery pattern (from mcp_config.json)
52
+ create_graph_agent_server(
53
+ mcp_url=args.mcp_url,
54
+ mcp_config=args.mcp_config or "mcp_config.json",
55
+ host=args.host,
56
+ port=args.port,
57
+ provider=args.provider,
58
+ model_id=args.model_id,
59
+ router_model=args.model_id,
60
+ agent_model=args.model_id,
61
+ base_url=args.base_url,
62
+ api_key=args.api_key,
63
+ custom_skills_directory=args.custom_skills_directory,
64
+ enable_web_ui=args.web,
65
+ enable_otel=args.otel,
66
+ otel_endpoint=args.otel_endpoint,
67
+ otel_headers=args.otel_headers,
68
+ otel_public_key=args.otel_public_key,
69
+ otel_secret_key=args.otel_secret_key,
70
+ otel_protocol=args.otel_protocol,
71
+ debug=args.debug,
72
+ )
73
+
74
+
75
+ if __name__ == "__main__":
76
+ agent_server()
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/python
2
+ # coding: utf-8
3
+
4
+ import os
5
+ import requests
6
+ import urllib3
7
+
8
+ urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
9
+
10
+ from agent_utilities.core.exceptions import AuthError, UnauthorizedError
11
+
12
+ # TODO: Import your API wrapper class here
13
+ # from data_science_mcp.api_client import DataScienceApiClient
14
+
15
+ _client = None
16
+
17
+
18
+ def get_client():
19
+ """Get or create a singleton API client instance."""
20
+ global _client
21
+ if _client is None:
22
+ base_url = os.getenv("DATA_SCIENCE_MCP_URL", "http://localhost:8080")
23
+ token = os.getenv("DATA_SCIENCE_MCP_TOKEN", "")
24
+ verify = os.getenv("DATA_SCIENCE_MCP_VERIFY", "True").lower() in ("true", "1", "yes")
25
+
26
+ try:
27
+ # TODO: Uncomment and configure once the API wrapper class is created
28
+ # _client = DataScienceApiClient(
29
+ # base_url=base_url,
30
+ # token=token,
31
+ # verify=verify,
32
+ # )
33
+
34
+ # Placeholder until API wrapper is implemented
35
+ if _client is None:
36
+ session = requests.Session()
37
+ session.headers.update({"Authorization": f"Bearer {token}"})
38
+ session.verify = verify
39
+ _client = type("Client", (), {"session": session, "base_url": base_url})()
40
+ except (AuthError, UnauthorizedError) as e:
41
+ raise RuntimeError(
42
+ f"AUTHENTICATION ERROR: The credentials provided are not valid for '{base_url}'. "
43
+ f"Please check your DATA_SCIENCE_MCP_TOKEN and DATA_SCIENCE_MCP_URL environment variables. "
44
+ f"Error details: {str(e)}"
45
+ ) from e
46
+
47
+ return _client