Skip to content

Initializing a Session

Session initialization is a three-step process:

  1. Send an initialize request.
  2. The server returns a response with the MCP session ID.
  3. Send an initialized notification to indicate you are ready to begin working with the MCP server tools.

Using the Bearer token, send an initialize request to the Vault MCP Server specifying the MCP version and client information. The Vault MCP Server supports MCP versions 2024-11-05 and later.

curl 'https://myvault.veevavault.com/api/ai/mcp' \
  --header 'Accept: application/json, text/event-stream' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer {access_token}' \
  --data '{
    "jsonrpc": "2.0", "id": 1, "method": "initialize",
    "params": {
      "protocolVersion": "2024-11-05",
      "clientInfo": { "name": "my-agent", "version": "1.0.0" }
    }
  }'

Save the session ID from the response header

Section link for Save the session ID from the response header

The server response provides the Vault MCP Server version (protocolVersion) and the Mcp-Session-Id.

Mcp-Session-Id: 1868a90c-b249-4158-9a3c-396561f2510b

{
  "result": {
    "protocolVersion": "2024-11-05",
    "serverInfo": { "name": "myvault.veevavault.com", "version": "26.1.3" },
    "capabilities": { "tools": { "listChanged": false } }
  }
}

Include Mcp-Session-Id on this request and all subsequent requests.

curl 'https://myvault.veevavault.com/api/ai/mcp' \
  --header 'Authorization: Bearer {access_token}' \
  --header 'Mcp-Session-Id: 1868a90c-b249-4158-9a3c-396561f2510b' \
  --data '{ "jsonrpc": "2.0", "method": "notifications/initialized" }'
# Response: 202 Accepted

You have successfully initialized the Vault MCP Server session.