Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/main/kotlin/net/portswigger/mcp/tools/Tools.kt
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,15 @@ fun Server.registerTools(api: MontoyaApi, config: McpConfig) {
.map { truncateIfNeeded(Json.encodeToString(it.toSerializableForm())) }
}

mcpTool<GetProxyHttpHistoryIndex>("Display single item within the proxy HTTP history by the specified index.") {
val requestResponse = api.proxy().history().getOrNull(index - 1)
if (requestResponse == null) {
"No HTTP history found at $index"
} else {
truncateIfNeeded(Json.encodeToString(requestResponse.toSerializableForm()))
}
}

mcpPaginatedTool<GetProxyWebsocketHistory>("Displays items within the proxy WebSocket history") {
val allowed = runBlocking {
checkHistoryPermissionOrDeny(HistoryAccessType.WEBSOCKET_HISTORY, config, api, "WebSocket history")
Expand Down Expand Up @@ -411,6 +420,9 @@ data class GetProxyHttpHistory(override val count: Int, override val offset: Int
@Serializable
data class GetProxyHttpHistoryRegex(val regex: String, override val count: Int, override val offset: Int) : Paginated

@Serializable
data class GetProxyHttpHistoryIndex(val index: Int)

@Serializable
data class GetProxyWebsocketHistory(override val count: Int, override val offset: Int) : Paginated

Expand Down