Config
Category: Mcp_client
Source: config.dart
Typed configuration types for MCP servers.
Pure data — no I/O, no parsing. The YAML→config parser lives in glue_harness/src/config/mcp_config.dart (which can depend on these types) so the layered architecture stays clean: strategies don't import from harness.
See docs/plans/2026-04-29-mcp-client.md for the wire-config shape.
Enums
McpSubprocessEnvMode
| Value | Description |
|---|---|
allowlist | |
full |
Classes
sealed McpServerSpec
Where the server lives and how to talk to it.
Constructor
const McpServerSpec({
required this.id,
this.enabled = true,
this.callTimeoutSeconds,
})Properties
| Property | Type | Description |
|---|---|---|
id | String | User-chosen local id (the YAML key). Used for namespacing tools (<id>.<tool>) and as the credential-store namespace. |
enabled | bool | false parks the server without removing it from config. |
callTimeoutSeconds | int? | Per-server override of [McpConfig.callTimeoutSeconds]. |
McpStdioServerSpec
Constructor
const McpStdioServerSpec({
required super.id,
required this.command,
this.args = const [],
this.env = const {},
this.workingDirectory,
super.enabled,
super.callTimeoutSeconds,
})Properties
| Property | Type | Description |
|---|---|---|
command | String | |
args | List<String> | |
env | Map<String, String> | Server-config env keys (after ${VAR} expansion) added to the scrubbed child environment. |
workingDirectory | String? |
McpHttpServerSpec
Constructor
const McpHttpServerSpec({
required super.id,
required this.url,
this.auth = const McpNoAuth(),
this.resourceMetadataUrl,
this.authorizationServer,
super.enabled,
super.callTimeoutSeconds,
})Properties
| Property | Type | Description |
|---|---|---|
url | Uri | |
auth | McpAuthSpec | |
resourceMetadataUrl | Uri? | Cached RFC 9728 resource-metadata URL discovered on a prior session. Skips one HTTP round-trip at startup. Self-healing — stale value just falls back to fresh discovery. |
authorizationServer | Uri? | Cached authorization server URL discovered on a prior session. |
McpWebSocketServerSpec
Constructor
const McpWebSocketServerSpec({
required super.id,
required this.url,
this.auth = const McpNoAuth(),
this.resourceMetadataUrl,
this.authorizationServer,
super.enabled,
super.callTimeoutSeconds,
})Properties
| Property | Type | Description |
|---|---|---|
url | Uri | |
auth | McpAuthSpec | |
resourceMetadataUrl | Uri? | Cached RFC 9728 resource-metadata URL discovered on a prior session. Skips one HTTP round-trip at startup. Self-healing — stale value just falls back to fresh discovery. |
authorizationServer | Uri? | Cached authorization server URL discovered on a prior session. |
sealed McpAuthSpec
Constructor
const McpAuthSpec()McpNoAuth
No auth header. Stdio servers default to this; HTTP servers can opt in.
Constructor
const McpNoAuth()McpBearerAuth
Bearer token. [token] is null when the value comes from the credential store at session start (mcp:<id>:bearer). When non-null it's the literal token (post env-var expansion).
Constructor
const McpBearerAuth({this.token})Properties
| Property | Type | Description |
|---|---|---|
token | String? |
McpOAuthAuth
OAuth 2.1 with PKCE + DCR. Credentials live in the credential store under mcp:<id>:oauth.* — config carries no secrets.
Constructor
const McpOAuthAuth()McpToolPolicy
Constructor
const McpToolPolicy({this.autoApprove = const [], this.deny = const []})Properties
| Property | Type | Description |
|---|---|---|
autoApprove | List<String> | Namespaced names or glob patterns (*.read_file). |
deny | List<String> | Namespaced names or glob patterns (*.delete_file). |
Methods
bool isAutoApproved(String namespacedName)
Returns true if [namespacedName] matches any [autoApprove] pattern.
bool isDenied(String namespacedName)
Returns true if [namespacedName] matches any [deny] pattern.
McpReconnectPolicy
Constructor
const McpReconnectPolicy({
this.enabled = true,
this.initialDelayMs = 500,
this.maxDelayMs = 30000,
this.maxAttempts = 10,
})Properties
| Property | Type | Description |
|---|---|---|
enabled | bool | |
initialDelayMs | int | |
maxDelayMs | int | |
maxAttempts | int |
McpConfig
Constructor
const McpConfig({
this.servers = const [],
this.toolPolicy = const McpToolPolicy(),
this.reconnect = const McpReconnectPolicy(),
this.callTimeoutSeconds = 30,
this.subprocessEnv = McpSubprocessEnvMode.allowlist,
})Properties
| Property | Type | Description |
|---|---|---|
servers | List<McpServerSpec> | All configured servers, in YAML order. |
toolPolicy | McpToolPolicy | |
reconnect | McpReconnectPolicy | |
callTimeoutSeconds | int | Default per-call timeout. May be overridden per server. |
subprocessEnv | McpSubprocessEnvMode | allowlist (default) scrubs the parent env for stdio subprocesses; full inherits everything (matches Claude Desktop's behaviour). |
hasAnyServer | bool get | |
buf | final | |
hasAnyServer | bool get |