Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

819 B
Raw Blame
package mcp

import (
	"fmt"

	"github.com/mark3labs/mcp-go/server"
)

// Version is the MCP server version, set at build time.
var Version = "dev"

// NewServer creates a fully configured MCP server with all PinchTab tools registered.
func NewServer(baseURL, token string) *server.MCPServer {
	c := NewClient(baseURL, token)

	s := server.NewMCPServer(
		"PinchTab",
		Version,
		server.WithToolCapabilities(false),
		server.WithRecovery(),
	)

	tools := allTools()
	handlers := handlerMap(c)

	for _, tool := range tools {
		h, ok := handlers[tool.Name]
		if !ok {
			panic(fmt.Sprintf("mcp: no handler for tool %q", tool.Name))
		}
		s.AddTool(tool, h)
	}

	return s
}

// Serve starts the MCP server on stdio.
func Serve(baseURL, token string) error {
	s := NewServer(baseURL, token)
	return server.ServeStdio(s)
}