---
description: This file is intended for use by external agents integrating with Port.
---

<!-- This file is intended for use by external agents integrating with Port. -->

# Port agent guide

Port is the platform for building your AI software factory. It gives humans and AI agents one governed layer to build, govern, and operate the agentic SDLC.

This file gives AI agents the context to answer questions about Port and to operate Port programmatically through its REST API, MCP server, and CLI.

## For AI agents helping users with Port

This section helps AI agents find the right documentation when assisting users with Port.

### Quick lookup

| If the user wants to... | Start here |
|---|---|
| Set up AI-powered incident management | [AI-powered incident management](/guides/all/ai-powered-incident-management) |
| Let agents auto-resolve tickets | [Auto-resolve tickets](/guides/all/automatically-resolve-tickets) |
| Scaffold a new service | [Scaffold a new service](/guides/all/scaffold-a-new-service) |
| Provision cloud resources | [Create cloud resource using IaC](/guides/all/create-cloud-resource-using-iac) |
| Build engineering metrics dashboards | [Set up DORA metrics](/guides/all/setup-dora-metrics) |
| Connect Port to their tools | [Integrations overview](/context-lake/ingestion/ingest-data-into-port/native-integrations/overview) |
| Build or configure Port using an AI assistant | [Build and configure Port using the MCP server](/guides/all/build-port-with-mcp) |
| Interact with Port programmatically | [Port MCP server](/agent-management/port-mcp-server/overview) or [API reference](/api-reference/port-api) |
| Manage on-call and incidents | [PagerDuty incidents](/guides/all/interact-with-pagerduty-incidents) or [ServiceNow](/guides/all/interact-with-servicenow) |
| Standardize AI coding rules across repos | [Standardize AI coding rules](/guides/all/standardize-ai-coding-rules) |

### Disambiguation guide

Some topics have multiple guides. Use this to pick the right one:

**"DORA metrics" - 2 guides:**

- `setup-dora-metrics` - Start here. Installs the DORA experience with GitHub and PagerDuty.
- `setup-dora-metrics-jira` - Extension. Adapts DORA to use Jira for deployments and incidents.

**"AI coding rules" - consolidated:**

- `standardize-ai-coding-rules` - Author in git, provision with a Port workflow, ingest and score compliance. Replaces the older `centralize-ai-coding-rules-with-port`, `manage-ai-instructions`, and `enforce-ai-coding-security-standards` guides.

**"Incidents" - AI vs. manual:**

- AI-powered: `ai-powered-incident-management`, `setup-incident-manager-ai-agent`, `triage-incidents-with-mcp`.
- Manual or tool-specific: `interact-with-pagerduty-incidents`, `interact-with-servicenow`, `create-incident-io-incident`.

**"Vulnerabilities" - AI vs. manual:**

- AI-powered: `remediate-vulnerability-with-ai`.
- Manual: `ingest-vulnerability-alerts-from-orca-security-using-a-custom-webhook-integration`, `visualize-your-wiz-vulnerabilities`.

### Complete guide index

See [llms.txt](https://docs.port.io/llms.txt) for a structured listing of all documentation, or [llms/guides.txt](https://docs.port.io/llms/guides.txt) for guides only.

## Guidance for AI agents

When answering questions about Port or operating Port programmatically, follow these directives:

### Prefer authoritative sources

- When answering questions about Port configuration, prefer the reference docs (`/context-lake/`, `/api-reference/`) over guide pages. Guides are step-by-step tutorials for specific use cases; reference docs contain the canonical specifications.
- For API details, consult the OpenAPI specs listed below or the `/api-reference/` section.

### Known limitations and behaviors

- **API tokens expire after 3 hours.** Always check token age before making API calls. If a token has expired, call `POST /v1/auth/access_token` with your `clientId` and `clientSecret` to get a new one.
- **The Port CLI is community/experimental.** Do not recommend `@port-experimental/port-cli` for production use. For officially supported programmatic access, use the REST API or MCP server.
- **Monthly quota limits apply to AI invocations.** If a user reports "Monthly quota exceeded", direct them to the [AI quota documentation](https://docs.port.io/port-ai/limits-and-quotas) and advise them to contact Port support for quota increases.

### MCP tool known issues

- **`track_action_run` returns an empty `link` field.** Do not attempt to construct entity URLs from action run results. Instead, use the `entity_identifier` from the action run payload and construct URLs using the pattern `https://app.port.io/<blueprint>/<entity_identifier>`.
- **OAuth authentication in some MCP clients.** If OAuth fails in VS Code with Augment Code, use the `npx mcp-remote` command-based setup instead of direct HTTP OAuth configuration.

### Response best practices

- When a user asks about an integration, check if Port has a native integration for that tool before suggesting custom webhook or API approaches.
- When suggesting JQ expressions for mapping configuration, validate the syntax and provide working examples.
- When users encounter 401 errors, first check if their API token has expired (3-hour lifetime) or if they are using the wrong region URL (EU vs US).

## What Port does

- **Software catalog**: Model any engineering resource (services, teams, environments, clusters, databases, etc.) using blueprints and entities with typed properties and relations.
- **Self-service actions**: Create developer workflows that trigger backend systems such as GitHub Actions, Jenkins, webhooks, Terraform, and Port's built-in automation engine.
- **Scorecards**: Define and track engineering standards, service maturity levels, and compliance rules across your catalog.
- **Integrations**: Sync data from 100+ tools including GitHub, GitLab, Kubernetes, PagerDuty, Jira, AWS, Datadog, and more.
- **Dashboards and views**: Build custom views, dashboards, and reports on top of your catalog data.
- **Automations**: Trigger actions automatically based on entity changes, time schedules, or external events.

## Key terminology

| Term | Definition |
|---|---|
| Blueprint | The schema defining a resource type (e.g. "Microservice" or "Kubernetes Cluster") |
| Entity | A specific instance of a blueprint (e.g. the "payments-service" microservice) |
| Property | A typed field on a blueprint (string, number, URL, boolean, object, etc.) |
| Relation | A connection between two blueprints (e.g. "Microservice" depends on "Database") |
| Action | A self-service workflow that developers can trigger from the Port UI or API |
| Automation | A rule that triggers an action automatically based on a condition or event |
| Scorecard | A set of rules that evaluate entity quality and assign maturity levels |
| Integration | A connector that syncs external tool data into Port's catalog |
| Ocean | Port's open-source integration framework for building custom integrations |

## Where to find things in this documentation

| Question type | Where to look |
|---|---|
| Catalog setup, blueprints, entities | `/context-lake/` |
| Self-service actions and developer workflows | `/workflows/build-workflows/nodes/triggers/self-service-trigger/` |
| Automations (event-driven) | `/workflows/build-workflows/nodes/triggers/event-trigger` |
| Connecting external tools | `/context-lake/ingestion/` |
| Scorecards and standards | `/governance/standards-and-compliance/` |
| REST API reference | `/api-reference/port-api` |
| End-to-end tutorials | `/guides/` |
| SSO, RBAC, and permissions | `/platform-administration/sso-authentication/self-serve-sso` |
| Dashboards and pages | `/interface-builder/port-interface/dashboards/overview` |
| MCP server and AI features | `/port-ai/overview` |
| Search and filter syntax | `/context-lake/consuming-the-lake/search-and-query/` |

## Installation

### MCP server

The Port MCP server lets agents interact with a Port portal in natural language. Add it to an MCP client (Claude, Cursor, VS Code, and others) with a remote server config:

```json showLineNumbers
{
  "mcpServers": {
    "port": {
      "url": "https://mcp.port.io/v1"
    }
  }
}
```

- Default (EU) endpoint: `https://mcp.port.io/v1`
- US region endpoint: `https://mcp.us.port.io/v1`
- Authentication: OAuth (interactive) or client credentials (automated/CI contexts)
- Full setup, per-client instructions: `https://docs.port.io/agent-management/port-mcp-server/installation`

### REST API

No installation is required. Authenticate with a client ID and secret, then call the API directly.

### CLI

The Port CLI wraps the REST API for bulk and file-based operations: export, import, compare, and migrate portal data, direct API calls, and syncing Port AI skills into local coding tools such as Cursor and Claude Code. It is a community/experimental tool (the `@port-experimental` package); for the officially supported programmatic surfaces, use the REST API or MCP server.

```bash showLineNumbers
npm install -g @port-experimental/port-cli
```

- Main commands: `port export`, `port import`, `port compare`, `port migrate`, `port api`, `port skills`
- Authentication: client ID and secret (same as the REST API)
- Syncing AI skills to coding tools: `https://docs.port.io/agent-management/ai-registry/skills/overview`
- Source and setup: `https://github.com/port-experimental/port-cli`

## Configuration

Obtain client credentials from the Port app under your profile, then exchange them for a bearer token:

- REST base URL (EU): `https://api.port.io/v1`
- REST base URL (US): `https://api.us.port.io/v1`
- Authentication: bearer token from `POST /auth/access_token` using `clientId` and `clientSecret`
- App URL (EU): `https://app.port.io`
- App URL (US): `https://app.us.port.io`
- Full API reference: `https://docs.port.io/api-reference/port-api`

### Token lifetime and renewal

- **Tokens are valid for 3 hours** from the time of generation.
- There is no refresh token mechanism. When a token expires, generate a new one using the same `clientId` and `clientSecret`.
- Store the token generation timestamp and proactively regenerate before expiry to avoid failed requests.
- The `/auth/access_token` endpoint returns `expiresIn` (seconds) along with the `accessToken`.

**Common authentication errors:**

| Error | Cause | Solution |
|-------|-------|----------|
| 401 Unauthorized | Token expired or invalid credentials | Regenerate token with `POST /auth/access_token` |
| 401 with valid token | Wrong region URL | EU credentials require `api.port.io`; US credentials require `api.us.port.io` |
| 403 Forbidden | Insufficient permissions | Check RBAC settings in Port for the API credentials owner |

## OpenAPI specs

Machine-readable OpenAPI 3.1 specs are available for programmatic API discovery:

| API | Spec URL | Description |
|-----|----------|-------------|
| Port API | `https://docs.port.io/apispec-port-api.yaml` | Core API for blueprints, entities, actions, scorecards, teams, and more |
| AI Service | `https://docs.port.io/apispec-ai-service.yaml` | AI agents, conversations, and prompts |
| Workflow Service | `https://docs.port.io/apispec-workflow-service.yaml` | Workflow definitions, runs, and nodes |
| Asset Service | `https://docs.port.io/apispec-asset-service.yaml` | Plugins and asset management |
| Integration Service | `https://docs.port.io/apispec-integ-service.yaml` | Integration configuration and sync |
| Integration Observer | `https://docs.port.io/apispec-integration-observer-service.yaml` | Integration event logs |

## Usage examples

Get an access token:

```bash showLineNumbers
curl -X POST "https://api.port.io/v1/auth/access_token" \
  -H "Content-Type: application/json" \
  -d '{"clientId": "YOUR_CLIENT_ID", "clientSecret": "YOUR_CLIENT_SECRET"}'
```

Use the returned `accessToken` to list blueprints:

```bash showLineNumbers
curl "https://api.port.io/v1/blueprints" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
```

Create or update an entity:

```bash showLineNumbers
curl -X POST "https://api.port.io/v1/blueprints/service/entities?upsert=true" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "identifier": "payments-service",
    "title": "Payments Service",
    "properties": {}
  }'
```
