Mcp Server

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

GET
POST
GET
PATCH
DELETE
POST
POST
POST
GET
PATCH
POST
POST
GET
GET
POST
POST

List all mcp server installations

Required API key scopes

project:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/projects/:project_id/mcp_server_installations
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/mcp_server_installations/

Example response

Status 200
RESPONSE
{
"count": 123,
"next": "http://api.example.org/accounts/?offset=400&limit=100",
"previous": "http://api.example.org/accounts/?offset=200&limit=100",
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc",
"name": "string",
"icon_key": "",
"icon_domain": "",
"display_name": "string",
"url": "http://example.com",
"description": "string",
"auth_type": "api_key",
"is_enabled": true,
"scope": "personal",
"is_owner": true,
"needs_reauth": true,
"pending_oauth": true,
"proxy_url": "string",
"tool_count": 0,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
]
}

Create mcp server installations

Required API key scopes

project:write

Request parameters

  • display_name
    string
  • url
    string
  • auth_type
  • is_enabled
    boolean

Response


Example request

POST /api/projects/:project_id/mcp_server_installations
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/mcp_server_installations/\
-d template_id="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc",
"name": "string",
"icon_key": "",
"icon_domain": "",
"display_name": "string",
"url": "http://example.com",
"description": "string",
"auth_type": "api_key",
"is_enabled": true,
"scope": "personal",
"is_owner": true,
"needs_reauth": true,
"pending_oauth": true,
"proxy_url": "string",
"tool_count": 0,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Retrieve mcp server installations

Required API key scopes

project:read

Path parameters

  • id
    string

Response


Example request

GET /api/projects/:project_id/mcp_server_installations/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/mcp_server_installations/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc",
"name": "string",
"icon_key": "",
"icon_domain": "",
"display_name": "string",
"url": "http://example.com",
"description": "string",
"auth_type": "api_key",
"is_enabled": true,
"scope": "personal",
"is_owner": true,
"needs_reauth": true,
"pending_oauth": true,
"proxy_url": "string",
"tool_count": 0,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Update mcp server installations

Required API key scopes

project:read

Path parameters

  • id
    string

Request parameters

  • display_name
    string
  • description
    string
  • is_enabled
    boolean

Response


Example request

PATCH /api/projects/:project_id/mcp_server_installations/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/mcp_server_installations/:id/\
-d display_name="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc",
"name": "string",
"icon_key": "",
"icon_domain": "",
"display_name": "string",
"url": "http://example.com",
"description": "string",
"auth_type": "api_key",
"is_enabled": true,
"scope": "personal",
"is_owner": true,
"needs_reauth": true,
"pending_oauth": true,
"proxy_url": "string",
"tool_count": 0,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Delete mcp server installations

Required API key scopes

project:read

Path parameters

  • id
    string

Example request

DELETE /api/projects/:project_id/mcp_server_installations/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/mcp_server_installations/:id/

Example response

Status 204 No response body

Create mcp server installations call tool

Invoke one tool on a connected MCP server.

The request/response shape is plain REST rather than the JSON-RPC envelope proxy speaks, because the caller here is an agent surface (the PostHog MCP's exec) that wants one tool result, not an MCP transport of its own.

Required API key scopes

project:read

Path parameters

  • id
    string

Request parameters

  • tool_name
    string
  • arguments
    object

Response


Example request

POST /api/projects/:project_id/mcp_server_installations/:id/call_tool
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/mcp_server_installations/:id/call_tool/\
-d tool_name="string"

Example response

Status 200
RESPONSE
{
"content": [
{}
],
"is_error": true,
"structured_content": {}
}
Status 403
RESPONSE
{
"detail": "string",
"reason": "needs_approval"
}
Status 404
RESPONSE
{
"detail": "string",
"reason": "needs_approval"
}

Create mcp server installations proxy

Required API key scopes

project:read

Path parameters

  • id
    string

Request parameters

  • display_name
    string
  • url
    string
  • auth_type
  • is_enabled
    boolean

Example request

POST /api/projects/:project_id/mcp_server_installations/:id/proxy
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/mcp_server_installations/:id/proxy/\
-d template_id="string"

Example response

Status 200

Create mcp server installations share

Escalate a personal installation to a team-wide shared one.

Owner-only AND admin-only: sharing exposes the owner's credential to project members, so it carries the same gate as creating a shared install outright. Agents require separate explicit grants.

Required API key scopes

project:read

Path parameters

  • id
    string

Response


Example request

POST /api/projects/:project_id/mcp_server_installations/:id/share
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/mcp_server_installations/:id/share/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc",
"name": "string",
"icon_key": "",
"icon_domain": "",
"display_name": "string",
"url": "http://example.com",
"description": "string",
"auth_type": "api_key",
"is_enabled": true,
"scope": "personal",
"is_owner": true,
"needs_reauth": true,
"pending_oauth": true,
"proxy_url": "string",
"tool_count": 0,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Retrieve mcp server installations tools

Required API key scopes

project:read

Path parameters

  • id
    string

Response


Example request

GET /api/projects/:project_id/mcp_server_installations/:id/tools
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/mcp_server_installations/:id/tools/

Example response

Status 200
RESPONSE
{
"count": 123,
"next": "http://api.example.org/accounts/?offset=400&limit=100",
"previous": "http://api.example.org/accounts/?offset=200&limit=100",
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"tool_name": "string",
"display_name": "string",
"description": "string",
"input_schema": null,
"approval_state": "approved",
"team_state": "approved",
"locked": true,
"decided_by": "string",
"last_seen_at": "2019-08-24T14:15:22Z",
"removed_at": "2019-08-24T14:15:22Z",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
]
}

Update mcp server installations tools

Required API key scopes

project:read

Path parameters

  • id
    string
  • tool_name
    string

Request parameters

  • approval_state

Response


Example request

PATCH /api/projects/:project_id/mcp_server_installations/:id/tools/:tool_name
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/mcp_server_installations/:id/tools/:tool_name/\
-d approval_state=undefined

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"tool_name": "string",
"display_name": "string",
"description": "string",
"input_schema": null,
"approval_state": "approved",
"team_state": "approved",
"locked": true,
"decided_by": "string",
"last_seen_at": "2019-08-24T14:15:22Z",
"removed_at": "2019-08-24T14:15:22Z",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Create mcp server installations tools refresh

Required API key scopes

project:read

Path parameters

  • id
    string

Request parameters

  • display_name
    string
  • url
    string
  • auth_type
  • is_enabled
    boolean

Response


Example request

POST /api/projects/:project_id/mcp_server_installations/:id/tools/refresh
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/mcp_server_installations/:id/tools/refresh/\
-d template_id="string"

Example response

Status 200
RESPONSE
{
"count": 123,
"next": "http://api.example.org/accounts/?offset=400&limit=100",
"previous": "http://api.example.org/accounts/?offset=200&limit=100",
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"tool_name": "string",
"display_name": "string",
"description": "string",
"input_schema": null,
"approval_state": "approved",
"team_state": "approved",
"locked": true,
"decided_by": "string",
"last_seen_at": "2019-08-24T14:15:22Z",
"removed_at": "2019-08-24T14:15:22Z",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
]
}

Create mcp server installations unshare

De-escalate a shared installation back to personal.

Allowed for the credential owner OR a project admin (the reclaim path for shared credentials). The row always stays owned by the ORIGINAL owner — an admin unsharing someone else's install must not capture their credential.

Required API key scopes

project:read

Path parameters

  • id
    string

Response


Example request

POST /api/projects/:project_id/mcp_server_installations/:id/unshare
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/mcp_server_installations/:id/unshare/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc",
"name": "string",
"icon_key": "",
"icon_domain": "",
"display_name": "string",
"url": "http://example.com",
"description": "string",
"auth_type": "api_key",
"is_enabled": true,
"scope": "personal",
"is_owner": true,
"needs_reauth": true,
"pending_oauth": true,
"proxy_url": "string",
"tool_count": 0,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Retrieve mcp server installations authorize

Start (or re-start) an OAuth flow.

Pass template_id to (re)connect a catalog template, or installation_id to reconnect an existing custom install using its cached metadata and per-user DCR creds.

Required API key scopes

project:read

Query parameters

  • install_source
    string
    Default: posthog
    One of: "posthog""posthog-code"
  • installation_id
    string
  • posthog_code_callback_url
    string
    Default:
  • return_path
    string
    Default:
  • template_id
    string

Example request

GET /api/projects/:project_id/mcp_server_installations/authorize
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/mcp_server_installations/authorize/

Example response

Status 200 No response body

Retrieve mcp server installations available tools

Every tool the caller can currently reach, across all their connections.

One request instead of one per connection: an agent surface resolving its tool list on each session cannot afford a fan-out. do_not_use and removed tools are omitted — an agent should not see what it cannot call — while needs_approval tools are listed with their state so the caller can explain the block rather than report the capability as missing.

Required API key scopes

project:read

Response


Example request

GET /api/projects/:project_id/mcp_server_installations/available_tools
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/mcp_server_installations/available_tools/

Example response

Status 200
RESPONSE
{
"servers": [
{
"installation_id": "91166175-c6a9-4caf-88e9-3147ffc9c934",
"name": "string",
"slug": "string",
"tools": [
{
"name": "string",
"description": "string",
"input_schema": {},
"annotations": {},
"approval_state": "approved"
}
]
}
]
}

Create mcp server installations install custom

Required API key scopes

project:read

Request parameters

  • name
    string
  • url
    string
  • auth_type
  • api_key
    string
    Default:
  • description
    string
    Default:
  • client_id
    string
    Default:
  • client_secret
    string
    Default:
  • install_source
    Default: posthog
  • posthog_code_callback_url
    string
    Default:
  • scope
    Default: personal
  • team_enabled
    boolean
    Default: true
  • agent_scope
  • return_path
    string
    Default:

Response


Example request

POST /api/projects/:project_id/mcp_server_installations/install_custom
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/mcp_server_installations/install_custom/\
-d name="string",\
-d url="string",\
-d auth_type=undefined

Example response

Status 200
RESPONSE
{
"redirect_url": "http://example.com"
}
Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc",
"name": "string",
"icon_key": "",
"icon_domain": "",
"display_name": "string",
"url": "http://example.com",
"description": "string",
"auth_type": "api_key",
"is_enabled": true,
"scope": "personal",
"is_owner": true,
"needs_reauth": true,
"pending_oauth": true,
"proxy_url": "string",
"tool_count": 0,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Create mcp server installations install template

Required API key scopes

project:read

Request parameters

  • template_id
    string
  • api_key
    string
    Default:
  • install_source
    Default: posthog
  • posthog_code_callback_url
    string
    Default:
  • scope
    Default: personal
  • team_enabled
    boolean
    Default: true
  • agent_scope
  • return_path
    string
    Default:

Response


Example request

POST /api/projects/:project_id/mcp_server_installations/install_template
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/mcp_server_installations/install_template/\
-d template_id="string"

Example response

Status 200
RESPONSE
{
"redirect_url": "http://example.com"
}
Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc",
"name": "string",
"icon_key": "",
"icon_domain": "",
"display_name": "string",
"url": "http://example.com",
"description": "string",
"auth_type": "api_key",
"is_enabled": true,
"scope": "personal",
"is_owner": true,
"needs_reauth": true,
"pending_oauth": true,
"proxy_url": "string",
"tool_count": 0,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}