forked from awslabs/mcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatasphere-cli-capabilities.py
More file actions
397 lines (357 loc) · 17 KB
/
Copy pathdatasphere-cli-capabilities.py
File metadata and controls
397 lines (357 loc) · 17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
#!/usr/bin/env python3
"""
SAP Datasphere CLI Capabilities Overview
Based on official SAP Datasphere CLI documentation
"""
import json
def get_datasphere_cli_capabilities():
"""Comprehensive overview of SAP Datasphere CLI capabilities"""
capabilities = {
"overview": {
"description": "SAP Datasphere CLI provides command-line access to manage spaces, data, models, and integrations",
"authentication": "OAuth2 with client credentials or interactive flow",
"installation": "npm install -g @sap/datasphere-cli",
"command_prefix": "datasphere"
},
"space_management": {
"description": "Manage Datasphere spaces and their configurations",
"commands": {
"datasphere spaces read": {
"description": "Read space configuration and metadata",
"parameters": ["--space <space_name>"],
"example": "datasphere spaces read --space MY_SPACE",
"api_equivalent": "/api/v1/spaces/{space_id}"
},
"datasphere spaces create": {
"description": "Create a new space",
"parameters": ["--space <space_name>", "--definition <file.json>"],
"example": "datasphere spaces create --space NEW_SPACE --definition space-config.json"
},
"datasphere spaces update": {
"description": "Update space configuration",
"parameters": ["--space <space_name>", "--definition <file.json>"],
"example": "datasphere spaces update --space MY_SPACE --definition updated-config.json"
},
"datasphere spaces delete": {
"description": "Delete a space",
"parameters": ["--space <space_name>"],
"example": "datasphere spaces delete --space OLD_SPACE"
},
"datasphere spaces list": {
"description": "List all available spaces",
"parameters": [],
"example": "datasphere spaces list"
}
}
},
"data_integration": {
"description": "Manage data flows, connections, and data integration tasks",
"commands": {
"datasphere dataflows read": {
"description": "Read data flow definitions",
"parameters": ["--space <space>", "--dataflow <name>"],
"example": "datasphere dataflows read --space MY_SPACE --dataflow ETL_FLOW"
},
"datasphere dataflows create": {
"description": "Create new data flows",
"parameters": ["--space <space>", "--definition <file.json>"],
"example": "datasphere dataflows create --space MY_SPACE --definition flow.json"
},
"datasphere dataflows deploy": {
"description": "Deploy data flows",
"parameters": ["--space <space>", "--dataflow <name>"],
"example": "datasphere dataflows deploy --space MY_SPACE --dataflow ETL_FLOW"
},
"datasphere connections read": {
"description": "Read connection configurations",
"parameters": ["--space <space>", "--connection <name>"],
"example": "datasphere connections read --space MY_SPACE --connection DB_CONN"
},
"datasphere connections create": {
"description": "Create new connections",
"parameters": ["--space <space>", "--definition <file.json>"],
"example": "datasphere connections create --space MY_SPACE --definition conn.json"
}
}
},
"data_modeling": {
"description": "Manage data models, views, and analytical models",
"commands": {
"datasphere views read": {
"description": "Read view definitions",
"parameters": ["--space <space>", "--view <name>"],
"example": "datasphere views read --space MY_SPACE --view SALES_VIEW"
},
"datasphere views create": {
"description": "Create new views",
"parameters": ["--space <space>", "--definition <file.json>"],
"example": "datasphere views create --space MY_SPACE --definition view.json"
},
"datasphere views deploy": {
"description": "Deploy views",
"parameters": ["--space <space>", "--view <name>"],
"example": "datasphere views deploy --space MY_SPACE --view SALES_VIEW"
},
"datasphere tables read": {
"description": "Read table definitions and data",
"parameters": ["--space <space>", "--table <name>"],
"example": "datasphere tables read --space MY_SPACE --table CUSTOMER_DATA"
},
"datasphere tables create": {
"description": "Create new tables",
"parameters": ["--space <space>", "--definition <file.json>"],
"example": "datasphere tables create --space MY_SPACE --definition table.json"
}
}
},
"task_management": {
"description": "Manage and monitor data integration tasks",
"commands": {
"datasphere tasks read": {
"description": "Read task definitions and status",
"parameters": ["--space <space>", "--task <name>"],
"example": "datasphere tasks read --space MY_SPACE --task DATA_LOAD_TASK"
},
"datasphere tasks create": {
"description": "Create new tasks",
"parameters": ["--space <space>", "--definition <file.json>"],
"example": "datasphere tasks create --space MY_SPACE --definition task.json"
},
"datasphere tasks run": {
"description": "Execute tasks",
"parameters": ["--space <space>", "--task <name>"],
"example": "datasphere tasks run --space MY_SPACE --task DATA_LOAD_TASK"
},
"datasphere tasks monitor": {
"description": "Monitor task execution",
"parameters": ["--space <space>", "--task <name>"],
"example": "datasphere tasks monitor --space MY_SPACE --task DATA_LOAD_TASK"
}
}
},
"marketplace": {
"description": "Manage Data Marketplace content and packages",
"commands": {
"datasphere marketplace list": {
"description": "List available marketplace packages",
"parameters": ["--space <space>"],
"example": "datasphere marketplace list --space MY_SPACE"
},
"datasphere marketplace install": {
"description": "Install marketplace packages",
"parameters": ["--space <space>", "--package <name>"],
"example": "datasphere marketplace install --space MY_SPACE --package DATA_PACKAGE"
},
"datasphere marketplace publish": {
"description": "Publish content to marketplace",
"parameters": ["--space <space>", "--definition <file.json>"],
"example": "datasphere marketplace publish --space MY_SPACE --definition package.json"
}
}
},
"configuration": {
"description": "CLI configuration and authentication management",
"commands": {
"datasphere login": {
"description": "Authenticate with Datasphere tenant",
"parameters": ["--client-id <id>", "--client-secret <secret>", "--host <url>"],
"example": "datasphere login --client-id abc123 --client-secret xyz789 --host https://tenant.eu10.hcs.cloud.sap"
},
"datasphere logout": {
"description": "Log out from current session",
"parameters": ["--login-id <id>"],
"example": "datasphere logout --login-id 0"
},
"datasphere config host set": {
"description": "Set the target host/tenant",
"parameters": ["<host_url>"],
"example": "datasphere config host set https://tenant.eu10.hcs.cloud.sap"
},
"datasphere config secrets show": {
"description": "Show stored authentication secrets",
"parameters": [],
"example": "datasphere config secrets show"
}
}
},
"import_export": {
"description": "Import and export Datasphere artifacts",
"commands": {
"datasphere import": {
"description": "Import artifacts from files",
"parameters": ["--space <space>", "--file <path>"],
"example": "datasphere import --space MY_SPACE --file artifacts.zip"
},
"datasphere export": {
"description": "Export artifacts to files",
"parameters": ["--space <space>", "--output <path>"],
"example": "datasphere export --space MY_SPACE --output backup.zip"
}
}
}
}
return capabilities
def get_mcp_server_opportunities():
"""Identify opportunities for MCP server tools based on CLI capabilities"""
opportunities = {
"space_operations": {
"description": "MCP tools for space management",
"tools": [
{
"name": "list_spaces",
"description": "List all available Datasphere spaces",
"cli_equivalent": "datasphere spaces list"
},
{
"name": "get_space_info",
"description": "Get detailed information about a specific space",
"cli_equivalent": "datasphere spaces read --space <name>"
},
{
"name": "create_space",
"description": "Create a new Datasphere space",
"cli_equivalent": "datasphere spaces create"
}
]
},
"data_discovery": {
"description": "MCP tools for data catalog and discovery",
"tools": [
{
"name": "search_catalog",
"description": "Search the data catalog for tables, views, and models",
"cli_equivalent": "datasphere tables/views list"
},
{
"name": "get_table_schema",
"description": "Get schema and metadata for a specific table",
"cli_equivalent": "datasphere tables read --table <name>"
},
{
"name": "query_data",
"description": "Execute queries against Datasphere data",
"cli_equivalent": "Custom SQL execution"
}
]
},
"data_integration": {
"description": "MCP tools for data integration workflows",
"tools": [
{
"name": "list_connections",
"description": "List all data connections in a space",
"cli_equivalent": "datasphere connections list"
},
{
"name": "test_connection",
"description": "Test connectivity of data sources",
"cli_equivalent": "datasphere connections test"
},
{
"name": "run_dataflow",
"description": "Execute data integration flows",
"cli_equivalent": "datasphere dataflows deploy/run"
}
]
},
"monitoring": {
"description": "MCP tools for monitoring and task management",
"tools": [
{
"name": "get_task_status",
"description": "Check status of running tasks",
"cli_equivalent": "datasphere tasks monitor"
},
{
"name": "list_recent_tasks",
"description": "List recently executed tasks and their status",
"cli_equivalent": "datasphere tasks list"
}
]
},
"marketplace": {
"description": "MCP tools for Data Marketplace operations",
"tools": [
{
"name": "browse_marketplace",
"description": "Browse available data packages in marketplace",
"cli_equivalent": "datasphere marketplace list"
},
{
"name": "install_package",
"description": "Install data packages from marketplace",
"cli_equivalent": "datasphere marketplace install"
}
]
}
}
return opportunities
def print_cli_capabilities():
"""Print CLI capabilities in a readable format"""
capabilities = get_datasphere_cli_capabilities()
print("🚀 SAP DATASPHERE CLI CAPABILITIES")
print("=" * 60)
print(f"\n📋 Overview:")
print(f"Description: {capabilities['overview']['description']}")
print(f"Authentication: {capabilities['overview']['authentication']}")
print(f"Installation: {capabilities['overview']['installation']}")
print(f"Command Prefix: {capabilities['overview']['command_prefix']}")
for category, info in capabilities.items():
if category == 'overview':
continue
print(f"\n📂 {category.replace('_', ' ').title()}")
print(f"Description: {info['description']}")
print(f"Commands:")
for command, details in info['commands'].items():
print(f"\n 🔧 {command}")
print(f" {details['description']}")
print(f" Example: {details['example']}")
if 'api_equivalent' in details:
print(f" API: {details['api_equivalent']}")
def print_mcp_opportunities():
"""Print MCP server opportunities"""
opportunities = get_mcp_server_opportunities()
print(f"\n" + "=" * 60)
print("MCP SERVER OPPORTUNITIES")
print("=" * 60)
for category, info in opportunities.items():
print(f"\n📊 {category.replace('_', ' ').title()}")
print(f"Description: {info['description']}")
print(f"Potential Tools:")
for tool in info['tools']:
print(f"\n 🛠️ {tool['name']}")
print(f" {tool['description']}")
print(f" CLI equivalent: {tool['cli_equivalent']}")
def save_capabilities_reference():
"""Save capabilities to JSON files for reference"""
capabilities = get_datasphere_cli_capabilities()
opportunities = get_mcp_server_opportunities()
with open('datasphere-cli-capabilities.json', 'w') as f:
json.dump(capabilities, f, indent=2)
with open('mcp-server-opportunities.json', 'w') as f:
json.dump(opportunities, f, indent=2)
print(f"\n📄 Reference files saved:")
print(f" • datasphere-cli-capabilities.json")
print(f" • mcp-server-opportunities.json")
def main():
"""Main function to display CLI capabilities"""
print_cli_capabilities()
print_mcp_opportunities()
save_capabilities_reference()
print(f"\n" + "=" * 60)
print("KEY TAKEAWAYS FOR MCP SERVER")
print("=" * 60)
print(f"\n🎯 High-Value MCP Tools to Build:")
print(f"1. 🏢 Space Management - List, create, and manage spaces")
print(f"2. 🔍 Data Discovery - Search catalog, explore schemas")
print(f"3. 📊 Data Querying - Execute SQL queries against data")
print(f"4. 🔗 Connection Management - Manage data source connections")
print(f"5. ⚡ Task Execution - Run and monitor data integration tasks")
print(f"6. 🛒 Marketplace Integration - Browse and install data packages")
print(f"\n🔑 Required for Implementation:")
print(f"1. ✅ OAuth2 authentication (client credentials)")
print(f"2. 🌐 API access to Datasphere REST endpoints")
print(f"3. 📋 Space-level permissions for operations")
print(f"4. 🔐 Proper scopes configured in OAuth client")
if __name__ == "__main__":
main()