We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/sbroenne/mcp-server-excel'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
ServiceSecurity.cs•1.14 KiB
using System.IO.Pipes;
using System.Security.Principal;
namespace Sbroenne.ExcelMcp.ComInterop.ServiceClient;
/// <summary>
/// Security utilities for ExcelMCP Service named pipe communication (client-side).
/// Provides pipe name generation and client connection creation.
/// </summary>
public static class ServiceSecurity
{
private static readonly string UserSid = WindowsIdentity.GetCurrent().User?.Value ?? "default";
/// <summary>
/// Gets the pipe name for the MCP Server (per-process isolation).
/// </summary>
public static string GetMcpPipeName() => $"excelmcp-mcp-{UserSid}-{Environment.ProcessId}";
/// <summary>
/// Gets the pipe name for the CLI daemon (shared across CLI invocations for the same user).
/// </summary>
public static string GetCliPipeName() => $"excelmcp-cli-{UserSid}";
/// <summary>
/// Creates a client connection to a service pipe.
/// </summary>
public static NamedPipeClientStream CreateClient(string pipeName)
{
return new NamedPipeClientStream(
".",
pipeName,
PipeDirection.InOut,
PipeOptions.Asynchronous);
}
}