Documentation
¶
Index ¶
- Constants
- func DefaultStdioServerFunction(server *mcp.Server, t *mcp.LoggingTransport)
- func DefaultStreamableServerFunction(mcpHandler *mcp.StreamableHTTPHandler, httpAddr *string)
- func DefaultStreamableTransportLoggingMiddleware(maxLength int) func() func(next mcp.MethodHandler) mcp.MethodHandler
- func RegisterBrowserEndpoints(mux *http.ServeMux)
- func SlogLoggingMiddleware(level slog.Level) func(next mcp.MethodHandler) mcp.MethodHandler
- type ScrapflyMCPServer
- func (s *ScrapflyMCPServer) ServeStdio()
- func (s *ScrapflyMCPServer) ServeStreamable()
- func (s *ScrapflyMCPServer) Server() *mcp.Server
- func (s *ScrapflyMCPServer) WithHttpAddr(httpAddr string) *ScrapflyMCPServer
- func (s *ScrapflyMCPServer) WithLoggingMiddleware(loggingMiddleware func() func(next mcp.MethodHandler) mcp.MethodHandler) *ScrapflyMCPServer
- func (s *ScrapflyMCPServer) WithStdioServerFunction(stdioServerFunction StdioServerFunction) *ScrapflyMCPServer
- func (s *ScrapflyMCPServer) WithStreamableHTTPOptions(streamableHTTPOptions *mcp.StreamableHTTPOptions) *ScrapflyMCPServer
- func (s *ScrapflyMCPServer) WithStreamableServerFunction(streamableServerFunction StreamableServerFunction) *ScrapflyMCPServer
- type StdioServerFunction
- type StreamableServerFunction
Constants ¶
const ServerVersion = "1.6.0"
Variables ¶
This section is empty.
Functions ¶
func DefaultStdioServerFunction ¶
func DefaultStdioServerFunction(server *mcp.Server, t *mcp.LoggingTransport)
func DefaultStreamableServerFunction ¶
func DefaultStreamableServerFunction(mcpHandler *mcp.StreamableHTTPHandler, httpAddr *string)
func DefaultStreamableTransportLoggingMiddleware ¶
func DefaultStreamableTransportLoggingMiddleware(maxLength int) func() func(next mcp.MethodHandler) mcp.MethodHandler
func RegisterBrowserEndpoints ¶
RegisterBrowserEndpoints attaches the /browser/* HTTP routes to the provided mux. They back a browser playground UI (screencast, downloads, expects, but use the in-process browser.Session store (no gRPC, no store: no session broker in front, and no auth layer of their own. The trust boundary is therefore this process, which holds at most one browser — bind the listener to loopback, never a public interface.
Routes:
GET /browser/screencast?session_id=... — SSE: JPEG frames as `event: frame`
GET /browser/downloads?session_id=... — JSON: download manifest
GET /browser/download?session_id=&filename=... — JSON: base64 file payload
GET /browser/captchas?session_id=... — JSON: empty list (captcha records
are not recorded by this server; we always return {"records": []}
so a client that polls the route gets a valid empty answer, not a 404).
GET /browser/active — JSON: {"session_id": "...", "url": "..."}
or {} if no session — used by the playground UI to reattach to an
in-progress session after a page reload.
GET /browser/screenshot?session_id=... — JSON: {"data": "<base64 PNG>",
"mime": "image/png"}; one-shot capture via CDP Page.captureScreenshot.
Skips the LLM round-trip used by the in-tool cloud_browser_screenshot,
so the playground's "Capture frame" button is instant + free.
`session_id` is optional everywhere — when omitted, the most recent active session is used (FindSession's empty-id semantics). That is the right behavior for this server, which holds at most one concurrent session per MCP process.
func SlogLoggingMiddleware ¶
func SlogLoggingMiddleware(level slog.Level) func(next mcp.MethodHandler) mcp.MethodHandler
Example atlevel logging middleware
Types ¶
type ScrapflyMCPServer ¶
type ScrapflyMCPServer struct {
// contains filtered or unexported fields
}
func NewScrapflyMCPServer ¶
func NewScrapflyMCPServer(toolProviders ...provider.ToolProvider) *ScrapflyMCPServer
func (*ScrapflyMCPServer) ServeStdio ¶
func (s *ScrapflyMCPServer) ServeStdio()
func (*ScrapflyMCPServer) ServeStreamable ¶
func (s *ScrapflyMCPServer) ServeStreamable()
func (*ScrapflyMCPServer) Server ¶
func (s *ScrapflyMCPServer) Server() *mcp.Server
func (*ScrapflyMCPServer) WithHttpAddr ¶
func (s *ScrapflyMCPServer) WithHttpAddr(httpAddr string) *ScrapflyMCPServer
func (*ScrapflyMCPServer) WithLoggingMiddleware ¶
func (s *ScrapflyMCPServer) WithLoggingMiddleware(loggingMiddleware func() func(next mcp.MethodHandler) mcp.MethodHandler) *ScrapflyMCPServer
func (*ScrapflyMCPServer) WithStdioServerFunction ¶
func (s *ScrapflyMCPServer) WithStdioServerFunction(stdioServerFunction StdioServerFunction) *ScrapflyMCPServer
func (*ScrapflyMCPServer) WithStreamableHTTPOptions ¶
func (s *ScrapflyMCPServer) WithStreamableHTTPOptions(streamableHTTPOptions *mcp.StreamableHTTPOptions) *ScrapflyMCPServer
func (*ScrapflyMCPServer) WithStreamableServerFunction ¶
func (s *ScrapflyMCPServer) WithStreamableServerFunction(streamableServerFunction StreamableServerFunction) *ScrapflyMCPServer
type StdioServerFunction ¶
type StdioServerFunction func(server *mcp.Server, t *mcp.LoggingTransport)
type StreamableServerFunction ¶
type StreamableServerFunction func(mcpHandler *mcp.StreamableHTTPHandler, httpAddr *string)