mcpserver

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0, MIT Imports: 29 Imported by: 0

Documentation

Overview

Package mcpserver hosts WeKnora's own MCP server surface: the Streamable HTTP endpoint that external MCP clients (Claude Desktop, Cursor, VS Code Copilot, ...) connect to. Every request is authenticated by middleware.MCPEndpointAuth against a workspace MCPEndpoint row, and the endpoint's tool allowlist and knowledge-base scope decide what the client can see and call.

A single mcp-go server instance is registered with the full tool catalog; per-endpoint visibility is applied through a tool filter (tools/list) and a handler middleware (tools/call), both keyed off the endpoint on the request context. The transport runs stateless so any replica can answer any call.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server wires the tool catalog onto an mcp-go server and exposes it as an http.Handler.

func NewServer

func NewServer(
	kbService interfaces.KnowledgeBaseService,
	knowledgeService interfaces.KnowledgeService,
	chunkService interfaces.ChunkService,
	wikiService interfaces.WikiPageService,
	sessionService interfaces.SessionService,
	messageService interfaces.MessageService,
	agentService interfaces.CustomAgentService,
	kbShareService interfaces.KBShareService,
	tenantService interfaces.TenantService,
	endpointRepo interfaces.MCPEndpointRepository,
	db *gorm.DB,
	cfg *config.Config,
	redisClient *redis.Client,
	resourceCatalog interfaces.ResourceCatalog,
	fileService interfaces.FileService,
	storageResolver interfaces.StorageBackendResolver,
) *Server

NewServer builds the MCP server and its Streamable HTTP transport.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the http.Handler to mount under /mcp/:endpoint_id. The caller must run MCPEndpointAuth first; the handler trusts the context.

Jump to

Keyboard shortcuts

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