Documentation
¶
Overview ¶
Copyright © 2025 Benny Powers <web@bennypowers.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright © 2025 Benny Powers <web@bennypowers.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- func NewMCPContextAdapter(context *MCPContext) MCPTypes.MCPContext
- type MCPContext
- func (ctx *MCPContext) AllCSSProperties() []string
- func (ctx *MCPContext) CommonPrefixes() []string
- func (ctx *MCPContext) Config() (*IC.CemConfig, error)
- func (ctx *MCPContext) ConfigFile() string
- func (ctx *MCPContext) ConfigSchemaJSON() []byte
- func (ctx *MCPContext) DocumentManager() lspTypes.DocumentManager
- func (ctx *MCPContext) FileSystem() platform.FileSystem
- func (ctx *MCPContext) GetAllElements() map[string]MCPTypes.ElementInfo
- func (ctx *MCPContext) GetElementInfo(tagName string) (MCPTypes.ElementInfo, error)
- func (ctx *MCPContext) GetManifestSchema() (map[string]any, error)
- func (ctx *MCPContext) GetManifestSchemaVersions() []string
- func (ctx *MCPContext) InvalidateConfig()
- func (ctx *MCPContext) LSPRegistry() *LSP.Registry
- func (ctx *MCPContext) LoadManifests() error
- func (ctx *MCPContext) RelationshipsFor(tagName string) []relationships.Relationship
- func (ctx *MCPContext) Root() string
- type MCPContextAdapter
- func (ctx *MCPContextAdapter) AllElements() map[string]MCPTypes.ElementInfo
- func (ctx *MCPContextAdapter) Config() (*IC.CemConfig, error)
- func (ctx *MCPContextAdapter) ConfigFile() string
- func (ctx *MCPContextAdapter) ConfigSchemaJSON() []byte
- func (ctx *MCPContextAdapter) DocumentManager() lspTypes.DocumentManager
- func (ctx *MCPContextAdapter) ElementInfo(tagName string) (MCPTypes.ElementInfo, error)
- func (ctx *MCPContextAdapter) FileSystem() platform.FileSystem
- func (ctx *MCPContextAdapter) GetManifestSchemaVersions() []string
- func (ctx *MCPContextAdapter) Root() string
- type MCPCustomElementDeclaration
- type MCPElementInfoAdapter
- func (e *MCPElementInfoAdapter) Attributes() []M.Attribute
- func (e *MCPElementInfoAdapter) CssParts() []M.CssPart
- func (e *MCPElementInfoAdapter) CssProperties() []M.CssCustomProperty
- func (e *MCPElementInfoAdapter) CssStates() []M.CssCustomState
- func (e *MCPElementInfoAdapter) Declaration() *M.CustomElementDeclaration
- func (e *MCPElementInfoAdapter) Description() string
- func (e *MCPElementInfoAdapter) Element() *M.CustomElementDeclaration
- func (e *MCPElementInfoAdapter) Events() []M.Event
- func (e *MCPElementInfoAdapter) Examples() []MCPTypes.Example
- func (e *MCPElementInfoAdapter) Guidelines() []string
- func (e *MCPElementInfoAdapter) Module() string
- func (e *MCPElementInfoAdapter) Name() string
- func (e *MCPElementInfoAdapter) Package() string
- func (e *MCPElementInfoAdapter) Relationships() []relationships.Relationship
- func (e *MCPElementInfoAdapter) Slots() []M.Slot
- func (e *MCPElementInfoAdapter) Summary() string
- func (e *MCPElementInfoAdapter) TagName() string
- type Server
- type ServerConfig
- type ServerInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMCPContextAdapter ¶
func NewMCPContextAdapter(context *MCPContext) MCPTypes.MCPContext
NewMCPContextAdapter creates an adapter that implements the tools interface
Types ¶
type MCPContext ¶
type MCPContext struct {
// contains filtered or unexported fields
}
MCPContext manages custom elements manifests for MCP context This is a lightweight wrapper around the LSP registry for reuse
func NewMCPContext ¶
func NewMCPContext(workspace types.WorkspaceContext, fsys platform.FileSystem) (*MCPContext, error)
NewMCPContext creates a new MCP context. If fsys is nil, it defaults to platform.NewOSFileSystem().
func (*MCPContext) AllCSSProperties ¶
func (ctx *MCPContext) AllCSSProperties() []string
AllCSSProperties returns all CSS custom properties across elements (lazy-computed and cached)
func (*MCPContext) CommonPrefixes ¶
func (ctx *MCPContext) CommonPrefixes() []string
CommonPrefixes returns common element tag name prefixes (lazy-computed and cached)
func (*MCPContext) ConfigFile ¶ added in v0.11.0
func (ctx *MCPContext) ConfigFile() string
func (*MCPContext) ConfigSchemaJSON ¶ added in v0.11.0
func (ctx *MCPContext) ConfigSchemaJSON() []byte
func (*MCPContext) DocumentManager ¶
func (ctx *MCPContext) DocumentManager() lspTypes.DocumentManager
DocumentManager returns the shared document manager for validation
func (*MCPContext) FileSystem ¶ added in v0.11.0
func (ctx *MCPContext) FileSystem() platform.FileSystem
func (*MCPContext) GetAllElements ¶
func (ctx *MCPContext) GetAllElements() map[string]MCPTypes.ElementInfo
GetAllElements returns all available elements
func (*MCPContext) GetElementInfo ¶
func (ctx *MCPContext) GetElementInfo(tagName string) (MCPTypes.ElementInfo, error)
GetElementInfo returns enhanced element information for MCP context
func (*MCPContext) GetManifestSchema ¶
func (ctx *MCPContext) GetManifestSchema() (map[string]any, error)
GetManifestSchema returns the JSON schema for custom elements manifests
func (*MCPContext) GetManifestSchemaVersions ¶
func (ctx *MCPContext) GetManifestSchemaVersions() []string
GetManifestSchemaVersions returns all unique schema versions found in loaded manifests
func (*MCPContext) InvalidateConfig ¶ added in v0.11.0
func (ctx *MCPContext) InvalidateConfig()
func (*MCPContext) LSPRegistry ¶ added in v0.9.3
func (ctx *MCPContext) LSPRegistry() *LSP.Registry
LSPRegistry returns the underlying LSP registry for additional package loading
func (*MCPContext) LoadManifests ¶
func (ctx *MCPContext) LoadManifests() error
LoadManifests loads all available manifests
func (*MCPContext) RelationshipsFor ¶ added in v0.9.2
func (ctx *MCPContext) RelationshipsFor(tagName string) []relationships.Relationship
RelationshipsFor returns relationships for the given element. Always returns an empty slice instead of nil to avoid null in JSON/UI.
func (*MCPContext) Root ¶ added in v0.11.0
func (ctx *MCPContext) Root() string
type MCPContextAdapter ¶
type MCPContextAdapter struct {
*MCPContext
}
MCPContextAdapter implements MCPTypes.MCPContext interface for tools package
func (*MCPContextAdapter) AllElements ¶
func (ctx *MCPContextAdapter) AllElements() map[string]MCPTypes.ElementInfo
AllElements implements MCPTypes.MCPContext interface
func (*MCPContextAdapter) Config ¶ added in v0.11.0
func (ctx *MCPContextAdapter) Config() (*IC.CemConfig, error)
func (*MCPContextAdapter) ConfigFile ¶ added in v0.11.0
func (ctx *MCPContextAdapter) ConfigFile() string
func (*MCPContextAdapter) ConfigSchemaJSON ¶ added in v0.11.0
func (ctx *MCPContextAdapter) ConfigSchemaJSON() []byte
func (*MCPContextAdapter) DocumentManager ¶
func (ctx *MCPContextAdapter) DocumentManager() lspTypes.DocumentManager
DocumentManager implements MCPTypes.MCPContext interface
func (*MCPContextAdapter) ElementInfo ¶
func (ctx *MCPContextAdapter) ElementInfo(tagName string) (MCPTypes.ElementInfo, error)
ElementInfo implements MCPTypes.MCPContext interface
func (*MCPContextAdapter) FileSystem ¶ added in v0.11.0
func (ctx *MCPContextAdapter) FileSystem() platform.FileSystem
func (*MCPContextAdapter) GetManifestSchemaVersions ¶
func (ctx *MCPContextAdapter) GetManifestSchemaVersions() []string
GetManifestSchemaVersions implements MCPTypes.MCPContext interface
func (*MCPContextAdapter) Root ¶ added in v0.11.0
func (ctx *MCPContextAdapter) Root() string
type MCPCustomElementDeclaration ¶
type MCPCustomElementDeclaration struct {
*M.RenderableCustomElementDeclaration
Guidelines []string `json:"guidelines,omitempty"`
CacheKey string `json:"cacheKey,omitempty"`
ModulePath string `json:"modulePath,omitempty"`
PackageName string `json:"packageName,omitempty"`
}
MCPCustomElementDeclaration embeds manifest types with MCP-specific data
func NewMCPCustomElementDeclaration ¶
func NewMCPCustomElementDeclaration(element *M.CustomElement, tagName string) *MCPCustomElementDeclaration
NewMCPCustomElementDeclaration creates a new MCP custom element declaration from a manifest element
type MCPElementInfoAdapter ¶
type MCPElementInfoAdapter struct {
*MCPCustomElementDeclaration
// contains filtered or unexported fields
}
ElementInfoAdapter implements MCPTypes.ElementInfo interface MCPElementInfoAdapter implements MCPTypes.ElementInfo interface for MCP-specific behavior
func (*MCPElementInfoAdapter) Attributes ¶
func (e *MCPElementInfoAdapter) Attributes() []M.Attribute
Member accessors returning manifest types directly
func (*MCPElementInfoAdapter) CssParts ¶
func (e *MCPElementInfoAdapter) CssParts() []M.CssPart
func (*MCPElementInfoAdapter) CssProperties ¶
func (e *MCPElementInfoAdapter) CssProperties() []M.CssCustomProperty
func (*MCPElementInfoAdapter) CssStates ¶
func (e *MCPElementInfoAdapter) CssStates() []M.CssCustomState
func (*MCPElementInfoAdapter) Declaration ¶
func (e *MCPElementInfoAdapter) Declaration() *M.CustomElementDeclaration
Declaration returns the underlying manifest declaration
func (*MCPElementInfoAdapter) Description ¶
func (e *MCPElementInfoAdapter) Description() string
func (*MCPElementInfoAdapter) Element ¶
func (e *MCPElementInfoAdapter) Element() *M.CustomElementDeclaration
Template-friendly access
func (*MCPElementInfoAdapter) Events ¶
func (e *MCPElementInfoAdapter) Events() []M.Event
func (*MCPElementInfoAdapter) Examples ¶
func (e *MCPElementInfoAdapter) Examples() []MCPTypes.Example
func (*MCPElementInfoAdapter) Guidelines ¶
func (e *MCPElementInfoAdapter) Guidelines() []string
MCP-specific behavior
func (*MCPElementInfoAdapter) Module ¶
func (e *MCPElementInfoAdapter) Module() string
func (*MCPElementInfoAdapter) Name ¶
func (e *MCPElementInfoAdapter) Name() string
func (*MCPElementInfoAdapter) Package ¶
func (e *MCPElementInfoAdapter) Package() string
func (*MCPElementInfoAdapter) Relationships ¶ added in v0.9.2
func (e *MCPElementInfoAdapter) Relationships() []relationships.Relationship
func (*MCPElementInfoAdapter) Slots ¶
func (e *MCPElementInfoAdapter) Slots() []M.Slot
func (*MCPElementInfoAdapter) Summary ¶
func (e *MCPElementInfoAdapter) Summary() string
func (*MCPElementInfoAdapter) TagName ¶
func (e *MCPElementInfoAdapter) TagName() string
Convenience accessors that delegate to embedded manifest types
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements an MCP server for custom elements
func NewServer ¶
func NewServer(workspace types.WorkspaceContext) (*Server, error)
NewServer creates a new CEM MCP server with default configuration
func NewServerWithConfig ¶
func NewServerWithConfig(workspace types.WorkspaceContext, config ServerConfig) (*Server, error)
NewServerWithConfig creates a new CEM MCP server with custom configuration
func (*Server) Registry ¶ added in v0.7.3
func (s *Server) Registry() *MCPContext
Registry returns the MCP registry for testing This is used by tests to verify stdout cleanliness
type ServerConfig ¶
type ServerConfig struct {
MaxDescriptionLength int
// Additional packages to load manifests from (URLs, npm:, or jsr: specifiers)
AdditionalPackages []string
// FileSystem to use for filesystem operations. If nil, defaults to OSFileSystem.
FileSystem platform.FileSystem
}
ServerConfig contains configuration options for the MCP server
type ServerInfo ¶
type ServerInfo struct {
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
}
ServerInfo represents basic server information
Directories
¶
| Path | Synopsis |
|---|---|
|
Package chunking provides semantic-aware text chunking for MCP context management.
|
Package chunking provides semantic-aware text chunking for MCP context management. |
|
Package relationships provides element relationship detection for MCP context.
|
Package relationships provides element relationship detection for MCP context. |
|
gen-adapters
command
|
|