SkillAgentSearch skills...

MCPGateway

Searchable MCP and AITool gateway for .NET, built on Microsoft.Extensions.AI with embedding-based tool discovery, lexical fallback, and unified execution

Install / Use

claude mcp add managedcode -- npx -y github:managedcode/MCPGateway

If the server publishes to npm under a different name, use that package instead — check the repo README.

About this skill
🔌

MCP Server

Model Context Protocol server

Quality Score

75/100

Supported Platforms

Claude Code
Claude Desktop

Tags

Our assessment of MCPGateway

MCPGateway scores 75/100 on our quality scale, 834th of 944 AI & Machine Learning skills we index.

Its MCP Server is 70 KB long, well organised into 34 sections with 63 code examples: long enough that it reads more like full documentation than a focused instruction file, which agents can find harder to follow.

It has 10 GitHub stars, so there is little community track record yet; judge it on its content.

Substance
21/30
Structure
20/20
Description
15/15
Adoption
4/20
Freshness
15/15

Maintenance, license and trust

  • The repository was last updated 6 days ago, so MCPGateway is actively maintained.
  • It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
  • Its trust signals score 97/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.

MCPGateway compared with similar skills

All 4 of these similar skills score higher than MCPGateway; compare them before choosing.

SkillScoreStarsUpdatedFormat
MCPGateway (this skill)by managedcode75106d agoMCP Server
claude-memby thedotmack100119.7ktodayCLAUDE.md
Agent-Reachby Panniantong100114.7k1d agoCLAUDE.md
archifyby tt-a1i10099.8ktodayCLAUDE.md
Understand-Anythingby Egonex-AI10094.4ktodayCLAUDE.md

Frequently asked questions

How do I install MCPGateway?
Run claude mcp add managedcode -- npx -y github:managedcode/MCPGateway. The install tabs above show the steps for each supported agent.
Which AI agents does MCPGateway work with?
It is written for Claude Code and Claude Desktop, as a MCP Server file. Other agents that read the same format can often use it too.
Is MCPGateway safe to use?
It is MIT-licensed and scores 97/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
Is MCPGateway still maintained?
The repository was last updated 6 days ago, so MCPGateway is actively maintained.

ManagedCode.MCPGateway

CI Release CodeQL NuGet License: MIT Downloads

ManagedCode.MCPGateway is a .NET 10 library that turns local AITool instances and remote MCP servers into one searchable and invokable execution surface for Microsoft.Extensions.AI.

It is built on:

  • Microsoft.Extensions.AI
  • the official ModelContextProtocol .NET SDK

ManagedCode.MCPGateway treats the official modelcontextprotocol/csharp-sdk as its MCP protocol baseline. The package uses SDK 2.4.0 and leaves protocol negotiation to that SDK. Package versions follow that SDK line: the ManagedCode.MCPGateway major.minor matches the targeted ModelContextProtocol major.minor, and the patch number counts gateway releases on that line. Gateway-created and caller-provided clients remain usable at any protocol version the SDK successfully negotiates, and exported servers accept the protocol versions supported by the SDK unless the application explicitly configures one. The gateway does not apply a second version gate. The shipped gateway surface includes aggregated MCP tools, prompts, and resources; per-request subscriptions; SDK Tasks and Apps extensions; cache-aware results; and task-backed tool execution. Hosts can opt in to the experimental SDK Skills extension on the same server. Register host-owned Skills with WithSkills or WithSkillPackages and authorize their entries and file reads in the host.

Install

Install the latest stable release from NuGet:

dotnet add package ManagedCode.MCPGateway

What You Get

  • one gateway for local AITool instances and MCP tools
  • one prompt catalog for source-aware MCP prompts plus gateway-owned custom and composite prompts
  • one resource catalog for MCP resources and resource templates aggregated across registered MCP sources
  • one downstream MCP server export path over the aggregated tool, prompt, and resource catalogs with SDK 2.2 protocol support for completions, per-request notifications, resource subscriptions, Tasks, Apps, and cache hints
  • one search API with default schema-aware Markdown-LD SPARQL graph ranking, opt-in vector ranking, and vector-first Auto
  • one graph search API for schema/profile inspection, schema-aware SPARQL search, explicit allowlisted federation, graph evidence, and graph export
  • one category-first routing API for advanced tool discovery flows
  • one invocation API for both local tools and MCP tools
  • additive catalog registration through IMcpGatewayRegistry
  • full in-memory catalog control through IMcpGatewayCatalogRuntime
  • prompt inspection and rendering through IMcpGatewayPromptCatalog
  • resource inspection and reading through IMcpGatewayResourceCatalog
  • DI-owned factory creation for isolated custom gateway instances
  • reusable gateway meta-tools for chat loops
  • optional warmup, caching, query normalization, and embedding reuse
  • BenchmarkDotNet performance and allocation benchmarks for search, indexing, and meta-tools

After services.AddMcpGateway(...), the container exposes:

  • IMcpGateway
  • IMcpGatewayRegistry
  • IMcpGatewayCatalogRuntime
  • IMcpGatewayGraphSearch
  • IMcpGatewayPromptCatalog
  • IMcpGatewayResourceCatalog
  • IMcpGatewayFactory
  • McpGatewayToolSet

Quickstart

using ManagedCode.MCPGateway;
using ManagedCode.MCPGateway.Abstractions;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();

services.AddMcpGateway(options =>
{
    options.AddTool(
        "local",
        AIFunctionFactory.Create(
            static (string query) => $"github:{query}",
            new AIFunctionFactoryOptions
            {
                Name = "github_search_repositories",
                Description = "Search GitHub repositories by user query."
            }));

    options.AddStdioServer(
        sourceId: "filesystem",
        command: "npx",
        arguments: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]);
});

await using var serviceProvider = services.BuildServiceProvider();
var gateway = serviceProvider.GetRequiredService<IMcpGateway>();

var search = await gateway.SearchAsync("find github repositories");
var route = await gateway.RouteToolsAsync(new McpGatewayToolRouteRequest(
    Query: "find github repositories",
    MaxCategories: 3,
    MaxToolsPerCategory: 2));
var invoke = await gateway.InvokeAsync(new McpGatewayInvokeRequest(
    ToolId: search.Matches[0].ToolId,
    Query: "managedcode"));

Default behavior:

  • SearchStrategy = Graph
  • MarkdownLdGraphSource = GeneratedToolGraph
  • MarkdownLdGraphSearchMode = Hybrid
  • SearchQueryNormalization = TranslateToEnglishWhenAvailable
  • DefaultSearchLimit = 5
  • MaxSearchResults = 50
  • MaxDescriptorLength = 16384
  • the index is built lazily on first list, search, or invoke

Hybrid means the Markdown-LD graph path runs schema-aware SPARQL search first, then uses the gateway-built ranked graph candidate path as supporting evidence and fuzzy fallback for noisy queries. It is not a tokenizer-only search path.

DefaultSearchLimit is the normal top-N result size when a caller does not ask for a count. MaxSearchResults is only a hard cap for caller-requested result sizes so LLM-facing tool discovery cannot accidentally flood context. MaxDescriptorLength bounds the generated descriptor text used by search and Markdown-LD graph indexing; hosts with very large tool schemas can raise it explicitly.

Register Tools And Sources

Register local tools during startup:

services.AddMcpGateway(options =>
{
    options.AddTool(
        "local",
        AIFunctionFactory.Create(
            static (string query) => $"weather:{query}",
            new AIFunctionFactoryOptions
            {
                Name = "weather_search_forecast",
                Description = "Search weather forecast and temperature information by city name."
            }));
});

Register MCP sources during startup:

services.AddMcpGateway(options =>
{
    options.AddHttpServer(
        sourceId: "docs",
        endpoint: new Uri("https://example.com/mcp"));

    options.AddStdioServer(
        sourceId: "filesystem",
        command: "npx",
        arguments: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]);
});

AddHttpServer(...) uses the official MCP C# SDK Streamable HTTP transport and SDK-owned protocol negotiation, and keeps the source registered as an HTTP MCP source in gateway descriptors and downstream export metadata. McpGatewayHttpServerOptions exposes additional headers, connection timeout, and OAuth configuration. The package does not set a transport timeout by default; hosts can pass one explicitly or own deadline policy through cancellation tokens and hosting infrastructure.

AddStdioServer(...) inherits the host process environment by default, matching the official SDK. For a third-party or otherwise untrusted stdio server, use McpGatewayStdioServerOptions to disable inheritance and pass the SDK's curated startup environment explicitly:

using ManagedCode.MCPGateway;
using Microsoft.Extensions.DependencyInjection;
using ModelContextProtocol.Client;

var safeEnvironment = StdioClientTransportOptions.GetDefaultEnvironmentVariables();

services.AddMcpGateway(options =>
{
    options.AddStdioServer(new McpGatewayStdioServerOptions
    {
        SourceId = "filesystem",
        Command = "npx",
        Arguments = ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
        InheritEnvironmentVariables = false,
        EnvironmentVariables = safeEnvironment,
        ShutdownTimeout = TimeSpan.FromSeconds(10)
    });
});

The stdio options object also exposes the SDK shutdown timeout and stderr callback. Add any server-specific variables that are not in the curated environment before registration.

You can also register:

  • existing McpClient instances through AddMcpClient(...)
  • deferred McpClient factories through AddMcpClientFactory(...)

When a host already has SDK MCP server handlers and needs a local client for a gateway catalog, McpInMemorySession.CreateAsync(options, services, loggerFactory, cancellationToken) runs both ends in process. Add session.Client through AddMcpClient(..., disposeClient: false) and dispose the session after the gateway instance. The host owns its handler and authorization configuration.

If you need to add tools or sources after the container is built, use IMcpGatewayRegistry:

await using var serviceProvider = services.BuildServiceProvider();

var registry = serviceProvider.GetRequiredService<IMcpGatewayRegistry>();
var gateway = serviceProvider.GetRequiredService<IMcpGateway>();

registry.AddTool(
    "runtime",
    AIFunctionFactory.Create(
        static (string query) => $"status:{query}",
        new AIFunctionFactoryOptions
        {
            Name = "project_status_lookup",
            Description = "Look up project status by identifier or short title."
        }));

var tools = await gateway.ListToolsAsync();

Registry updates invalidate the catalog. The next list, search, or invoke rebuilds the index automatically.

List And Render MCP Prompts

If registered MCP sources expose prompts, resolve IMcpGatewayPromptCatalog from DI and use it as the aggregated MCP prompt surface:

var promptCatalog = serviceProvider.GetRequiredService<IMcpGatewayPromptCatalog>();

var prompts = await promptCatalog.ListPromptsAsync();
var prompt = await promptCatalog.GetPromptAsync(new McpGatewayPromptRequest(
    SourceId: prompts[0].SourceId,
    PromptName: prompts[0].PromptName,
    Arguments: new Dictionary<string, JsonElement>
    {
        ["repository"] = JsonSerializer.SerializeToElement("ManagedCode.MCPGateway")
    }));

Prompt retrieval is source-aware on purpose. Different MCP servers may expose prompts with the same name, so callers should use the SourceId plus PromptName pair returned by ListPromptsAsync(). Identically named prompts are not merged implicitly by the gateway. If you want one higher-level prompt that combines or modifies multiple upstream prompts, register an explicit gateway-owned prompt instead.

Create Gateway-Owned Prompts

You can register custom prompts directly on the gateway and compose them from multiple upstream prompt sources:

services.AddMcpGateway(options =>
{
    options.AddMcpClient("repo", repositoryClient, disposeClient: false);
    options.AddMcpClient("ops", operationsClient, disposeClient: false);

    options.AddPrompt(
        new McpGatewayPrompt("release_review_bundle", async (context, cancellationToken) =>
        {
            var repositoryPrompt = await context.GetPromptAsync(
                "repo",
                "repository_triage_system_prompt",
                new Dictionary<string, JsonElement>
                {
                    ["repository"] = con

Truncated for display — read the full file on GitHub.

Related Skills

View on GitHub
GitHub Stars10
CategoryAI
Updated6d ago
Forks0

Languages

C#

Trust signals

97/100

From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.

1 info