# resolve_mcp_server_env

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/mcp_config/resolve_mcp_server_env)

Resolve `${VAR}` references in one MCP server's supported fields.

Interpolates the `command`, `url`, `args`, `env`, and `headers`
fields (see `_interpolate_env` for the reference syntax); every other
field is copied through verbatim. The input is not mutated.

## Signature

```python
resolve_mcp_server_env(
    server_name: str,
    server_config: Mapping[str, object],
) -> dict[str, Any]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `server_name` | `str` | Yes | Server name used in field-specific error messages. |
| `server_config` | `Mapping[str, object]` | Yes | Raw server configuration. |

## Returns

`dict[str, Any]`

A resolved copy of the server configuration.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/4bfa52000ef65ac623d8ada0cb67f67cbdd663ea/libs/code/deepagents_code/mcp_config.py#L129)