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
30 changes: 28 additions & 2 deletions src/main/kotlin/net/portswigger/mcp/tools/Tools.kt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,21 @@ fun Server.registerTools(api: MontoyaApi, config: McpConfig) {
}
}

mcpPaginatedTool<GetProxyHttpHistoryScope>("Displays all in-scope items within the proxy HTTP history") {
api.proxy().history { api.scope().isInScope(it.toString()) }.asSequence()
.map {
// Limit the size of serialized data to prevent overflow
val serialized = Json.encodeToString(it.toSerializableForm())
if (serialized.length > 5000) {
// Truncate long responses to prevent chat overflow
val truncated = serialized.substring(0, 5000) + "... (truncated)"
truncated
} else {
serialized
}
}
}

mcpPaginatedTool<GetProxyWebsocketHistory>("Displays items within the proxy WebSocket history") {
api.proxy().webSocketHistory().asSequence()
.map {
Expand Down Expand Up @@ -226,6 +241,11 @@ fun Server.registerTools(api: MontoyaApi, config: McpConfig) {

"Editor text has been set"
}

mcpTool<AddTargetToScope>("Adds the specified target to Burp Suite's scope") {
api.scope().includeInScope(target)
"Target has been added to scope"
}
}

fun getActiveEditor(api: MontoyaApi): JTextArea? {
Expand Down Expand Up @@ -272,7 +292,7 @@ data class SendHttp2Request(

@Serializable
data class CreateRepeaterTab(
val tabName: String?,
val tabName: String = "",
val content: String,
override val targetHostname: String,
override val targetPort: Int,
Expand All @@ -281,7 +301,7 @@ data class CreateRepeaterTab(

@Serializable
data class SendToIntruder(
val tabName: String?,
val tabName: String = "",
val content: String,
override val targetHostname: String,
override val targetPort: Int,
Expand Down Expand Up @@ -318,6 +338,9 @@ data class SetProxyInterceptState(val intercepting: Boolean)
@Serializable
data class SetActiveEditorContents(val text: String)

@Serializable
data class AddTargetToScope(val target: String)

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

Expand All @@ -327,6 +350,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 GetProxyHttpHistoryScope( override val count: Int, override val offset: Int) : Paginated

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

Expand Down