Skip to content

Commit 97b756c

Browse files
adamwulfmattt
andauthored
Add waitUntilComplete() method to Server (#26)
* Add waitUntilComplete() method to Server * Update Sources/MCP/Server/Server.swift Co-authored-by: Mattt <[email protected]> --------- Co-authored-by: Mattt <[email protected]>
1 parent 8dfc9c7 commit 97b756c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/MCP/Server/Server.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ public actor Server {
221221
await logger?.error(
222222
"Fatal error in message handling loop", metadata: ["error": "\(error)"])
223223
}
224+
await logger?.info("Server finished", metadata: [:])
224225
}
225226
}
226227

@@ -234,6 +235,10 @@ public actor Server {
234235
connection = nil
235236
}
236237

238+
public func waitUntilCompleted() async {
239+
await task?.value
240+
}
241+
237242
// MARK: - Registration
238243

239244
/// Register a method handler

0 commit comments

Comments
 (0)