Documentation
¶
Index ¶
- type Server
- func (s Server) CallTool(ctx context.Context, params mcp.ToolsCallParams, _ mcp.RequestClientFunc) (mcp.ToolResult, error)
- func (s Server) Info() mcp.Info
- func (s Server) ListTools(context.Context, mcp.ToolsListParams, mcp.RequestClientFunc) (mcp.ToolList, error)
- func (s Server) RequireRootsListClient() bool
- func (s Server) RequireSamplingClient() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶ added in v0.2.0
type Server struct {
// contains filtered or unexported fields
}
Server implements the Model Context Protocol (MCP) for filesystem operations. It provides access to the local filesystem through a restricted root directory, exposing standard filesystem operations as MCP tools.
Server ensures all operations remain within the configured root directory path for security. It implements both the mcp.Server and mcp.ToolServer interfaces to provide filesystem functionality through the MCP protocol.
func NewServer ¶ added in v0.2.0
NewServer creates a new filesystem MCP server that provides access to files under the specified root directory.
The server validates that the root path exists and is an accessible directory. All filesystem operations are restricted to this directory and its subdirectories for security.
It returns an error if the root path does not exist, is not a directory, or cannot be accessed.
func (Server) CallTool ¶ added in v0.2.0
func (s Server) CallTool( ctx context.Context, params mcp.ToolsCallParams, _ mcp.RequestClientFunc, ) (mcp.ToolResult, error)
CallTool implements mcp.ToolServer interface. Executes a specified filesystem tool with the given parameters. All operations are restricted to paths within the server's root directory.
The ctx parameter provides context for the operation. The params parameter contains the tool name to execute and its arguments.
Returns the tool's execution result and any error encountered. Returns error if the tool is not found or if execution fails.
func (Server) ListTools ¶ added in v0.2.0
func (s Server) ListTools(context.Context, mcp.ToolsListParams, mcp.RequestClientFunc) (mcp.ToolList, error)
ListTools implements mcp.ToolServer interface. Returns the list of available filesystem tools supported by this server. The tools provide various filesystem operations like reading, writing, and managing files.
The ctx parameter provides context for the operation. The params parameter contains pagination and metadata for the listing operation.
Returns a ToolList containing all available filesystem tools and any error encountered.
func (Server) RequireRootsListClient ¶ added in v0.2.0
RequireRootsListClient implements mcp.Server interface.
func (Server) RequireSamplingClient ¶ added in v0.2.0
RequireSamplingClient implements mcp.Server interface.