Documentation
¶
Index ¶
- Constants
- Variables
- func NewHTTPHandler(service *Service, opts HTTPHandlerOptions) (http.Handler, error)
- func NewServer(service *Service) *sdkmcp.Server
- func Run(ctx context.Context, opts RunOptions) error
- type FileEntry
- type HTTPHandlerOptions
- type RunOptions
- type Service
- func (s *Service) AllowedEntities() []string
- func (s *Service) EntityList() ([]string, error)
- func (s *Service) EntityShow(typeName string) (*config.TypeDefinition, error)
- func (s *Service) FilesList(typeName string) ([]FileEntry, error)
- func (s *Service) ObjectGet(typeName, id string) (*data.Object, error)
- func (s *Service) ObjectList(typeName string) ([]*data.Object, error)
- func (s *Service) RepositoryExport(include []string) (map[string][]map[string]any, error)
- func (s *Service) Root() string
Constants ¶
const ( ToolEntityList = "entity_list" ToolEntityShow = "entity_show" ToolObjectList = "object_list" ToolObjectGet = "object_get" ToolRepositoryExport = "repository_export" ToolFilesList = "files_list" )
Variables ¶
var ( // ErrUnknownEntity reports that the requested entity does not exist in the repository config. ErrUnknownEntity = errors.New("mcp: unknown entity") // ErrEntityNotAllowed reports that the requested entity is blocked by the configured allow-list. ErrEntityNotAllowed = errors.New("mcp: entity not allowed") // ErrObjectNotFound reports that the requested object does not exist for the exact entity query. ErrObjectNotFound = errors.New("mcp: object not found") )
Functions ¶
func NewHTTPHandler ¶
func NewHTTPHandler(service *Service, opts HTTPHandlerOptions) (http.Handler, error)
NewHTTPHandler constructs the single supported HTTP transport mode: streamable HTTP mounted at one base path in stateless JSON-response mode.
Types ¶
type FileEntry ¶
type FileEntry struct {
Type string `json:"type" yaml:"type"`
File string `json:"file" yaml:"file"`
}
FileEntry describes one configured backing file for an entity.
type HTTPHandlerOptions ¶
type HTTPHandlerOptions struct {
BasePath string
}
HTTPHandlerOptions configures the mounted HTTP handler.
type RunOptions ¶
type RunOptions struct {
Service *Service
Transport string
Stdin io.Reader
Stdout io.Writer
HTTPListen string
HTTPBasePath string
}
RunOptions configures server startup for the currently supported transports.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service exposes read-only Mergeway repository queries for MCP handlers.
func NewService ¶
NewService constructs a read-only query service rooted at the given repository.
func (*Service) AllowedEntities ¶
AllowedEntities reports the normalized exact-name entity allow-list.
func (*Service) EntityList ¶
EntityList returns the visible entity names after allow-list filtering.
func (*Service) EntityShow ¶
func (s *Service) EntityShow(typeName string) (*config.TypeDefinition, error)
EntityShow returns the schema/config details for one visible entity.
func (*Service) FilesList ¶
FilesList returns configured backing files for visible entities. When typeName is empty, it includes all visible entities.
func (*Service) ObjectList ¶
ObjectList returns objects declared exactly as typeName after allow-list enforcement.
func (*Service) RepositoryExport ¶
RepositoryExport returns a structured snapshot of the requested visible entities. When include is empty, all visible entities are exported.