Exposes FTP, FTPS, and SFTP files as MCP resources using CrestApps.Core packages. Covers registration, handlers, path sanitization, connection metadata, and egress policies.
Ships in crestapps-core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Expose files on an FTP, FTPS or SFTP server to MCP clients as resources. In 2.0 each protocol lives in one package that also carries the file source ingestion connector for the same protocol (see crestapps-core-file-sources). Registering one side does not register the other.
| Package | MCP resource registration | Ingestion connector registration |
|---|---|---|
CrestApps.Core.AI.Ftp | AddFtpResources() / AddCoreAIFtpMcpResources() | AddCoreFtpIngestionConnector() |
CrestApps.Core.AI.Sftp | AddSftpResources() / AddCoreAISftpMcpResources() | AddCoreSftpIngestionConnector() |
using CrestApps.Core.AI.Ftp;
using CrestApps.Core.AI.Mcp;
using CrestApps.Core.AI.Sftp;
builder.Services.AddCrestAppsCore(crestApps => crestApps
.AddAISuite(ai => ai
.AddMcpServer(mcpServer => mcpServer
.AddYesSqlStores()
.AddFtpResources()
.AddSftpResources())));
Without the builder:
builder.Services
.AddCoreAIMcpServer()
.AddCoreAIFtpMcpResources()
.AddCoreAISftpMcpResources();
Both registration methods take an optional Action<McpResourceTypeEntry> to change the display name, description or variables. The MCP server itself (SDK transport, WithCrestAppsHandlers(), MapMcp) is covered in crestapps-core-mcp.
FtpResourceTypeHandler serves type ftp (FtpResourceConstants.Type), using FluentFTP.SftpResourceTypeHandler serves type sftp (SftpResourceConstants.Type), using SSH.NET.path variable, for example a resource URI template ftp://reports/{path}. An omitted value becomes /.SanitizePath rejects null bytes and . or .. segments, normalizes \ to / and collapses empty segments, and the handler prefixes the result with /.TextResourceContents with the resource's MIME type, or one detected from the file extension, falling back to application/octet-stream.RemoteFileResourceHandlerBase<TMetadata>, which stops reading at the metadata's MaxResourceBytes (5 MB when not set) and answers with an error instead of buffering a larger file. Derive a custom remote-file handler from it to get the same limit; it also turns a RemoteFileEgressDeniedException into an error result with the overridable EgressDeniedMessage and logs the exception's own message.using CrestApps.Core;
using CrestApps.Core.AI.Ftp;
using CrestApps.Core.AI.Ftp.Models;
var protector = dataProtectionProvider.CreateProtector(FtpResourceConstants.DataProtectionPurpose);
resource.Put(new FtpConnectionMetadata
{
Host = "files.example.com",
Port = 21,
Username = "reader",
Password = protector.Protect(password),
EncryptionMode = "Explicit",
DataConnectionType = "AutoPassive",
ConnectTimeout = 30,
ReadTimeout = 30,
RetryAttempts = 2,
});
A connection with a Username must use EncryptionMode Explicit or Implicit; unset, None and Auto can run in plain text and are refused unless the host sets FtpOptions.AllowUnencrypted. ValidateAnyCertificate is honored only when the host sets FtpOptions.AllowAnyCertificate; otherwise the connection is refused with FtpOptions.AnyCertificateNotAllowedMessage. Anonymous connections are not affected. Both checks are FtpOptions.GetPolicyViolation(metadata), used by the resource handler and the ingestion connector:
using CrestApps.Core.AI.Ftp;
// Development servers only.
builder.Services.Configure<FtpOptions>(options =>
{
options.AllowAnyCertificate = true;
options.AllowUnencrypted = true;
});
using CrestApps.Core;
using CrestApps.Core.AI.Sftp;
using CrestApps.Core.AI.Sftp.Models;
var protector = dataProtectionProvider.CreateProtector(SftpResourceConstants.DataProtectionPurpose);
resource.Put(new SftpConnectionMetadata
{
Host = "sftp.example.com",
Port = 22,
Username = "reader",
PrivateKey = protector.Protect(privateKeyPem),
Passphrase = protector.Protect(passphrase),
HostKeyFingerprint = "SHA256:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU", // as ssh-keygen -lf prints it
ConnectionTimeout = 30,
KeepAliveInterval = 30,
});
The handler requires Host, at least one protected Password or PrivateKey, and HostKeyFingerprint (SHA256:... or the legacy MD5 hex form; separate several with commas to rotate a key). SftpHostKeys refuses the connection when no fingerprint is stored or the server presents a different key, so credentials never reach an unverified server (the factory throws InvalidOperationException, the handler returns an error result). It reads Username for the SSH authentication methods. ProxyType, ProxyHost, ProxyPort, ProxyUsername and ProxyPassword route the connection through a SOCKS4, SOCKS5 or HTTP proxy (see Which Address a Connection Opens); leave ProxyType at None to connect directly.
| Constant | Value |
|---|---|
FtpResourceConstants.DataProtectionPurpose | FtpResourcePassword |
SftpResourceConstants.DataProtectionPurpose | SftpResourceCredentials |
The ingestion connectors decrypt with the same purposes, so a file source and an MCP resource can share the same stored connection shape. A mismatched purpose reads back as no credential rather than an error.
FTP and SFTP connections (the MCP resource handlers and the ingestion connectors alike) ask IRemoteFileEgressPolicy (CrestApps.Core.AI.FileSources.FileTransfer) once for the addresses of the stored host and connect only to those, in order. Neither FluentFTP nor SSH.NET looks the name up again, so a name that changes its answer after the check cannot move the connection.
PASV, EPSV, the automatic types) goes to the address the control connection opened, whatever the server's answer names. TLS still checks the certificate against the host name. An FTP server that hands out another address for data connections (some load-balanced clusters) no longer works.ProxyType (None, Socks4, Socks5 or Http), ProxyHost, ProxyPort (1 to 65535), ProxyUsername and ProxyPassword. The proxy's addresses go through the policy too, the proxy is asked for a checked address (never the name; an HTTP proxy gets IPv6 in brackets, a SOCKS4 proxy only IPv4), and an unknown type or a missing host or port is refused.DefaultRemoteFileEgressPolicy (registered with TryAdd by every FTP and SFTP Add* method) resolves the name and allows every address. When people who are not administrators can edit file sources or MCP resources, register PublicRemoteFileEgressPolicy, which allows only public internet addresses (it refuses loopback, private, 100.64.0.0/10, link-local 169.254.0.0/16 and fe80::/10, fc00::/7, multicast and reserved addresses, and checks IPv4-mapped IPv6 as IPv4):
using CrestApps.Core.AI.FileSources.FileTransfer;
builder.Services.AddSingleton<IRemoteFileEgressPolicy, PublicRemoteFileEgressPolicy>();
A custom policy implements Task<IReadOnlyList<IPAddress>> ResolveAsync(string host, int port, CancellationToken cancellationToken) and throws RemoteFileEgressDeniedException (CrestApps.Core.AI.Exceptions) when no address is allowed:
using System.Net;
using CrestApps.Core.AI.Exceptions;
using CrestApps.Core.AI.FileSources.FileTransfer;
public sealed class KnownFileServersEgressPolicy : IRemoteFileEgressPolicy
{
private static readonly HashSet<IPAddress> _allowed = [IPAddress.Parse("203.0.113.10"), IPAddress.Parse("203.0.113.11")];
private readonly DefaultRemoteFileEgressPolicy _resolver = new();
public async Task<IReadOnlyList<IPAddress>> ResolveAsync(string host, int port, CancellationToken cancellationToken = default)
{
var addresses = await _resolver.ResolveAsync(host, port, cancellationToken);
var allowed = addresses
.Select(address => address.IsIPv4MappedToIPv6 ? address.MapToIPv4() : address)
.Where(_allowed.Contains)
.ToArray();
if (allowed.Length == 0)
{
throw new RemoteFileEgressDeniedException($"Connections to '{host}' are not allowed.");
}
return allowed;
}
}
An MCP read that the policy refuses answers "This application does not allow FTP connections to this server." (or SFTP); the exception's own message only goes to the log.
Create an McpResource whose Source is ftp or sftp and whose Resource.Uri is a fixed URI or a template containing {path}, then Put(...) the connection metadata on it. The metadata is read at resource-read time and is never shown to the MCP client. Use an IMcpResourceHandler.Exporting handler to remove credentials when resources are exported.
HostKeyFingerprint on every SFTP resource and file source, or those connections stop working.EncryptionMode to Explicit or Implicit on FTP connections with credentials, or allow plain FTP with FtpOptions.AllowUnencrypted; ValidateAnyCertificate needs FtpOptions.AllowAnyCertificate.FtpRemoteFileClientFactory and FtpResourceTypeHandler take an IOptions<FtpOptions>; only code that constructs them changes.MaxResourceBytes (resources, 5 MB) or MaxFileBytes (ingestion, 100 MB) are refused instead of buffered.IRemoteFileEgressPolicy returns, and FTP passive data connections stay on the control connection's address. The constructors of FtpRemoteFileClientFactory, FtpResourceTypeHandler, SftpRemoteFileClientFactory and SftpResourceTypeHandler take an IRemoteFileEgressPolicy.ProxyType to None on resources that should connect directly. A proxy type other than None, Socks4, Socks5 or Http, or one without a host or a port from 1 to 65535, is refused (an MCP read returns that as its result).Host, Port, Username and Password first).CrestApps.Core.AI.Mcp.Ftp and CrestApps.Core.AI.Mcp.Sftp with CrestApps.Core.AI.Ftp and CrestApps.Core.AI.Sftp.CrestApps.Core.AI.Mcp.Ftp[.Models|.Handlers] to CrestApps.Core.AI.Ftp[.Models|.Handlers], and the same for SFTP.FtpConnectionMetadata and SftpConnectionMetadata.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/crestapps-core:crestapps-core-mcp-file-resourcesfrom crestapps-core
npx claudepluginhub crestapps/crestapps.agentskills --plugin crestapps-core51 skills in this plugin
/crestapps-core-a2aSkill for Agent-to-Agent (A2A) protocol support in CrestApps.Core on the A2A 1.0 SDK. Covers AddA2AClient and AddCoreAIA2AClient with Entity Framework Core or YesSql connection stores, A2AConnection and A2AConnectionMetadata authentication, AIProfileA2AMetadata, the agent card cache and A2AToolRegistryProvider, the listAvailableAgents, findAgentForTask and findToolsForTask tools, building an A2A host with IAgentHandler, A2AServer, ITaskStore and MapA2A, A2A 1.0 agent cards with supportedInterfaces published at /.well-known/agent-card.json, A2AHostOptions authentication and ExposeAgentsAsSkill, system agents exposed through the host, and upgrading from the 0.3 SDK./crestapps-core-ag-uiSkill for running the CrestApps.Core 2.0 AI chat as an AG-UI agent. Covers the CrestApps.Core.AI.AGUI package (AGUIRunEventWriter, AGUIRunRequest, AGUIJson), AIChatHubCore.RunAgent over SignalR and MapAGUIChat with Server-Sent Events, the RunAgentInput members and streamed events, tool approvals with RequireApproval or an approval tool kind, ApprovalRequiredAIFunction, interrupts and resume, approvals inside agents, page context with crestAppsAGUI.registerContextProvider, shared state with registerStateProvider and update_shared_state, frontend tools, stored tool calls (ChatTurnToolActivity), runs that continue on the next page, AGUIChatOptions.DisconnectedRunTimeout, the protocol and sendPageContext chat options, and the AICompletionContextKeys and ChatResponseHandlerContext members. Use it when showing tool calls in the chat, asking a person before a tool runs, sharing page state with the agent, connecting CopilotKit or another AG-UI client, or troubleshooting approvals and continued runs.Other plugins' skills for the same job