@probebrowser/trace-mcp 1.1.0 → 1.1.1
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.
- package/dist/server.js +33 -3
- package/package.json +1 -1
- package/src/server.ts +39 -7
package/dist/server.js
CHANGED
|
@@ -3,6 +3,33 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
|
3
3
|
import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
4
4
|
import { Trace, ALL_TOOLS } from '@probebrowser/sdk';
|
|
5
5
|
import { TOOLS } from './tools.js';
|
|
6
|
+
// Tools hidden by default to stay within IDE 100-tool limits.
|
|
7
|
+
// Set TRACE_ALL_TOOLS=true to expose everything.
|
|
8
|
+
const NON_CORE_TOOLS = new Set([
|
|
9
|
+
// Node.js debugger (7) - browser-focused IDEs rarely need these
|
|
10
|
+
'trace_connect_node_debugger', 'trace_node_list_scripts', 'trace_node_get_source',
|
|
11
|
+
'trace_node_set_breakpoint', 'trace_node_get_variables', 'trace_node_step_debugger',
|
|
12
|
+
'trace_node_evaluate',
|
|
13
|
+
// Cache Storage (3) - niche
|
|
14
|
+
'trace_get_caches', 'trace_get_cache_contents', 'trace_delete_cache',
|
|
15
|
+
// Code/filesystem (11) - IDE already provides these
|
|
16
|
+
'trace_read_file', 'trace_search_code', 'trace_get_file_tree', 'trace_get_project_info',
|
|
17
|
+
'trace_get_error_context', 'trace_git_blame', 'trace_git_recent_changes',
|
|
18
|
+
'trace_get_imports', 'trace_find_usages', 'trace_get_related_files', 'trace_get_env_vars',
|
|
19
|
+
// Advanced debugger (6) - power-user only
|
|
20
|
+
'trace_capture_execution_state', 'trace_get_execution_history',
|
|
21
|
+
'trace_watch_for_changes', 'trace_check_changes', 'trace_trace_variable_origin',
|
|
22
|
+
'trace_debug_and_analyze',
|
|
23
|
+
// Advanced source (5) - power-user only
|
|
24
|
+
'trace_blackbox_script', 'trace_list_blackbox_patterns', 'trace_list_original_sources',
|
|
25
|
+
'trace_get_original_location', 'trace_map_call_stack',
|
|
26
|
+
// Advanced DOM (3)
|
|
27
|
+
'trace_find_ghost_blockers', 'trace_find_hidden_interactive_elements', 'trace_inspect_mode',
|
|
28
|
+
// Tracing (3) - niche
|
|
29
|
+
'trace_start_trace', 'trace_get_trace_spans', 'trace_get_error_rate',
|
|
30
|
+
// Timeline deep-dive (2) - niche
|
|
31
|
+
'trace_diff_from_snapshot', 'trace_get_events_in_window',
|
|
32
|
+
]);
|
|
6
33
|
import { zodToJsonSchema as _zodToJsonSchema } from 'zod-to-json-schema';
|
|
7
34
|
// Schema conversion helper
|
|
8
35
|
function zodToJsonSchema(schema) {
|
|
@@ -43,17 +70,20 @@ export class TraceMcpServer {
|
|
|
43
70
|
// 1. TOOLS
|
|
44
71
|
// ============================================
|
|
45
72
|
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
46
|
-
const
|
|
73
|
+
const allTools = process.env.TRACE_ALL_TOOLS === 'true';
|
|
74
|
+
const definedTools = Object.entries(TOOLS)
|
|
75
|
+
.filter(([name]) => allTools || !NON_CORE_TOOLS.has(name))
|
|
76
|
+
.map(([name, def]) => ({
|
|
47
77
|
name,
|
|
48
78
|
description: def.description,
|
|
49
79
|
inputSchema: zodToJsonSchema(def.schema),
|
|
50
80
|
}));
|
|
51
81
|
const definedNames = new Set(Object.keys(TOOLS));
|
|
52
82
|
const distinctAllTools = new Set(ALL_TOOLS);
|
|
53
|
-
// Add dynamic tools
|
|
83
|
+
// Add dynamic tools (fallback for any SDK tools not in TOOLS)
|
|
54
84
|
for (const tool of distinctAllTools) {
|
|
55
85
|
const mcpName = `trace_${tool}`;
|
|
56
|
-
if (!definedNames.has(mcpName)) {
|
|
86
|
+
if (!definedNames.has(mcpName) && (allTools || !NON_CORE_TOOLS.has(mcpName))) {
|
|
57
87
|
definedTools.push({
|
|
58
88
|
name: mcpName,
|
|
59
89
|
description: `Execute ${tool} (Dynamic Tool)`,
|
package/package.json
CHANGED
package/src/server.ts
CHANGED
|
@@ -11,6 +11,34 @@ import {
|
|
|
11
11
|
} from '@modelcontextprotocol/sdk/types.js';
|
|
12
12
|
import { Trace, ALL_TOOLS } from '@probebrowser/sdk';
|
|
13
13
|
import { TOOLS } from './tools.js';
|
|
14
|
+
|
|
15
|
+
// Tools hidden by default to stay within IDE 100-tool limits.
|
|
16
|
+
// Set TRACE_ALL_TOOLS=true to expose everything.
|
|
17
|
+
const NON_CORE_TOOLS = new Set([
|
|
18
|
+
// Node.js debugger (7) - browser-focused IDEs rarely need these
|
|
19
|
+
'trace_connect_node_debugger', 'trace_node_list_scripts', 'trace_node_get_source',
|
|
20
|
+
'trace_node_set_breakpoint', 'trace_node_get_variables', 'trace_node_step_debugger',
|
|
21
|
+
'trace_node_evaluate',
|
|
22
|
+
// Cache Storage (3) - niche
|
|
23
|
+
'trace_get_caches', 'trace_get_cache_contents', 'trace_delete_cache',
|
|
24
|
+
// Code/filesystem (11) - IDE already provides these
|
|
25
|
+
'trace_read_file', 'trace_search_code', 'trace_get_file_tree', 'trace_get_project_info',
|
|
26
|
+
'trace_get_error_context', 'trace_git_blame', 'trace_git_recent_changes',
|
|
27
|
+
'trace_get_imports', 'trace_find_usages', 'trace_get_related_files', 'trace_get_env_vars',
|
|
28
|
+
// Advanced debugger (6) - power-user only
|
|
29
|
+
'trace_capture_execution_state', 'trace_get_execution_history',
|
|
30
|
+
'trace_watch_for_changes', 'trace_check_changes', 'trace_trace_variable_origin',
|
|
31
|
+
'trace_debug_and_analyze',
|
|
32
|
+
// Advanced source (5) - power-user only
|
|
33
|
+
'trace_blackbox_script', 'trace_list_blackbox_patterns', 'trace_list_original_sources',
|
|
34
|
+
'trace_get_original_location', 'trace_map_call_stack',
|
|
35
|
+
// Advanced DOM (3)
|
|
36
|
+
'trace_find_ghost_blockers', 'trace_find_hidden_interactive_elements', 'trace_inspect_mode',
|
|
37
|
+
// Tracing (3) - niche
|
|
38
|
+
'trace_start_trace', 'trace_get_trace_spans', 'trace_get_error_rate',
|
|
39
|
+
// Timeline deep-dive (2) - niche
|
|
40
|
+
'trace_diff_from_snapshot', 'trace_get_events_in_window',
|
|
41
|
+
]);
|
|
14
42
|
import { z } from 'zod';
|
|
15
43
|
import { zodToJsonSchema as _zodToJsonSchema } from 'zod-to-json-schema';
|
|
16
44
|
|
|
@@ -62,19 +90,23 @@ export class TraceMcpServer {
|
|
|
62
90
|
// 1. TOOLS
|
|
63
91
|
// ============================================
|
|
64
92
|
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
93
|
+
const allTools = process.env.TRACE_ALL_TOOLS === 'true';
|
|
94
|
+
|
|
95
|
+
const definedTools: Tool[] = Object.entries(TOOLS)
|
|
96
|
+
.filter(([name]) => allTools || !NON_CORE_TOOLS.has(name))
|
|
97
|
+
.map(([name, def]) => ({
|
|
98
|
+
name,
|
|
99
|
+
description: def.description,
|
|
100
|
+
inputSchema: zodToJsonSchema(def.schema),
|
|
101
|
+
}));
|
|
70
102
|
|
|
71
103
|
const definedNames = new Set(Object.keys(TOOLS));
|
|
72
104
|
const distinctAllTools = new Set(ALL_TOOLS);
|
|
73
105
|
|
|
74
|
-
// Add dynamic tools
|
|
106
|
+
// Add dynamic tools (fallback for any SDK tools not in TOOLS)
|
|
75
107
|
for (const tool of distinctAllTools) {
|
|
76
108
|
const mcpName = `trace_${tool}`;
|
|
77
|
-
if (!definedNames.has(mcpName)) {
|
|
109
|
+
if (!definedNames.has(mcpName) && (allTools || !NON_CORE_TOOLS.has(mcpName))) {
|
|
78
110
|
definedTools.push({
|
|
79
111
|
name: mcpName,
|
|
80
112
|
description: `Execute ${tool} (Dynamic Tool)`,
|