@ricardodeazambuja/browser-mcp-server 1.3.0 → 1.4.0
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/CHANGELOG-v1.4.0.md +8 -0
- package/README.md +87 -6
- package/package.json +3 -2
- package/src/browser.js +2 -0
- package/src/cdp.js +58 -0
- package/src/index.js +2 -2
- package/src/tools/docs.js +798 -0
- package/src/tools/index.js +5 -1
- package/src/tools/network.js +552 -0
- package/src/tools/performance.js +517 -0
- package/src/tools/security.js +470 -0
- package/src/tools/storage.js +467 -0
- package/src/tools/system.js +5 -1
- package/src/utils.js +12 -1
- package/tests/fixtures/test-network.html +48 -0
- package/tests/fixtures/test-performance.html +61 -0
- package/tests/fixtures/test-security.html +33 -0
- package/tests/fixtures/test-storage.html +76 -0
- package/tests/run-all.js +50 -0
- package/tests/test-mcp.js +3 -2
- package/tests/test-network.js +212 -0
- package/tests/test-performance.js +254 -0
- package/tests/test-security.js +203 -0
- package/tests/test-storage.js +192 -0
package/src/tools/docs.js
CHANGED
|
@@ -757,6 +757,804 @@ Information Returned:
|
|
|
757
757
|
|
|
758
758
|
Example:
|
|
759
759
|
browser_health_check({})
|
|
760
|
+
`,
|
|
761
|
+
|
|
762
|
+
// ========================================
|
|
763
|
+
// Performance Profiling Tools (CDP)
|
|
764
|
+
// ========================================
|
|
765
|
+
|
|
766
|
+
browser_perf_start_profile: `
|
|
767
|
+
📖 browser_perf_start_profile(sampleInterval?)
|
|
768
|
+
|
|
769
|
+
Start CPU profiling to track JavaScript execution performance.
|
|
770
|
+
|
|
771
|
+
Parameters:
|
|
772
|
+
• sampleInterval (number, optional) - Microseconds between samples (default: 100)
|
|
773
|
+
|
|
774
|
+
Returns:
|
|
775
|
+
{ content: [{ type: 'text', text: 'CPU profiling started...' }] }
|
|
776
|
+
|
|
777
|
+
Behavior:
|
|
778
|
+
• Uses Chrome DevTools Protocol Profiler domain
|
|
779
|
+
• Captures JavaScript call stacks at regular intervals
|
|
780
|
+
• Must call browser_perf_stop_profile to get results
|
|
781
|
+
• Profiling remains active across page navigations
|
|
782
|
+
|
|
783
|
+
⚠️ Important:
|
|
784
|
+
• Profiling adds performance overhead
|
|
785
|
+
• Profile data can be very large (10,000+ nodes for complex apps)
|
|
786
|
+
• Use for debugging/optimization, not production monitoring
|
|
787
|
+
• Only one profile session can be active at a time
|
|
788
|
+
|
|
789
|
+
Example:
|
|
790
|
+
browser_perf_start_profile({})
|
|
791
|
+
browser_perf_start_profile({ sampleInterval: 50 }) // More granular sampling
|
|
792
|
+
`,
|
|
793
|
+
|
|
794
|
+
browser_perf_stop_profile: `
|
|
795
|
+
📖 browser_perf_stop_profile()
|
|
796
|
+
|
|
797
|
+
Stop CPU profiling and get profile data with summary statistics.
|
|
798
|
+
|
|
799
|
+
Parameters:
|
|
800
|
+
None
|
|
801
|
+
|
|
802
|
+
Returns:
|
|
803
|
+
{ content: [{ type: 'text', text: 'CPU Profile Results: {...summary...}' }] }
|
|
804
|
+
|
|
805
|
+
Return Structure:
|
|
806
|
+
{
|
|
807
|
+
totalNodes: number,
|
|
808
|
+
totalSamples: number,
|
|
809
|
+
durationMicroseconds: number,
|
|
810
|
+
durationMs: string,
|
|
811
|
+
topFunctions: [
|
|
812
|
+
{ function: string, url: string, line: number }
|
|
813
|
+
]
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
⚠️ Important:
|
|
817
|
+
• Must call browser_perf_start_profile first
|
|
818
|
+
• Returns summarized data - full profile too large to display
|
|
819
|
+
• Top 15 functions shown by default
|
|
820
|
+
• Use Chrome DevTools for detailed profile analysis
|
|
821
|
+
|
|
822
|
+
Example:
|
|
823
|
+
browser_perf_stop_profile({})
|
|
824
|
+
`,
|
|
825
|
+
|
|
826
|
+
browser_perf_take_heap_snapshot: `
|
|
827
|
+
📖 browser_perf_take_heap_snapshot(reportProgress?)
|
|
828
|
+
|
|
829
|
+
Capture a heap snapshot for memory analysis and leak detection.
|
|
830
|
+
|
|
831
|
+
Parameters:
|
|
832
|
+
• reportProgress (boolean, optional) - Report progress events (default: false)
|
|
833
|
+
|
|
834
|
+
Returns:
|
|
835
|
+
{ content: [{ type: 'text', text: 'Heap Snapshot Captured: X KB...' }] }
|
|
836
|
+
|
|
837
|
+
Return Structure:
|
|
838
|
+
{
|
|
839
|
+
size: string, // In KB
|
|
840
|
+
chunks: number
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
⚠️ Important:
|
|
844
|
+
• Snapshot can be very large (10+ MB for complex apps)
|
|
845
|
+
• May freeze browser briefly during capture
|
|
846
|
+
• Full snapshot data not returned (use Chrome DevTools to analyze)
|
|
847
|
+
• Useful for detecting memory leaks
|
|
848
|
+
|
|
849
|
+
Example:
|
|
850
|
+
browser_perf_take_heap_snapshot({})
|
|
851
|
+
browser_perf_take_heap_snapshot({ reportProgress: true })
|
|
852
|
+
`,
|
|
853
|
+
|
|
854
|
+
browser_perf_get_heap_usage: `
|
|
855
|
+
📖 browser_perf_get_heap_usage()
|
|
856
|
+
|
|
857
|
+
Get current JavaScript heap usage statistics.
|
|
858
|
+
|
|
859
|
+
Parameters:
|
|
860
|
+
None
|
|
861
|
+
|
|
862
|
+
Returns:
|
|
863
|
+
{ content: [{ type: 'text', text: 'JavaScript Heap Usage: {...}' }] }
|
|
864
|
+
|
|
865
|
+
Return Structure:
|
|
866
|
+
{
|
|
867
|
+
usedSize: number, // Bytes
|
|
868
|
+
usedSizeMB: string,
|
|
869
|
+
totalSize: number, // Bytes
|
|
870
|
+
totalSizeMB: string,
|
|
871
|
+
limit: number, // Max heap size
|
|
872
|
+
limitMB: string,
|
|
873
|
+
usagePercent: string
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
Use Case:
|
|
877
|
+
• Monitor memory usage in real-time
|
|
878
|
+
• Detect potential memory leaks
|
|
879
|
+
• Track memory growth over time
|
|
880
|
+
|
|
881
|
+
Example:
|
|
882
|
+
browser_perf_get_heap_usage({})
|
|
883
|
+
`,
|
|
884
|
+
|
|
885
|
+
browser_perf_get_metrics: `
|
|
886
|
+
📖 browser_perf_get_metrics()
|
|
887
|
+
|
|
888
|
+
Get runtime performance metrics (DOM nodes, event listeners, JS heap).
|
|
889
|
+
|
|
890
|
+
Parameters:
|
|
891
|
+
None
|
|
892
|
+
|
|
893
|
+
Returns:
|
|
894
|
+
{ content: [{ type: 'text', text: 'Runtime Performance Metrics: [...]' }] }
|
|
895
|
+
|
|
896
|
+
Return Structure:
|
|
897
|
+
[
|
|
898
|
+
{ name: 'Timestamp', value: number },
|
|
899
|
+
{ name: 'Documents', value: number },
|
|
900
|
+
{ name: 'Frames', value: number },
|
|
901
|
+
{ name: 'JSEventListeners', value: number },
|
|
902
|
+
{ name: 'Nodes', value: number },
|
|
903
|
+
{ name: 'LayoutCount', value: number },
|
|
904
|
+
{ name: 'RecalcStyleCount', value: number },
|
|
905
|
+
{ name: 'JSHeapUsedSize', value: number },
|
|
906
|
+
{ name: 'JSHeapTotalSize', value: number }
|
|
907
|
+
]
|
|
908
|
+
|
|
909
|
+
Use Case:
|
|
910
|
+
• Track DOM complexity
|
|
911
|
+
• Monitor event listener count
|
|
912
|
+
• Measure layout/style recalculations
|
|
913
|
+
|
|
914
|
+
Example:
|
|
915
|
+
browser_perf_get_metrics({})
|
|
916
|
+
`,
|
|
917
|
+
|
|
918
|
+
browser_perf_get_performance_metrics: `
|
|
919
|
+
📖 browser_perf_get_performance_metrics()
|
|
920
|
+
|
|
921
|
+
Get web vitals and navigation timing (FCP, LCP, CLS, TTFB).
|
|
922
|
+
|
|
923
|
+
Parameters:
|
|
924
|
+
None
|
|
925
|
+
|
|
926
|
+
Returns:
|
|
927
|
+
{ content: [{ type: 'text', text: 'Web Performance Metrics: {...}' }] }
|
|
928
|
+
|
|
929
|
+
Return Structure:
|
|
930
|
+
{
|
|
931
|
+
navigation: {
|
|
932
|
+
domContentLoaded: number, // ms
|
|
933
|
+
loadComplete: number,
|
|
934
|
+
domInteractive: number,
|
|
935
|
+
ttfb: number // Time to First Byte
|
|
936
|
+
},
|
|
937
|
+
paint: {
|
|
938
|
+
'first-paint': number,
|
|
939
|
+
'first-contentful-paint': number
|
|
940
|
+
},
|
|
941
|
+
webVitals: {
|
|
942
|
+
lcp: number, // Largest Contentful Paint
|
|
943
|
+
cls: number // Cumulative Layout Shift
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
⚠️ Note:
|
|
948
|
+
• Some metrics may not be available depending on page state
|
|
949
|
+
• Web vitals require user interaction for accuracy
|
|
950
|
+
• Metrics based on Performance API
|
|
951
|
+
|
|
952
|
+
Example:
|
|
953
|
+
browser_perf_get_performance_metrics({})
|
|
954
|
+
`,
|
|
955
|
+
|
|
956
|
+
browser_perf_start_coverage: `
|
|
957
|
+
📖 browser_perf_start_coverage(resetOnNavigation?)
|
|
958
|
+
|
|
959
|
+
Start tracking CSS and JavaScript code coverage.
|
|
960
|
+
|
|
961
|
+
Parameters:
|
|
962
|
+
• resetOnNavigation (boolean, optional) - Reset coverage on navigation (default: true)
|
|
963
|
+
|
|
964
|
+
Returns:
|
|
965
|
+
{ content: [{ type: 'text', text: 'Code coverage started...' }] }
|
|
966
|
+
|
|
967
|
+
Behavior:
|
|
968
|
+
• Tracks which CSS rules and JS code are executed
|
|
969
|
+
• Helps identify unused code for optimization
|
|
970
|
+
• Must call browser_perf_stop_coverage to get results
|
|
971
|
+
|
|
972
|
+
Use Case:
|
|
973
|
+
• Find unused CSS/JS for code splitting
|
|
974
|
+
• Optimize bundle size
|
|
975
|
+
• Identify dead code
|
|
976
|
+
|
|
977
|
+
Example:
|
|
978
|
+
browser_perf_start_coverage({})
|
|
979
|
+
browser_perf_start_coverage({ resetOnNavigation: false })
|
|
980
|
+
`,
|
|
981
|
+
|
|
982
|
+
browser_perf_stop_coverage: `
|
|
983
|
+
📖 browser_perf_stop_coverage()
|
|
984
|
+
|
|
985
|
+
Stop coverage tracking and get results showing used vs unused code.
|
|
986
|
+
|
|
987
|
+
Parameters:
|
|
988
|
+
None
|
|
989
|
+
|
|
990
|
+
Returns:
|
|
991
|
+
{ content: [{ type: 'text', text: 'Code Coverage Results: {...}' }] }
|
|
992
|
+
|
|
993
|
+
Return Structure:
|
|
994
|
+
{
|
|
995
|
+
javascript: {
|
|
996
|
+
filesAnalyzed: number,
|
|
997
|
+
topFiles: [
|
|
998
|
+
{ url: string, usedBytes: number, totalBytes: number, coverage: string }
|
|
999
|
+
]
|
|
1000
|
+
},
|
|
1001
|
+
css: {
|
|
1002
|
+
rulesAnalyzed: number,
|
|
1003
|
+
topRules: [
|
|
1004
|
+
{ used: boolean, styleSheetId: string, ... }
|
|
1005
|
+
]
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
⚠️ Important:
|
|
1010
|
+
• Must call browser_perf_start_coverage first
|
|
1011
|
+
• Shows top 10 files by default
|
|
1012
|
+
• Full coverage data available via CDP
|
|
1013
|
+
|
|
1014
|
+
Example:
|
|
1015
|
+
browser_perf_stop_coverage({})
|
|
1016
|
+
`,
|
|
1017
|
+
|
|
1018
|
+
// ========================================
|
|
1019
|
+
// Network Analysis Tools (CDP)
|
|
1020
|
+
// ========================================
|
|
1021
|
+
|
|
1022
|
+
browser_net_start_monitoring: `
|
|
1023
|
+
📖 browser_net_start_monitoring(patterns?)
|
|
1024
|
+
|
|
1025
|
+
Start monitoring network requests with detailed timing.
|
|
1026
|
+
|
|
1027
|
+
Parameters:
|
|
1028
|
+
• patterns (array, optional) - URL patterns to monitor (default: all)
|
|
1029
|
+
|
|
1030
|
+
Returns:
|
|
1031
|
+
{ content: [{ type: 'text', text: 'Network monitoring started...' }] }
|
|
1032
|
+
|
|
1033
|
+
Behavior:
|
|
1034
|
+
• Captures all network requests and responses
|
|
1035
|
+
• Records detailed timing information
|
|
1036
|
+
• Tracks WebSocket frames
|
|
1037
|
+
• Limited to 500 requests to prevent memory issues
|
|
1038
|
+
|
|
1039
|
+
Use Case:
|
|
1040
|
+
• Debug API calls
|
|
1041
|
+
• Analyze network performance
|
|
1042
|
+
• Inspect request/response details
|
|
1043
|
+
|
|
1044
|
+
Example:
|
|
1045
|
+
browser_net_start_monitoring({})
|
|
1046
|
+
browser_net_start_monitoring({ patterns: ['https://api.example.com/*'] })
|
|
1047
|
+
`,
|
|
1048
|
+
|
|
1049
|
+
browser_net_get_requests: `
|
|
1050
|
+
📖 browser_net_get_requests(filter?)
|
|
1051
|
+
|
|
1052
|
+
Get captured network requests with timing breakdown.
|
|
1053
|
+
|
|
1054
|
+
Parameters:
|
|
1055
|
+
• filter (string, optional) - Filter by URL substring
|
|
1056
|
+
|
|
1057
|
+
Returns:
|
|
1058
|
+
{ content: [{ type: 'text', text: 'Network Requests: {...}' }] }
|
|
1059
|
+
|
|
1060
|
+
Return Structure:
|
|
1061
|
+
{
|
|
1062
|
+
totalCaptured: number,
|
|
1063
|
+
filtered: number,
|
|
1064
|
+
requests: [
|
|
1065
|
+
{
|
|
1066
|
+
method: string,
|
|
1067
|
+
url: string,
|
|
1068
|
+
status: number,
|
|
1069
|
+
type: string,
|
|
1070
|
+
size: string,
|
|
1071
|
+
timing: string,
|
|
1072
|
+
failed: boolean,
|
|
1073
|
+
fromCache: boolean
|
|
1074
|
+
}
|
|
1075
|
+
]
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
⚠️ Important:
|
|
1079
|
+
• Must call browser_net_start_monitoring first
|
|
1080
|
+
• Limited to 50 requests in output for readability
|
|
1081
|
+
• Use filter parameter to narrow results
|
|
1082
|
+
|
|
1083
|
+
Example:
|
|
1084
|
+
browser_net_get_requests({})
|
|
1085
|
+
browser_net_get_requests({ filter: 'api' })
|
|
1086
|
+
`,
|
|
1087
|
+
|
|
1088
|
+
browser_net_stop_monitoring: `
|
|
1089
|
+
📖 browser_net_stop_monitoring()
|
|
1090
|
+
|
|
1091
|
+
Stop network monitoring and clear request log.
|
|
1092
|
+
|
|
1093
|
+
Parameters:
|
|
1094
|
+
None
|
|
1095
|
+
|
|
1096
|
+
Returns:
|
|
1097
|
+
{ content: [{ type: 'text', text: 'Network monitoring stopped. Captured X requests...' }] }
|
|
1098
|
+
|
|
1099
|
+
Behavior:
|
|
1100
|
+
• Disables network tracking
|
|
1101
|
+
• Clears all captured requests
|
|
1102
|
+
• Removes event listeners
|
|
1103
|
+
|
|
1104
|
+
Example:
|
|
1105
|
+
browser_net_stop_monitoring({})
|
|
1106
|
+
`,
|
|
1107
|
+
|
|
1108
|
+
browser_net_export_har: `
|
|
1109
|
+
📖 browser_net_export_har(includeContent?)
|
|
1110
|
+
|
|
1111
|
+
Export full network activity log in HAR (HTTP Archive) format.
|
|
1112
|
+
|
|
1113
|
+
Parameters:
|
|
1114
|
+
• includeContent (boolean, optional) - Include response bodies (default: false)
|
|
1115
|
+
|
|
1116
|
+
Returns:
|
|
1117
|
+
{ content: [{ type: 'text', text: 'HAR Export: {...}' }] }
|
|
1118
|
+
|
|
1119
|
+
Return Structure:
|
|
1120
|
+
{
|
|
1121
|
+
log: {
|
|
1122
|
+
version: '1.2',
|
|
1123
|
+
creator: { name: string, version: string },
|
|
1124
|
+
entries: [
|
|
1125
|
+
{
|
|
1126
|
+
startedDateTime: string,
|
|
1127
|
+
time: number,
|
|
1128
|
+
request: { method: string, url: string, headers: [...] },
|
|
1129
|
+
response: { status: number, headers: [...], content: {...} },
|
|
1130
|
+
timings: { send: number, wait: number, receive: number }
|
|
1131
|
+
}
|
|
1132
|
+
]
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
⚠️ Important:
|
|
1137
|
+
• Must have network monitoring active
|
|
1138
|
+
• HAR data can be very large
|
|
1139
|
+
• Compatible with HAR viewers and analysis tools
|
|
1140
|
+
|
|
1141
|
+
Example:
|
|
1142
|
+
browser_net_export_har({})
|
|
1143
|
+
browser_net_export_har({ includeContent: true })
|
|
1144
|
+
`,
|
|
1145
|
+
|
|
1146
|
+
browser_net_get_websocket_frames: `
|
|
1147
|
+
📖 browser_net_get_websocket_frames(requestId)
|
|
1148
|
+
|
|
1149
|
+
Get WebSocket frames for inspecting real-time communication.
|
|
1150
|
+
|
|
1151
|
+
Parameters:
|
|
1152
|
+
• requestId (string, required) - Request ID from network monitoring
|
|
1153
|
+
|
|
1154
|
+
Returns:
|
|
1155
|
+
{ content: [{ type: 'text', text: 'WebSocket Frames: [...]' }] }
|
|
1156
|
+
|
|
1157
|
+
Return Structure:
|
|
1158
|
+
[
|
|
1159
|
+
{
|
|
1160
|
+
direction: 'sent' | 'received',
|
|
1161
|
+
opcode: number,
|
|
1162
|
+
payloadLength: number,
|
|
1163
|
+
payload: string, // First 100 chars
|
|
1164
|
+
timestamp: string
|
|
1165
|
+
}
|
|
1166
|
+
]
|
|
1167
|
+
|
|
1168
|
+
Use Case:
|
|
1169
|
+
• Debug WebSocket communication
|
|
1170
|
+
• Inspect real-time message flow
|
|
1171
|
+
• Analyze WebSocket protocols
|
|
1172
|
+
|
|
1173
|
+
Example:
|
|
1174
|
+
browser_net_get_websocket_frames({ requestId: '1234.5' })
|
|
1175
|
+
`,
|
|
1176
|
+
|
|
1177
|
+
browser_net_set_request_blocking: `
|
|
1178
|
+
📖 browser_net_set_request_blocking(patterns)
|
|
1179
|
+
|
|
1180
|
+
Block requests matching URL patterns.
|
|
1181
|
+
|
|
1182
|
+
Parameters:
|
|
1183
|
+
• patterns (array, required) - URL patterns to block (e.g., ["*.jpg", "*analytics*"])
|
|
1184
|
+
|
|
1185
|
+
Returns:
|
|
1186
|
+
{ content: [{ type: 'text', text: 'Request blocking enabled...' }] }
|
|
1187
|
+
|
|
1188
|
+
Behavior:
|
|
1189
|
+
• Blocks requests before they're sent
|
|
1190
|
+
• Supports wildcard patterns
|
|
1191
|
+
• Useful for testing without certain resources
|
|
1192
|
+
|
|
1193
|
+
Use Case:
|
|
1194
|
+
• Block ads and trackers
|
|
1195
|
+
• Test page without images
|
|
1196
|
+
• Simulate missing resources
|
|
1197
|
+
|
|
1198
|
+
Example:
|
|
1199
|
+
browser_net_set_request_blocking({ patterns: ['*.jpg', '*.png'] })
|
|
1200
|
+
browser_net_set_request_blocking({ patterns: ['*analytics*', '*tracking*'] })
|
|
1201
|
+
`,
|
|
1202
|
+
|
|
1203
|
+
browser_net_emulate_conditions: `
|
|
1204
|
+
📖 browser_net_emulate_conditions(offline, latency, downloadThroughput, uploadThroughput)
|
|
1205
|
+
|
|
1206
|
+
Emulate network conditions (throttling).
|
|
1207
|
+
|
|
1208
|
+
Parameters:
|
|
1209
|
+
• offline (boolean, required) - Emulate offline mode
|
|
1210
|
+
• latency (number, required) - Round-trip latency in ms
|
|
1211
|
+
• downloadThroughput (number, required) - Download speed in bytes/second (-1 for unlimited)
|
|
1212
|
+
• uploadThroughput (number, required) - Upload speed in bytes/second (-1 for unlimited)
|
|
1213
|
+
|
|
1214
|
+
Returns:
|
|
1215
|
+
{ content: [{ type: 'text', text: 'Network conditions applied: {...}' }] }
|
|
1216
|
+
|
|
1217
|
+
Common Presets:
|
|
1218
|
+
• Fast 3G: { offline: false, latency: 562.5, downloadThroughput: 180000, uploadThroughput: 84000 }
|
|
1219
|
+
• Slow 3G: { offline: false, latency: 2000, downloadThroughput: 50000, uploadThroughput: 50000 }
|
|
1220
|
+
• Offline: { offline: true, latency: 0, downloadThroughput: 0, uploadThroughput: 0 }
|
|
1221
|
+
|
|
1222
|
+
Use Case:
|
|
1223
|
+
• Test on slow connections
|
|
1224
|
+
• Simulate offline behavior
|
|
1225
|
+
• Performance testing
|
|
1226
|
+
|
|
1227
|
+
Example:
|
|
1228
|
+
browser_net_emulate_conditions({ offline: false, latency: 100, downloadThroughput: 1000000, uploadThroughput: 500000 })
|
|
1229
|
+
`,
|
|
1230
|
+
|
|
1231
|
+
// ========================================
|
|
1232
|
+
// Security Testing Tools (CDP)
|
|
1233
|
+
// ========================================
|
|
1234
|
+
|
|
1235
|
+
browser_sec_get_security_headers: `
|
|
1236
|
+
📖 browser_sec_get_security_headers()
|
|
1237
|
+
|
|
1238
|
+
Inspect security-related HTTP headers.
|
|
1239
|
+
|
|
1240
|
+
Parameters:
|
|
1241
|
+
None
|
|
1242
|
+
|
|
1243
|
+
Returns:
|
|
1244
|
+
{ content: [{ type: 'text', text: 'Security Headers: {...}' }] }
|
|
1245
|
+
|
|
1246
|
+
Return Structure:
|
|
1247
|
+
{
|
|
1248
|
+
'content-security-policy': string,
|
|
1249
|
+
'strict-transport-security': string,
|
|
1250
|
+
'x-frame-options': string,
|
|
1251
|
+
'x-content-type-options': string,
|
|
1252
|
+
'referrer-policy': string,
|
|
1253
|
+
'permissions-policy': string
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
Use Case:
|
|
1257
|
+
• Security audits
|
|
1258
|
+
• Verify CSP configuration
|
|
1259
|
+
• Check HTTPS enforcement
|
|
1260
|
+
|
|
1261
|
+
⚠️ Note:
|
|
1262
|
+
• May require network monitoring for some headers
|
|
1263
|
+
• Shows 'Not set' for missing headers
|
|
1264
|
+
|
|
1265
|
+
Example:
|
|
1266
|
+
browser_sec_get_security_headers({})
|
|
1267
|
+
`,
|
|
1268
|
+
|
|
1269
|
+
browser_sec_get_certificate_info: `
|
|
1270
|
+
📖 browser_sec_get_certificate_info()
|
|
1271
|
+
|
|
1272
|
+
Get TLS/SSL certificate details for HTTPS sites.
|
|
1273
|
+
|
|
1274
|
+
Parameters:
|
|
1275
|
+
None
|
|
1276
|
+
|
|
1277
|
+
Returns:
|
|
1278
|
+
{ content: [{ type: 'text', text: 'Certificate Information: {...}' }] }
|
|
1279
|
+
|
|
1280
|
+
⚠️ Important:
|
|
1281
|
+
• Only works on HTTPS pages
|
|
1282
|
+
• Returns error on HTTP pages
|
|
1283
|
+
• Detailed certificate info requires monitoring during page load
|
|
1284
|
+
|
|
1285
|
+
Use Case:
|
|
1286
|
+
• Verify certificate validity
|
|
1287
|
+
• Check TLS configuration
|
|
1288
|
+
• Security compliance testing
|
|
1289
|
+
|
|
1290
|
+
Example:
|
|
1291
|
+
browser_sec_get_certificate_info({})
|
|
1292
|
+
`,
|
|
1293
|
+
|
|
1294
|
+
browser_sec_detect_mixed_content: `
|
|
1295
|
+
📖 browser_sec_detect_mixed_content()
|
|
1296
|
+
|
|
1297
|
+
Detect mixed content warnings (HTTPS page loading HTTP resources).
|
|
1298
|
+
|
|
1299
|
+
Parameters:
|
|
1300
|
+
None
|
|
1301
|
+
|
|
1302
|
+
Returns:
|
|
1303
|
+
{ content: [{ type: 'text', text: 'Mixed Content Detected: {...}' }] }
|
|
1304
|
+
|
|
1305
|
+
Return Structure:
|
|
1306
|
+
{
|
|
1307
|
+
total: number,
|
|
1308
|
+
blocked: number,
|
|
1309
|
+
issues: [
|
|
1310
|
+
{ url: string, type: 'script' | 'image' | 'stylesheet', blocked: boolean }
|
|
1311
|
+
]
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
⚠️ Important:
|
|
1315
|
+
• Only applies to HTTPS pages
|
|
1316
|
+
• Scripts are usually blocked by browser
|
|
1317
|
+
• Images/stylesheets may load with warning
|
|
1318
|
+
|
|
1319
|
+
Use Case:
|
|
1320
|
+
• Security audits
|
|
1321
|
+
• HTTPS migration testing
|
|
1322
|
+
• Find insecure resources
|
|
1323
|
+
|
|
1324
|
+
Example:
|
|
1325
|
+
browser_sec_detect_mixed_content({})
|
|
1326
|
+
`,
|
|
1327
|
+
|
|
1328
|
+
browser_sec_start_csp_monitoring: `
|
|
1329
|
+
📖 browser_sec_start_csp_monitoring()
|
|
1330
|
+
|
|
1331
|
+
Monitor Content Security Policy violations.
|
|
1332
|
+
|
|
1333
|
+
Parameters:
|
|
1334
|
+
None
|
|
1335
|
+
|
|
1336
|
+
Returns:
|
|
1337
|
+
{ content: [{ type: 'text', text: 'CSP violation monitoring started...' }] }
|
|
1338
|
+
|
|
1339
|
+
Behavior:
|
|
1340
|
+
• Captures CSP violation console messages
|
|
1341
|
+
• Must call browser_sec_get_csp_violations to view
|
|
1342
|
+
• Call browser_sec_stop_csp_monitoring to stop
|
|
1343
|
+
|
|
1344
|
+
Use Case:
|
|
1345
|
+
• Debug CSP configuration
|
|
1346
|
+
• Find policy violations
|
|
1347
|
+
• Security testing
|
|
1348
|
+
|
|
1349
|
+
Example:
|
|
1350
|
+
browser_sec_start_csp_monitoring({})
|
|
1351
|
+
`,
|
|
1352
|
+
|
|
1353
|
+
browser_sec_get_csp_violations: `
|
|
1354
|
+
📖 browser_sec_get_csp_violations()
|
|
1355
|
+
|
|
1356
|
+
Get captured CSP violations.
|
|
1357
|
+
|
|
1358
|
+
Parameters:
|
|
1359
|
+
None
|
|
1360
|
+
|
|
1361
|
+
Returns:
|
|
1362
|
+
{ content: [{ type: 'text', text: 'CSP Violations: {...}' }] }
|
|
1363
|
+
|
|
1364
|
+
Return Structure:
|
|
1365
|
+
{
|
|
1366
|
+
total: number,
|
|
1367
|
+
violations: [
|
|
1368
|
+
{
|
|
1369
|
+
timestamp: string,
|
|
1370
|
+
message: string,
|
|
1371
|
+
level: string,
|
|
1372
|
+
source: string
|
|
1373
|
+
}
|
|
1374
|
+
]
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
⚠️ Important:
|
|
1378
|
+
• Must call browser_sec_start_csp_monitoring first
|
|
1379
|
+
• Violations captured in real-time
|
|
1380
|
+
|
|
1381
|
+
Example:
|
|
1382
|
+
browser_sec_get_csp_violations({})
|
|
1383
|
+
`,
|
|
1384
|
+
|
|
1385
|
+
browser_sec_stop_csp_monitoring: `
|
|
1386
|
+
📖 browser_sec_stop_csp_monitoring()
|
|
1387
|
+
|
|
1388
|
+
Stop CSP monitoring and clear violations.
|
|
1389
|
+
|
|
1390
|
+
Parameters:
|
|
1391
|
+
None
|
|
1392
|
+
|
|
1393
|
+
Returns:
|
|
1394
|
+
{ content: [{ type: 'text', text: 'CSP monitoring stopped. Captured X violations...' }] }
|
|
1395
|
+
|
|
1396
|
+
Behavior:
|
|
1397
|
+
• Stops monitoring
|
|
1398
|
+
• Clears violation log
|
|
1399
|
+
• Removes event listeners
|
|
1400
|
+
|
|
1401
|
+
Example:
|
|
1402
|
+
browser_sec_stop_csp_monitoring({})
|
|
1403
|
+
`,
|
|
1404
|
+
|
|
1405
|
+
// ========================================
|
|
1406
|
+
// Storage & Service Workers Tools (CDP)
|
|
1407
|
+
// ========================================
|
|
1408
|
+
|
|
1409
|
+
browser_storage_get_indexeddb: `
|
|
1410
|
+
📖 browser_storage_get_indexeddb(databaseName?, objectStoreName?)
|
|
1411
|
+
|
|
1412
|
+
Inspect IndexedDB databases and their data.
|
|
1413
|
+
|
|
1414
|
+
Parameters:
|
|
1415
|
+
• databaseName (string, optional) - Specific database to inspect
|
|
1416
|
+
• objectStoreName (string, optional) - Specific object store to query (requires databaseName)
|
|
1417
|
+
|
|
1418
|
+
Returns:
|
|
1419
|
+
{ content: [{ type: 'text', text: 'IndexedDB Databases/Data: {...}' }] }
|
|
1420
|
+
|
|
1421
|
+
Return Structure (no params):
|
|
1422
|
+
{ origin: string, databases: string[] }
|
|
1423
|
+
|
|
1424
|
+
Return Structure (databaseName only):
|
|
1425
|
+
{
|
|
1426
|
+
name: string,
|
|
1427
|
+
version: number,
|
|
1428
|
+
objectStores: [
|
|
1429
|
+
{ name: string, keyPath: any, autoIncrement: boolean, indexes: [...] }
|
|
1430
|
+
]
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
Return Structure (both params):
|
|
1434
|
+
{
|
|
1435
|
+
objectStore: string,
|
|
1436
|
+
entries: number,
|
|
1437
|
+
hasMore: boolean,
|
|
1438
|
+
data: [ { key: any, primaryKey: any, value: any } ]
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
⚠️ Important:
|
|
1442
|
+
• Limited to 100 entries per query
|
|
1443
|
+
• May require page to have used IndexedDB first
|
|
1444
|
+
|
|
1445
|
+
Example:
|
|
1446
|
+
browser_storage_get_indexeddb({})
|
|
1447
|
+
browser_storage_get_indexeddb({ databaseName: 'myDB' })
|
|
1448
|
+
browser_storage_get_indexeddb({ databaseName: 'myDB', objectStoreName: 'users' })
|
|
1449
|
+
`,
|
|
1450
|
+
|
|
1451
|
+
browser_storage_get_cache_storage: `
|
|
1452
|
+
📖 browser_storage_get_cache_storage(cacheName?)
|
|
1453
|
+
|
|
1454
|
+
List Cache Storage API caches and their entries.
|
|
1455
|
+
|
|
1456
|
+
Parameters:
|
|
1457
|
+
• cacheName (string, optional) - Specific cache to inspect
|
|
1458
|
+
|
|
1459
|
+
Returns:
|
|
1460
|
+
{ content: [{ type: 'text', text: 'Cache Storage Caches/Entries: {...}' }] }
|
|
1461
|
+
|
|
1462
|
+
Return Structure (no cacheName):
|
|
1463
|
+
{ origin: string, caches: string[] }
|
|
1464
|
+
|
|
1465
|
+
Return Structure (with cacheName):
|
|
1466
|
+
{
|
|
1467
|
+
cacheName: string,
|
|
1468
|
+
entryCount: number,
|
|
1469
|
+
entries: [
|
|
1470
|
+
{
|
|
1471
|
+
requestURL: string,
|
|
1472
|
+
requestMethod: string,
|
|
1473
|
+
responseStatus: number,
|
|
1474
|
+
responseType: string
|
|
1475
|
+
}
|
|
1476
|
+
]
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
⚠️ Important:
|
|
1480
|
+
• Limited to 50 entries per cache
|
|
1481
|
+
• Requires page to use Cache Storage API
|
|
1482
|
+
|
|
1483
|
+
Example:
|
|
1484
|
+
browser_storage_get_cache_storage({})
|
|
1485
|
+
browser_storage_get_cache_storage({ cacheName: 'my-cache-v1' })
|
|
1486
|
+
`,
|
|
1487
|
+
|
|
1488
|
+
browser_storage_delete_cache: `
|
|
1489
|
+
📖 browser_storage_delete_cache(cacheName)
|
|
1490
|
+
|
|
1491
|
+
Delete a specific cache from Cache Storage.
|
|
1492
|
+
|
|
1493
|
+
Parameters:
|
|
1494
|
+
• cacheName (string, required) - Cache name to delete
|
|
1495
|
+
|
|
1496
|
+
Returns:
|
|
1497
|
+
{ content: [{ type: 'text', text: 'Cache deleted successfully: ...' }] }
|
|
1498
|
+
|
|
1499
|
+
⚠️ Warning:
|
|
1500
|
+
• This permanently deletes the cache
|
|
1501
|
+
• Cannot be undone
|
|
1502
|
+
• May affect offline functionality
|
|
1503
|
+
|
|
1504
|
+
Example:
|
|
1505
|
+
browser_storage_delete_cache({ cacheName: 'old-cache-v1' })
|
|
1506
|
+
`,
|
|
1507
|
+
|
|
1508
|
+
browser_storage_get_service_workers: `
|
|
1509
|
+
📖 browser_storage_get_service_workers()
|
|
1510
|
+
|
|
1511
|
+
Get service worker registrations and their state.
|
|
1512
|
+
|
|
1513
|
+
Parameters:
|
|
1514
|
+
None
|
|
1515
|
+
|
|
1516
|
+
Returns:
|
|
1517
|
+
{ content: [{ type: 'text', text: 'Service Workers: {...}' }] }
|
|
1518
|
+
|
|
1519
|
+
Return Structure:
|
|
1520
|
+
[
|
|
1521
|
+
{
|
|
1522
|
+
scope: string,
|
|
1523
|
+
active: { scriptURL: string, state: string },
|
|
1524
|
+
installing: { scriptURL: string, state: string },
|
|
1525
|
+
waiting: { scriptURL: string, state: string }
|
|
1526
|
+
}
|
|
1527
|
+
]
|
|
1528
|
+
|
|
1529
|
+
States:
|
|
1530
|
+
• installing - Being installed
|
|
1531
|
+
• installed - Installed, waiting to activate
|
|
1532
|
+
• activating - Being activated
|
|
1533
|
+
• activated - Active and running
|
|
1534
|
+
• redundant - Replaced by newer version
|
|
1535
|
+
|
|
1536
|
+
Example:
|
|
1537
|
+
browser_storage_get_service_workers({})
|
|
1538
|
+
`,
|
|
1539
|
+
|
|
1540
|
+
browser_storage_unregister_service_worker: `
|
|
1541
|
+
📖 browser_storage_unregister_service_worker(scopeURL)
|
|
1542
|
+
|
|
1543
|
+
Unregister a service worker.
|
|
1544
|
+
|
|
1545
|
+
Parameters:
|
|
1546
|
+
• scopeURL (string, required) - Scope URL of service worker to unregister
|
|
1547
|
+
|
|
1548
|
+
Returns:
|
|
1549
|
+
{ content: [{ type: 'text', text: 'Service worker unregistered successfully...' }] }
|
|
1550
|
+
|
|
1551
|
+
⚠️ Warning:
|
|
1552
|
+
• This removes the service worker registration
|
|
1553
|
+
• May affect offline functionality
|
|
1554
|
+
• Page may need reload to take effect
|
|
1555
|
+
|
|
1556
|
+
Example:
|
|
1557
|
+
browser_storage_unregister_service_worker({ scopeURL: 'https://example.com/' })
|
|
760
1558
|
`
|
|
761
1559
|
};
|
|
762
1560
|
|