orchardcore-ai-mcp
Scannednpx machina-cli add skill CrestApps/CrestApps.AgentSkills/orchardcore-ai-mcp --openclawOrchard Core MCP (Model Context Protocol) - Prompt Templates
Configure MCP Integration
You are an Orchard Core expert. Generate code, configuration, and recipes for integrating Model Context Protocol (MCP) client and server capabilities into Orchard Core using CrestApps modules.
Guidelines
- The Model Context Protocol (MCP) is an open standard for seamless integration between LLM applications and external tools or data sources.
- The CrestApps MCP module provides both client and server features.
- MCP Client: Connect Orchard Core to external MCP servers using SSE or Stdio transports, extending AI chat capabilities with external tools.
- MCP Server: Expose Orchard Core AI tools and resources to external MCP-compatible clients (AI agents, IDEs, copilots).
- MCP connections can be configured via the admin UI or recipes.
- MCP server authentication supports OpenId, ApiKey, or None (development only).
- Never use
AuthenticationType: "None"in production environments. - Install CrestApps packages in the web/startup project.
- Always secure API keys using user secrets or environment variables.
MCP Features Overview
| Feature | Feature ID | Description |
|---|---|---|
| MCP Client (SSE) | CrestApps.OrchardCore.AI.Mcp | Connect to remote MCP servers via Server-Sent Events |
| MCP Client (Stdio) | CrestApps.OrchardCore.AI.Mcp.Local | Connect to local MCP servers via Standard Input/Output |
| MCP Server | CrestApps.OrchardCore.AI.Mcp.Server | Expose Orchard Core as an MCP server endpoint |
MCP Client: Connecting to External MCP Servers
Enabling MCP Client Features
{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.AI",
"CrestApps.OrchardCore.AI.Chat",
"CrestApps.OrchardCore.AI.Mcp",
"CrestApps.OrchardCore.OpenAI"
],
"disable": []
}
]
}
Adding a Remote MCP Connection (SSE Transport) via Admin UI
- Navigate to Artificial Intelligence → MCP Connections.
- Click Add Connection.
- Under Server Sent Events (SSE), click Add.
- Enter connection details:
- Display Text: A friendly name for the connection.
- Endpoint: The remote MCP server URL (e.g.,
https://mcp-server.example.com/). - Additional Headers: Supply any required authentication headers.
- Save the connection.
- Create or edit an AI profile and select this MCP connection under available tools.
Adding a Remote MCP Connection via Recipe (SSE)
{
"steps": [
{
"name": "McpConnection",
"connections": [
{
"DisplayText": "Remote AI Tools Server",
"Properties": {
"SseMcpConnectionMetadata": {
"Endpoint": "https://mcp-server.example.com/",
"AdditionalHeaders": {}
}
}
}
]
}
]
}
Adding a Local MCP Connection (Stdio Transport)
The Local MCP Client feature enables connections to MCP servers running locally (e.g., in Docker containers) using Standard Input/Output.
Step-by-Step: Connect to a Docker-based MCP Server
- Install Docker Desktop.
- Pull the desired MCP Docker image (e.g.,
mcp/time). - Navigate to Artificial Intelligence → MCP Connections.
- Click Add Connection, then under Standard Input/Output (Stdio), click Add.
- Enter:
- Display Text:
Global Time Capabilities - Command:
docker - Command Arguments:
["run", "-i", "--rm", "mcp/time"]
- Display Text:
- Save the connection.
Adding a Local MCP Connection via Recipe (Stdio)
{
"steps": [
{
"name": "McpConnection",
"connections": [
{
"DisplayText": "Global Time Capabilities",
"Properties": {
"StdioMcpConnectionMetadata": {
"Command": "docker",
"Arguments": [
"run",
"-i",
"--rm",
"mcp/time"
]
}
}
}
]
}
]
}
Enabling MCP Client with Local Stdio Support
{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.AI",
"CrestApps.OrchardCore.AI.Chat",
"CrestApps.OrchardCore.AI.Mcp",
"CrestApps.OrchardCore.AI.Mcp.Local",
"CrestApps.OrchardCore.OpenAI"
],
"disable": []
}
]
}
MCP Server: Exposing Orchard Core as an MCP Endpoint
Enabling MCP Server
{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.AI",
"CrestApps.OrchardCore.AI.Mcp.Server"
],
"disable": []
}
]
}
MCP Server Authentication
The MCP server supports three authentication modes:
| Mode | Description | Use Case |
|---|---|---|
OpenId | OpenID Connect via the "Api" scheme (default) | Production environments |
ApiKey | Predefined API key authentication | Simple integrations, testing |
None | No authentication | Local development only |
Configuring MCP Server Authentication
OpenId (Recommended for production):
{
"OrchardCore": {
"CrestApps_AI": {
"McpServer": {
"AuthenticationType": "OpenId",
"RequireAccessPermission": true
}
}
}
}
When RequireAccessPermission is true, users must have the AccessMcpServer permission.
ApiKey (For simple integrations):
{
"OrchardCore": {
"CrestApps_AI": {
"McpServer": {
"AuthenticationType": "ApiKey",
"ApiKey": "your-secure-api-key-here"
}
}
}
}
The API key can be provided in the Authorization header as: Bearer <key>, ApiKey <key>, or the raw key.
None (Local development only — never use in production):
{
"OrchardCore": {
"CrestApps_AI": {
"McpServer": {
"AuthenticationType": "None"
}
}
}
}
MCP Server Endpoint
| Endpoint | Method | Description |
|---|---|---|
/mcp/sse | POST | SSE transport for MCP communication |
Connecting External Clients to Orchard Core MCP Server
With OpenId:
{
"mcpServers": {
"orchard-core": {
"transport": {
"type": "sse",
"url": "https://your-orchard-site.com/mcp/sse",
"headers": {
"Authorization": "Bearer <your-oauth-token>"
}
}
}
}
}
With ApiKey:
{
"mcpServers": {
"orchard-core": {
"transport": {
"type": "sse",
"url": "https://your-orchard-site.com/mcp/sse",
"headers": {
"Authorization": "ApiKey <your-api-key>"
}
}
}
}
}
Exposed Tools via MCP Server
The MCP server automatically exposes all AI tools registered in Orchard Core, including:
- Content Management: Search, create, update, delete, publish/unpublish content (when
OrchardCore.Contentsis enabled) - Feature Management: List, enable, disable features (when
OrchardCore.Featuresis enabled) - User Management: Search users, get user information (when
OrchardCore.Usersis enabled) - AI Agent Tools: All tools from the AI Agent module (when
CrestApps.OrchardCore.AI.Agentis enabled)
MCP Resources
MCP Resources expose data sources through the MCP protocol. Built-in resource types:
| Type | URI Pattern | Description |
|---|---|---|
| File | file://{itemId}/{path} | Local file system access |
| Content | content://{itemId}/... | Orchard Core content items |
| Recipe Schema | recipe-schema://{itemId}/... | JSON schema definitions |
| FTP/FTPS | ftp://{itemId}/{path} | Remote files via FTP (separate module) |
| SFTP | sftp://{itemId}/{path} | Remote files via SSH (separate module) |
Creating MCP Resources via Recipe
{
"steps": [
{
"name": "McpResource",
"Resources": [
{
"Source": "file",
"DisplayText": "Application Config",
"Resource": {
"Uri": "file://abc123/etc/config.json",
"Name": "app-config",
"Description": "Application configuration file",
"MimeType": "application/json"
}
}
]
}
]
}
Registering a Custom MCP Resource Type
services.AddMcpResourceType<DatabaseResourceTypeHandler>("database", entry =>
{
entry.DisplayName = S["Database"];
entry.Description = S["Query data from databases."];
entry.UriPatterns = ["db://{itemId}/{table}/{id}"];
});
Implement the handler:
public sealed class DatabaseResourceTypeHandler : IMcpResourceTypeHandler
{
public string Type => "database";
public async Task<ReadResourceResult> ReadAsync(
McpResource resource,
CancellationToken cancellationToken)
{
var uri = new Uri(resource.Resource.Uri);
// Parse URI and query database.
// Return ReadResourceResult with content.
return new ReadResourceResult();
}
}
Extending Content Resources with Custom Strategies
public sealed class SearchContentResourceStrategy : IContentResourceStrategyProvider
{
public string[] UriPatterns => ["content://{itemId}/{contentType}/search"];
public bool CanHandle(Uri uri)
{
return uri.Segments.Length >= 4 &&
uri.Segments[^1].TrimEnd('/') == "search";
}
public async Task<ReadResourceResult> ReadAsync(
McpResource resource,
Uri uri,
CancellationToken cancellationToken)
{
// Implement search logic.
return new ReadResourceResult();
}
}
Register in Startup.cs:
services.AddContentResourceStrategy<SearchContentResourceStrategy>();
Security Best Practices
- Always use
OpenIdauthentication for MCP server in production. - Store API keys in user secrets or environment variables, never in source control.
- Grant the
AccessMcpServerpermission only to trusted users and roles. - Individual tool invocations respect Orchard Core's permission system.
- MCP server operates within a single tenant context for tenant isolation.
- Rotate API keys periodically when using
ApiKeyauthentication.
Discovering More MCP Servers
Explore MCP-compatible tools at:
Source
git clone https://github.com/CrestApps/CrestApps.AgentSkills/blob/main/src/CrestApps.AgentSkills/orchardcore/orchardcore-ai-mcp/SKILL.mdView on GitHub Overview
This skill configures Model Context Protocol (MCP) integration for Orchard Core using the CrestApps MCP module. It covers MCP client connections (SSE and Stdio), MCP server exposure, resources, authentication, and custom resource types, enabling external tools to integrate with Orchard Core.
How This Skill Works
Install CrestApps MCP packages in the web/startup project to enable both MCP client and server features. Clients connect via SSE or Stdio transports, while the server exposes Orchard Core as an MCP endpoint with configurable authentication (OpenId, ApiKey, or development-only None).
When to Use It
- To connect Orchard Core to a remote MCP server using SSE.
- To connect to a local MCP server via Stdio (e.g., in Docker).
- To expose Orchard Core AI tools and resources as an MCP endpoint.
- To configure MCP in admin UI or via recipes for repeatable deployments.
- To enforce production-safe authentication and avoid None.
Quick Start
- Step 1: Enable MCP features in the Steps JSON (CrestApps.OrchardCore.AI, CrestApps.OrchardCore.AI.Mcp, CrestApps.OrchardCore.OpenAI).
- Step 2: Add a remote MCP connection via SSE in the admin UI or via a recipe, specifying Endpoint and headers.
- Step 3: Configure the MCP server exposure and authentication (OpenId or ApiKey) and securely store API keys.
Best Practices
- Avoid using AuthenticationType: 'None' in production.
- Install CrestApps packages in the web/startup project.
- Secure API keys with user secrets or environment variables.
- Test both SSE and Stdio transports against your MCP server.
- Document MCP resources and access rules (permissions).
Example Use Cases
- Connect Orchard Core to an external AI agent via MCP SSE.
- Expose Orchard Core AI tools as an MCP server endpoint for IDEs.
- Use recipes to provision MCP connections during deployment.
- Use Stdio to connect to a local MCP server in a Dockerized dev environment.
- Authenticate MCP requests with OpenId or ApiKey in production.