mcpserver

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(fs bashfs.FileSystem, opts ...Option) *mcp.Server

New creates an MCP server backed by the given filesystem.

func WithAuthIdentity

func WithAuthIdentity(ctx context.Context, identity *AuthIdentityInfo) context.Context

WithAuthIdentity returns a copy of ctx carrying the resolved identity. The HTTP transport's auth middleware sets this after resolving a bearer token so downstream shell commands can read the caller's identity from the AUTH_SUBJECT / AUTH_NAME / AUTH_CLAIM_* environment variables.

Types

type AuthIdentityInfo

type AuthIdentityInfo struct {
	Subject string
	Name    string
	Claims  map[string]string
}

AuthIdentityInfo represents a resolved identity from a bearer token.

func AuthIdentityFromContext

func AuthIdentityFromContext(ctx context.Context) (*AuthIdentityInfo, bool)

AuthIdentityFromContext returns the resolved identity stored on ctx, if any.

type AuthResolver

type AuthResolver interface {
	Resolve(token string) (*AuthIdentityInfo, error)
}

AuthResolver resolves bearer tokens into identities.

type Option

type Option func(*serverConfig)

Option configures the MCP server.

func WithAuthResolver

func WithAuthResolver(resolver AuthResolver) Option

WithAuthResolver configures the MCP server with an auth resolver.

func WithEnvVars

func WithEnvVars(vars map[string]string) Option

WithEnvVars sets environment variables on the shell for every command execution.

func WithInstructions

func WithInstructions(instructions string) Option

WithInstructions sets server instructions that are automatically injected into the client's context when it connects. This is the MCP-native way to teach clients how to use the server — no plugin or skill needed.

func WithServerName

func WithServerName(name string) Option

WithServerName overrides the MCP server name reported in the initialize response. This is what clients see in their connector list, so it should clearly describe what the server provides (e.g. "Company Knowledge Base").

func WithShellDescription

func WithShellDescription(desc string) Option

WithShellDescription overrides the shell tool's description.

Jump to

Keyboard shortcuts

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