Table of Contents

Class McpManager

Namespace
JD.AI.Core.Mcp
Assembly
JD.AI.Core.dll

Aggregates MCP server definitions from all registered discovery providers, applies scope-based merge precedence (Project > User > BuiltIn), and tracks per-server runtime status.

public sealed class McpManager
Inheritance
McpManager
Inherited Members

Constructors

McpManager()

Creates an McpManager using the default provider set: Claude Code, Claude Desktop, VS Code, Codex, Copilot, and the JD.AI-managed config.

public McpManager()

McpManager(IMcpRegistry, JdAiMcpDiscoveryProvider?)

Creates an McpManager with a custom registry and optional write provider.

public McpManager(IMcpRegistry registry, JdAiMcpDiscoveryProvider? jdAiProvider = null)

Parameters

registry IMcpRegistry
jdAiProvider JdAiMcpDiscoveryProvider

Methods

AddOrUpdateAsync(McpServerDefinition, CancellationToken)

Adds or updates a server in the JD.AI-managed config. Throws InvalidOperationException if no writable provider is available.

public Task AddOrUpdateAsync(McpServerDefinition server, CancellationToken ct = default)

Parameters

server McpServerDefinition
ct CancellationToken

Returns

Task

GetAllServersAsync(CancellationToken)

Discovers and merges servers from all providers via the registry.

public Task<IReadOnlyList<McpServerDefinition>> GetAllServersAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

Task<IReadOnlyList<McpServerDefinition>>

GetImportCandidatesAsync(CancellationToken)

Returns servers discovered from external tool configs (Claude Code, Claude Desktop, VS Code, Codex, Copilot) that are not already present in the JD.AI-managed config.

public Task<IReadOnlyList<McpServerDefinition>> GetImportCandidatesAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

Task<IReadOnlyList<McpServerDefinition>>

GetStatus(string)

Returns the cached status for a server, or Default if no check has been performed yet.

public McpServerStatus GetStatus(string serverName)

Parameters

serverName string

Returns

McpServerStatus

RemoveAsync(string, CancellationToken)

Removes a server from the JD.AI-managed config. Throws InvalidOperationException if no writable provider is available.

public Task RemoveAsync(string name, CancellationToken ct = default)

Parameters

name string
ct CancellationToken

Returns

Task

SetEnabledAsync(string, bool, CancellationToken)

Enables or disables a server in the JD.AI-managed config. Throws InvalidOperationException if no writable provider is available.

public Task SetEnabledAsync(string name, bool enabled, CancellationToken ct = default)

Parameters

name string
enabled bool
ct CancellationToken

Returns

Task

SetStatus(string, McpServerStatus)

Updates the cached status for a server.

public void SetStatus(string serverName, McpServerStatus status)

Parameters

serverName string
status McpServerStatus