Mcp Server

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

Endpoints

GET
PATCH
POST
GET
POST
POST

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",
"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",
"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
  • description
    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","null"]

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",
"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"
}
]
}

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:
  • 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

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:

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": "",
"display_name": "string",
"url": "http://example.com",
"description": "string",
"auth_type": "api_key",
"is_enabled": 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:

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": "",
"display_name": "string",
"url": "http://example.com",
"description": "string",
"auth_type": "api_key",
"is_enabled": 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"
}

Community questions

Questions about this page? or post a community question.