Skip to content

Commit 17f4b54

Browse files
- Better doco.
1 parent 887656a commit 17f4b54

File tree

2 files changed

+13
-65
lines changed

2 files changed

+13
-65
lines changed

pkg/mcp_server/server.go

Lines changed: 4 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (s *simpleMCPServer) runHTTPServer(server *mcp.Server, config *Config) erro
5454
handlerWithLogging := loggingHandler(handler, s.logger)
5555

5656
s.logger.Debugf("MCP server listening on %s", address)
57-
s.logger.Debugf("Available tool: cityTime (cities: nyc, sf, boston)")
57+
// s.logger.Debugf("Available tool: cityTime (cities: nyc, sf, boston)")
5858

5959
// Start the HTTP server with logging handler.
6060
//nolint:gosec // TODO: find viable alternative to http.ListenAndServe
@@ -221,61 +221,6 @@ func newMCPServer(config *Config, backend Backend, logger *logrus.Logger) (MCPSe
221221
},
222222
)
223223

224-
// mcp.AddTool(
225-
// server,
226-
// &mcp.Tool{
227-
// Name: "list_table_resources",
228-
// Description: "List resource URIs for tables in a schema.",
229-
// },
230-
// func(ctx context.Context, req *mcp.CallToolRequest, args HierarchyInput) (*mcp.CallToolResult, any, error) {
231-
// result, err := backend.ListTableResources(ctx, args)
232-
// if err != nil {
233-
// return nil, nil, err
234-
// }
235-
// return &mcp.CallToolResult{
236-
// Content: []mcp.Content{
237-
// &mcp.TextContent{Text: fmt.Sprintf("%v", result)},
238-
// },
239-
// }, result, nil
240-
// },
241-
// )
242-
243-
// mcp.AddTool(
244-
// server,
245-
// &mcp.Tool{
246-
// Name: "read_table_resource",
247-
// Description: "Read rows from a table resource.",
248-
// },
249-
// func(ctx context.Context, req *mcp.CallToolRequest, args HierarchyInput) (*mcp.CallToolResult, any, error) {
250-
// result, err := backend.ReadTableResource(ctx, args)
251-
// if err != nil {
252-
// return nil, nil, err
253-
// }
254-
// return &mcp.CallToolResult{
255-
// Content: []mcp.Content{
256-
// &mcp.TextContent{Text: fmt.Sprintf("%v", result)},
257-
// },
258-
// }, result, nil
259-
// },
260-
// )
261-
262-
mcp.AddTool(
263-
server,
264-
&mcp.Tool{
265-
Name: "prompt_write_safe_select_tool",
266-
Description: "Prompt: guidelines for writing safe SELECT queries.",
267-
},
268-
func(ctx context.Context, req *mcp.CallToolRequest, args dto.HierarchyInput) (*mcp.CallToolResult, any, error) {
269-
result, err := backend.PromptWriteSafeSelectTool(ctx, args)
270-
if err != nil {
271-
return nil, nil, err
272-
}
273-
out := dto.SimpleTextDTO{Text: result}
274-
bytesOut, _ := json.Marshal(out)
275-
return &mcp.CallToolResult{Content: []mcp.Content{&mcp.TextContent{Text: string(bytesOut)}}}, out, nil
276-
},
277-
)
278-
279224
// mcp.AddTool(
280225
// server,
281226
// &mcp.Tool{
@@ -669,7 +614,6 @@ func registerNamespacedTools(server *mcp.Server, backend Backend, logger *logrus
669614
},
670615
)
671616

672-
// query.exec_json
673617
mcp.AddTool(
674618
server,
675619
&mcp.Tool{
@@ -681,13 +625,13 @@ func registerNamespacedTools(server *mcp.Server, backend Backend, logger *logrus
681625
if err != nil {
682626
return nil, nil, err
683627
}
684-
dto := dto.QueryResultDTO{
628+
dtObj := dto.QueryResultDTO{
685629
Rows: rows,
686630
RowCount: len(rows),
687631
Format: "json",
688632
}
689-
bytesOut, _ := json.Marshal(dto)
690-
return &mcp.CallToolResult{Content: []mcp.Content{&mcp.TextContent{Text: string(bytesOut)}}}, dto, nil
633+
bytesOut, _ := json.Marshal(dtObj)
634+
return &mcp.CallToolResult{Content: []mcp.Content{&mcp.TextContent{Text: string(bytesOut)}}}, dtObj, nil
691635
},
692636
)
693637

test/robot/functional/mcp.robot

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ Concurrent psql and Reverse Proxy MCP HTTPS Server Query Tool
249249
Should Be Equal As Integers ${psql_client_result.rc} 0
250250

251251
MCP HTTPS Server JSON DTO Greet
252-
# Future proofing: simple liveness placeholder; may evolve to richer health DTO.
252+
Pass Execution If "%{IS_SKIP_MCP_TEST=false}" == "true" Some platforms do not have the MCP client available
253253
${greet}= Run Process
254254
... ${STACKQL_MCP_CLIENT_EXE}
255255
... exec
@@ -267,7 +267,7 @@ MCP HTTPS Server JSON DTO Greet
267267
Should Contain ${greet.stdout} Hi JSON TEST
268268

269269
MCP HTTPS Server JSON DTO Server Info
270-
# Future proofing: DTO shape may expand; key set is provisional.
270+
Pass Execution If "%{IS_SKIP_MCP_TEST=false}" == "true" Some platforms do not have the MCP client available
271271
${srvinfo}= Run Process
272272
... ${STACKQL_MCP_CLIENT_EXE}
273273
... exec
@@ -286,7 +286,7 @@ MCP HTTPS Server JSON DTO Server Info
286286
Dictionary Should Contain Key ${srvinfo_obj} is_read_only
287287

288288
MCP HTTPS Server JSON DTO DB Identity
289-
# Future proofing: identity semantics may broaden (multi-tenant, session).
289+
Pass Execution If "%{IS_SKIP_MCP_TEST=false}" == "true" Some platforms do not have the MCP client available
290290
${dbident}= Run Process
291291
... ${STACKQL_MCP_CLIENT_EXE}
292292
... exec
@@ -303,7 +303,7 @@ MCP HTTPS Server JSON DTO DB Identity
303303
Dictionary Should Contain Key ${dbident_obj} identity
304304

305305
MCP HTTPS Server JSON DTO Query V2 JSON
306-
# Future proofing: query result DTO may add paging, metadata, stats.
306+
Pass Execution If "%{IS_SKIP_MCP_TEST=false}" == "true" Some platforms do not have the MCP client available
307307
${query_json}= Run Process
308308
... ${STACKQL_MCP_CLIENT_EXE}
309309
... exec
@@ -325,6 +325,7 @@ MCP HTTPS Server JSON DTO Query V2 JSON
325325
Should Be True ${row_count} > 0
326326

327327
MCP HTTPS Server Query Exec Text
328+
Pass Execution If "%{IS_SKIP_MCP_TEST=false}" == "true" Some platforms do not have the MCP client available
328329
# Future proofing: raw text format reserved; may gain structured hints later.
329330
${ns_query_text}= Run Process
330331
... ${STACKQL_MCP_CLIENT_EXE}
@@ -343,6 +344,7 @@ MCP HTTPS Server Query Exec Text
343344
Should Contain ${ns_query_text.stdout} foo
344345

345346
MCP HTTPS Server JSON DTO Query Exec JSON
347+
Pass Execution If "%{IS_SKIP_MCP_TEST=false}" == "true" Some platforms do not have the MCP client available
346348
${ns_query_json}= Run Process
347349
... ${STACKQL_MCP_CLIENT_EXE}
348350
... exec
@@ -353,7 +355,7 @@ MCP HTTPS Server JSON DTO Query Exec JSON
353355
... \-\-exec.action
354356
... query.exec_json
355357
... \-\-exec.args
356-
... {"sql":"SELECT 1","row_limit":5}
358+
... {"sql":"SELECT 1 as foo","row_limit":5}
357359
... stdout=${CURDIR}${/}tmp${/}MCP-HTTPS-query-exec-json.txt
358360
... stderr=${CURDIR}${/}tmp${/}MCP-HTTPS-query-exec-json-stderr.txt
359361
Should Be Equal As Integers ${ns_query_json.rc} 0
@@ -364,6 +366,7 @@ MCP HTTPS Server JSON DTO Query Exec JSON
364366

365367
MCP HTTPS Server JSON DTO Meta Get Foreign Keys
366368
[Documentation] Future proofing: foreign key discovery not yet implemented; placeholder.
369+
Pass Execution If "%{IS_SKIP_MCP_TEST=false}" == "true" Some platforms do not have the MCP client available
367370
${meta_fk}= Run Process
368371
... ${STACKQL_MCP_CLIENT_EXE}
369372
... exec
@@ -383,6 +386,7 @@ MCP HTTPS Server JSON DTO Meta Get Foreign Keys
383386

384387
MCP HTTPS Server JSON DTO Meta Find Relationships
385388
[Documentation] Future proofing: relationship graph inference pending; placeholder output.
389+
Pass Execution If "%{IS_SKIP_MCP_TEST=false}" == "true" Some platforms do not have the MCP client available
386390
${meta_rels}= Run Process
387391
... ${STACKQL_MCP_CLIENT_EXE}
388392
... exec

0 commit comments

Comments
 (0)