mcp

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 13 Imported by: 0

README

Ridu MCP plugin

This optional compiled plugin exposes explicitly selected, read-only content tools at /api/mcp. Every call uses the authenticated Ridu actor and the ordinary Local API, so collection access, atomic filtered predicates, field redaction, localization, and response bounds are unchanged.

import ridumcp "github.com/riducms/ridu/plugins/mcp"

ridu.Config{
	Plugins: []ridu.Plugin{
		ridumcp.New(ridumcp.Config{
			Collections: []ridumcp.Resource{{Slug: "posts"}},
			Globals:     []ridumcp.Resource{{Slug: "site-settings"}},
		}),
	},
}

Create an API key for an auth-enabled collection and configure the client with:

{
	"mcpServers": {
		"Ridu": {
			"type": "http",
			"url": "http://127.0.0.1:8080/api/mcp",
			"headers": {
				"Authorization": "Bearer ridu_<id>_<secret>"
			}
		}
	}
}

The current slice does not expose create, update, delete, source-code mutation, prompts, or custom resources. Tool annotations are descriptive hints; Ridu authorization remains the enforcement boundary.

Documentation

Overview

Package mcp exposes explicitly selected Ridu content reads through Model Context Protocol without bypassing the ordinary authorization and operation engine. It is optional compiled application code, not part of Ridu core.

Index

Constants

View Source
const (
	// Key is the stable compiled plugin identity.
	Key = "mcp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Path         string
	MaxBodyBytes int64
	DefaultLimit int
	MaxLimit     int
	Collections  []Resource
	Globals      []Resource
}

Config controls the bounded, read-only MCP surface. Omitted resources are not exposed even when the authenticated actor could read them over REST.

type Plugin

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

Plugin is one configured MCP transport.

func New

func New(config Config) *Plugin

New enables MCP with defensive copies of all resource declarations.

func (*Plugin) BindTransports

func (plugin *Plugin) BindTransports(binding ridu.PluginTransportContext) ([]ridu.PluginTransport, error)

func (*Plugin) Descriptor

func (*Plugin) Descriptor() ridu.PluginDescriptor

func (*Plugin) Key

func (*Plugin) Key() string

type Resource

type Resource struct {
	Slug        schema.CollectionSlug
	Description string
}

Resource opts one manifest collection or global into MCP discovery. Description overrides manifest presentation text when clients need more task-specific guidance.

Jump to

Keyboard shortcuts

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