http

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultGitHubMCPServerFactory

func DefaultGitHubMCPServerFactory(r *http.Request, deps github.ToolDependencies, inventory *inventory.Inventory, cfg *github.MCPServerConfig) (*mcp.Server, error)

func InventoryFiltersForRequest

func InventoryFiltersForRequest(r *http.Request, builder *inventory.Builder) *inventory.Builder

InventoryFiltersForRequest applies filters to the inventory builder based on the request context and headers

func PATScopeFilter

func PATScopeFilter(b *inventory.Builder, r *http.Request, fetcher scopes.FetcherInterface) *inventory.Builder

func RunHTTPServer

func RunHTTPServer(cfg ServerConfig) error

Types

type GitHubMCPServerFactoryFunc

type GitHubMCPServerFactoryFunc func(r *http.Request, deps github.ToolDependencies, inventory *inventory.Inventory, cfg *github.MCPServerConfig) (*mcp.Server, error)

GitHubMCPServerFactoryFunc is a function type for creating a new MCP Server instance. middleware are applied AFTER the default GitHub MCP Server middlewares (like error context injection)

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func (*Handler) RegisterMiddleware

func (h *Handler) RegisterMiddleware(r chi.Router)

func (*Handler) RegisterRoutes

func (h *Handler) RegisterRoutes(r chi.Router)

RegisterRoutes registers the routes for the MCP server URL-based values take precedence over header-based values

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HandlerOption

type HandlerOption func(*HandlerOptions)

func WithFeatureChecker

func WithFeatureChecker(checker inventory.FeatureFlagChecker) HandlerOption

func WithGitHubMCPServerFactory

func WithGitHubMCPServerFactory(f GitHubMCPServerFactoryFunc) HandlerOption

func WithInventoryFactory

func WithInventoryFactory(f InventoryFactoryFunc) HandlerOption

func WithOAuthConfig

func WithOAuthConfig(cfg *oauth.Config) HandlerOption

func WithScopeFetcher

func WithScopeFetcher(f scopes.FetcherInterface) HandlerOption

type HandlerOptions

type HandlerOptions struct {
	GitHubMcpServerFactory GitHubMCPServerFactoryFunc
	InventoryFactory       InventoryFactoryFunc
	OAuthConfig            *oauth.Config
	ScopeFetcher           scopes.FetcherInterface
	FeatureChecker         inventory.FeatureFlagChecker
}

type InventoryFactoryFunc

type InventoryFactoryFunc func(r *http.Request) (*inventory.Inventory, error)

func DefaultInventoryFactory

DefaultInventoryFactory creates the default inventory factory for HTTP mode

type ServerConfig

type ServerConfig struct {
	// Version of the server
	Version string

	// GitHub Host to target for API requests (e.g. github.com or github.enterprise.com)
	Host string

	// Port to listen on (default: 8082)
	Port int

	// BaseURL is the publicly accessible URL of this server for OAuth resource metadata.
	// If not set, the server will derive the URL from incoming request headers.
	BaseURL string

	// ResourcePath is the externally visible base path for this server (e.g., "/mcp").
	// This is used to restore the original path when a proxy strips a base path before forwarding.
	ResourcePath string

	// ExportTranslations indicates if we should export translations
	// See: https://github.com/github/github-mcp-server?tab=readme-ov-file#i18n--overriding-descriptions
	ExportTranslations bool

	// EnableCommandLogging indicates if we should log commands
	EnableCommandLogging bool

	// Path to the log file if not stderr
	LogFilePath string

	// Content window size
	ContentWindowSize int

	// LockdownMode indicates if we should enable lockdown mode
	LockdownMode bool

	// RepoAccessCacheTTL overrides the default TTL for repository access cache entries.
	RepoAccessCacheTTL *time.Duration

	// ScopeChallenge indicates if we should return OAuth scope challenges, and if we should perform
	// tool filtering based on token scopes.
	ScopeChallenge bool
}

Directories

Path Synopsis
Package mark provides a mechanism for tagging errors with a well-known error value.
Package mark provides a mechanism for tagging errors with a well-known error value.
Package oauth provides OAuth 2.0 Protected Resource Metadata (RFC 9728) support for the GitHub MCP Server HTTP mode.
Package oauth provides OAuth 2.0 Protected Resource Metadata (RFC 9728) support for the GitHub MCP Server HTTP mode.

Jump to

Keyboard shortcuts

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