Mcp

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

Endpoints

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

List all mcp gateway audit

Read-only trail of proxied tool calls. Project admins see all calls. Members see calls made through their connections, including calls made by agents using connections they shared.

Required API key scopes

project:read

Query parameters

  • actor_service_account_id
    string
  • limit
    integer
  • offset
    integer
  • quick_filter
    string
    Default: all
    One of: "all""agents""approvals""blocked"

Response


Example request

GET /api/projects/:project_id/mcp_gateway/audit
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_gateway/audit/

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",
"created_at": "2019-08-24T14:15:22Z",
"server_name": "string",
"tool_name": "string",
"decision": "auto",
"actor_user": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"actor_service_account": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"handle": "string"
},
"actor_label": "string",
"credential_owner": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"grant_scope": "personal"
}
]
}

Retrieve mcp gateway audit

Read-only trail of proxied tool calls. Project admins see all calls. Members see calls made through their connections, including calls made by agents using connections they shared.

Required API key scopes

project:read

Path parameters

  • id
    string

Response


Example request

GET /api/projects/:project_id/mcp_gateway/audit/: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_gateway/audit/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"created_at": "2019-08-24T14:15:22Z",
"server_name": "string",
"tool_name": "string",
"decision": "auto",
"actor_user": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"actor_service_account": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"handle": "string"
},
"actor_label": "string",
"credential_owner": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"grant_scope": "personal"
}

Retrieve mcp gateway audit counts

Totals backing the quick-filter chips.

Required API key scopes

project:read

Query parameters

  • actor_service_account_id
    string

Response


Example request

GET /api/projects/:project_id/mcp_gateway/audit/counts
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_gateway/audit/counts/

Example response

Status 200
RESPONSE
{
"all": 0,
"agents": 0,
"approvals": 0,
"blocked": 0
}

List all mcp gateway config

The team's gateway settings, plus whether the caller can administer them.

Required API key scopes

project:read

Response


Example request

GET /api/projects/:project_id/mcp_gateway/config
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_gateway/config/

Example response

Status 200
RESPONSE
{
"allow_custom_servers": true,
"allow_member_agent_access": true,
"default_servers_enabled": true,
"member_default_preset": "allow",
"agent_default_preset": "allow",
"registered_template_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"is_admin": true
}

Create mcp gateway config apply preset

Set the policy baseline for members or agents (admin-only).

Required API key scopes

project:write

Request parameters

  • audience
  • preset

Response


Example request

POST /api/projects/:project_id/mcp_gateway/config/apply_preset
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_gateway/config/apply_preset/\
-d audience=undefined,\
-d preset=undefined

Example response

Status 200
RESPONSE
{
"allow_custom_servers": true,
"allow_member_agent_access": true,
"default_servers_enabled": true,
"member_default_preset": "allow",
"agent_default_preset": "allow",
"registered_template_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"is_admin": true
}

Create mcp gateway config set all servers enabled

Enable or disable every MCP server for the team (admin-only): flips each registered server and the default for untouched catalog servers, so newly published templates follow the same posture.

Required API key scopes

project:write

Request parameters

  • enabled
    boolean

Response


Example request

POST /api/projects/:project_id/mcp_gateway/config/set_all_servers_enabled
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_gateway/config/set_all_servers_enabled/\
-d enabled="boolean"

Example response

Status 200
RESPONSE
{
"allow_custom_servers": true,
"allow_member_agent_access": true,
"default_servers_enabled": true,
"member_default_preset": "allow",
"agent_default_preset": "allow",
"registered_template_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"is_admin": true
}

Create mcp gateway config update settings

Update team gateway settings (admin-only).

Required API key scopes

project:write

Request parameters

  • allow_custom_servers
    boolean
  • allow_member_agent_access
    boolean
  • default_servers_enabled
    boolean
  • member_default_preset
  • agent_default_preset

Response


Example request

POST /api/projects/:project_id/mcp_gateway/config/update_settings
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_gateway/config/update_settings/\
-d allow_custom_servers="boolean"

Example response

Status 200
RESPONSE
{
"allow_custom_servers": true,
"allow_member_agent_access": true,
"default_servers_enabled": true,
"member_default_preset": "allow",
"agent_default_preset": "allow",
"registered_template_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"is_admin": true
}

List all mcp gateway members

Admin overview of each member's gateway posture, plus the per-member server kill switch.

Required API key scopes

project:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/projects/:project_id/mcp_gateway/members
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_gateway/members/

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": [
{
"user": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"is_org_admin": true,
"connected_server_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"revoked_server_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
]
}
]
}

Retrieve mcp gateway members

Admin overview of each member's gateway posture, plus the per-member server kill switch.

Required API key scopes

project:read

Path parameters

  • id
    string

Response


Example request

GET /api/projects/:project_id/mcp_gateway/members/: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_gateway/members/:id/

Example response

Status 200
RESPONSE
{
"user": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"is_org_admin": true,
"connected_server_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"revoked_server_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
]
}

Create mcp gateway members set access

Turn one gateway server off (or back on) for one member.

Required API key scopes

project:write

Path parameters

  • id
    string

Request parameters

  • gateway_server_id
    string
  • enabled
    boolean

Example request

POST /api/projects/:project_id/mcp_gateway/members/:id/set_access
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_gateway/members/:id/set_access/\
-d gateway_server_id="string",\
-d enabled="boolean"

Example response

Status 204 No response body

List all mcp gateway rules

Team guardrails evaluated before any scope policy.

Required API key scopes

project:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/projects/:project_id/mcp_gateway/rules
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_gateway/rules/

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",
"name": "string",
"description": "string",
"applies_to": "everyone",
"effect": "needs_approval",
"tool_pattern": "string",
"enabled": true,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
]
}

Create mcp gateway rules

Team guardrails evaluated before any scope policy.

Required API key scopes

project:write

Request parameters

  • name
    string
  • description
    string
  • applies_to
  • effect
  • tool_pattern
    string
  • enabled
    boolean

Response


Example request

POST /api/projects/:project_id/mcp_gateway/rules
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_gateway/rules/\
-d name="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"applies_to": "everyone",
"effect": "needs_approval",
"tool_pattern": "string",
"enabled": true,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Retrieve mcp gateway rules

Team guardrails evaluated before any scope policy.

Required API key scopes

project:read

Path parameters

  • id
    string

Response


Example request

GET /api/projects/:project_id/mcp_gateway/rules/: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_gateway/rules/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"applies_to": "everyone",
"effect": "needs_approval",
"tool_pattern": "string",
"enabled": true,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Update mcp gateway rules

Team guardrails evaluated before any scope policy.

Required API key scopes

project:write

Path parameters

  • id
    string

Request parameters

  • name
    string
  • description
    string
  • applies_to
  • effect
  • tool_pattern
    string
  • enabled
    boolean

Response


Example request

PATCH /api/projects/:project_id/mcp_gateway/rules/: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_gateway/rules/:id/\
-d name="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"applies_to": "everyone",
"effect": "needs_approval",
"tool_pattern": "string",
"enabled": true,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Delete mcp gateway rules

Team guardrails evaluated before any scope policy.

Required API key scopes

project:write

Path parameters

  • id
    string

Example request

DELETE /api/projects/:project_id/mcp_gateway/rules/: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_gateway/rules/:id/

Example response

Status 204 No response body

List all mcp gateway servers

The team's gateway server registry. The registry is sparse: rows appear through the install/share/OAuth-start flows in views.py, or when an admin toggles an untouched catalog template here (set_template_enabled). Servers with no row follow the team config's default_servers_enabled.

Required API key scopes

project:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/projects/:project_id/mcp_gateway/servers
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_gateway/servers/

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",
"name": "string",
"url": "http://example.com",
"description": "string",
"category": "business",
"template_auth_type": "api_key",
"auth_type": "api_key",
"is_team_enabled": true,
"icon_key": "",
"icon_domain": "",
"docs_url": "",
"template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc",
"tool_count": 0,
"connections": [
{
"installation_id": "91166175-c6a9-4caf-88e9-3147ffc9c934",
"user": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"last_used_at": "2019-08-24T14:15:22Z",
"pending_oauth": true,
"needs_reauth": true
}
],
"your_connection": {
"installation_id": "91166175-c6a9-4caf-88e9-3147ffc9c934",
"is_enabled": true,
"pending_oauth": true,
"needs_reauth": true,
"last_used_at": "2019-08-24T14:15:22Z"
},
"agents": [
{
"service_account_id": "81f92c7b-60ae-411e-bc6f-e2dc93db8886",
"user": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"scope": "personal",
"name": "string",
"handle": "string",
"status": "active",
"last_active_at": "2019-08-24T14:15:22Z",
"granted_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
}
}
],
"revoked_user_ids": [
0
],
"is_revoked_for_you": true,
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
]
}

Retrieve mcp gateway servers

The team's gateway server registry. The registry is sparse: rows appear through the install/share/OAuth-start flows in views.py, or when an admin toggles an untouched catalog template here (set_template_enabled). Servers with no row follow the team config's default_servers_enabled.

Required API key scopes

project:read

Path parameters

  • id
    string

Response


Example request

GET /api/projects/:project_id/mcp_gateway/servers/: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_gateway/servers/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"url": "http://example.com",
"description": "string",
"category": "business",
"template_auth_type": "api_key",
"auth_type": "api_key",
"is_team_enabled": true,
"icon_key": "",
"icon_domain": "",
"docs_url": "",
"template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc",
"tool_count": 0,
"connections": [
{
"installation_id": "91166175-c6a9-4caf-88e9-3147ffc9c934",
"user": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"last_used_at": "2019-08-24T14:15:22Z",
"pending_oauth": true,
"needs_reauth": true
}
],
"your_connection": {
"installation_id": "91166175-c6a9-4caf-88e9-3147ffc9c934",
"is_enabled": true,
"pending_oauth": true,
"needs_reauth": true,
"last_used_at": "2019-08-24T14:15:22Z"
},
"agents": [
{
"service_account_id": "81f92c7b-60ae-411e-bc6f-e2dc93db8886",
"user": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"scope": "personal",
"name": "string",
"handle": "string",
"status": "active",
"last_active_at": "2019-08-24T14:15:22Z",
"granted_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
}
}
],
"revoked_user_ids": [
0
],
"is_revoked_for_you": true,
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Update mcp gateway servers

The team's gateway server registry. The registry is sparse: rows appear through the install/share/OAuth-start flows in views.py, or when an admin toggles an untouched catalog template here (set_template_enabled). Servers with no row follow the team config's default_servers_enabled.

Required API key scopes

project:write

Path parameters

  • id
    string

Request parameters

  • name
    string
  • description
    string
  • category
  • is_team_enabled
    boolean

Response


Example request

PATCH /api/projects/:project_id/mcp_gateway/servers/: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_gateway/servers/:id/\
-d name="string"

Example response

Status 200
RESPONSE
{
"name": "string",
"description": "string",
"category": "business",
"is_team_enabled": true
}