server

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
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

func RegisterBrowserEndpoints(mux *http.ServeMux)

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL