# load_mcp_server_info

> **Function** in `langchain_mcp_adapters`

📖 [View in docs](https://reference.langchain.com/python/langchain-mcp-adapters/server_info/load_mcp_server_info)

Load server info from the MCP initialize handshake.

Returns the full `InitializeResult` from the MCP protocol, which includes
server instructions, capabilities, implementation details, and protocol
version.

!!! note

    Unlike [`load_mcp_tools`][langchain_mcp_adapters.tools.load_mcp_tools],
    [`load_mcp_prompt`][langchain_mcp_adapters.prompts.load_mcp_prompt] and
    [`load_mcp_resources`][langchain_mcp_adapters.resources.load_mcp_resources],
    which expect an already-initialized session, this function performs the
    `initialize()` handshake itself and therefore requires a session that has
    *not* been initialized yet. `MultiServerMCPClient.session()` initializes
    by default, so pass `auto_initialize=False` when obtaining a session for
    this function. Passing an already-initialized session raises `ValueError`
    rather than re-running the handshake.

    There is no way to recover an `InitializeResult` from a session that is
    already initialized: the MCP SDK caches only `capabilities` and discards
    `instructions`, `serverInfo` and `protocolVersion`.

## Signature

```python
load_mcp_server_info(
    session: ClientSession | None,
    *,
    connection: Connection | None = None,
    callbacks: Callbacks | None = None,
    server_name: str | None = None,
) -> InitializeResult
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `session` | `ClientSession \| None` | Yes | An MCP client session that has **not** been initialized yet. If provided, this function calls `initialize()` on it. If `None`, a `connection` must be provided and a temporary session will be created automatically. |
| `connection` | `Connection \| None` | No | Connection config to create a new session if `session` is `None`. (default: `None`) |
| `callbacks` | `Callbacks \| None` | No | Optional `Callbacks` for handling notifications and events. Only applied to sessions created from `connection`; ignored when `session` is provided, since the caller owns that session's callbacks. (default: `None`) |
| `server_name` | `str \| None` | No | Name of the server, used for callback context. Ignored when `session` is provided, for the same reason as `callbacks`. (default: `None`) |

## Returns

`InitializeResult`

The `InitializeResult` from the MCP server. Most callers want
`.instructions` and `.serverInfo`; see `mcp.types.InitializeResult`
for the full field set, which servers may extend with additional
fields.

---

[View source on GitHub](https://github.com/langchain-ai/langchain-mcp-adapters/blob/cc0f2843fd5becf2cdb641c910533c3747c3b1ef/langchain_mcp_adapters/server_info.py#L25)