Add serverSecurityLogic - #259
max-peroch wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Can other MCP "entities" benefit from secured handlers too? ie. Resource and Prompt
There was a problem hiding this comment.
I left Resource and Prompt out of this PR so it stays scoped to tools (#237) . The same handleSecured / securedServerLogic shape would work there (and for resource templates) without changing prependSecurity. Happy to add it here if you’d rather have one PR, otherwise I can follow up after this lands?
| .transformWith(_ => backend.close()) | ||
| .transformWith(_ => binding.terminate(5.seconds)) | ||
| .transform(_ => result) | ||
|
|
There was a problem hiding this comment.
Can we avoid some code duplication, it's very similar to the method above (applies to Ox and ZIO too)
There was a problem hiding this comment.
Any reason this is not a trait as the secured streaming tests are?
| import sttp.tapir.server.netty.sync.NettySyncServer | ||
|
|
||
| object SecuredMcpServer: | ||
| object McpServerWithPrependedSecurity: |
There was a problem hiding this comment.
I liked the previous, simpler name
There was a problem hiding this comment.
I had some imports name clash... let me check
| import io.circe.Json | ||
| import sttp.model.{Header, HeaderNames, StatusCode} | ||
| import sttp.monad.MonadError | ||
| import sttp.monad.syntax.* |
There was a problem hiding this comment.
This is private to transport, I think comments are redundant
Attempt at addressing #237