← All integrations

AI assistant integration

Connect OpenCode
to Network Perspective

Connect your Network Perspective reports to OpenCode and ask questions about the metrics available to your account.

Before you start

  • OpenCode v1.19.5. This guide’s configuration and callback were checked against that release. For a different version, confirm callback compatibility with Network Perspective. Run the browser and CLI on the same machine.
  • A Network Perspective account with access to the company you want to explore. Ask your Network Perspective administrator to enable AI assistant access if it is unavailable.
  • Your organization’s approval to use this tool with your data and allow its connection to Network Perspective.
Your permissions stay with you.

The connection reads the reports and metrics available to your account, including report-visible comments and quotations. It does not change reports or settings.

1. Add Network Perspective

Add the user configuration

Create or edit ~/.config/opencode/opencode.json. For a project-only connection, use opencode.json in the project root instead.

If this file already exists, merge the np entry into its existing configuration. Preserve your other servers and settings. These values are public setup identifiers; no client secret is needed.

ConfigurationCopy
{ "mcp": { "np": { "type": "remote", "url": "https://app.networkperspective.io/mcp", "oauth": { "clientId": "np-opencode", "scope": "np.read offline_access" } } } }

Keep the release settings together

Use the camelCase clientId and singular scope fields shown here. Do not mix them with examples from a development branch or another release.

2. Connect your own account

Run this command in your terminal, then complete the browser sign-in:

Sign inCopy
opencode mcp auth np

Open or restart your OpenCode session after saving the configuration.

  1. Sign in with your own Network Perspective account in the browser.
  2. Choose the intended company or network when offered, review the requested access, and approve the connection.
  3. Return to your tool and check that Network Perspective is connected.

Each connection is authorized for one company. To work with another company, use a separate connection where your tool supports it.

3. Try the connection

Start a conversation in OpenCode and ask:

First questionCopy
Use Network Perspective to tell me which company I’m connected to and the current reporting month.

Check the answer: the assistant should use Network Perspective’s get_company_info tool and return the company you intended to connect and its current reporting month. A server appearing in a list alone does not confirm it is working.

Then try: “What metrics are available?”

If something gets in the way

The callback fails

Version 1.19.5 uses http://127.0.0.1:19876/mcp/oauth/callback. Network Perspective’s registration deliberately omits the port. A different callback path or host requires a compatibility check. If the local port is busy, close the conflicting authentication process and retry.

OpenCode does not find the connection

Check your configuration location and valid JSON. Restart OpenCode after changes and ask it explicitly to use Network Perspective. Use the authentication command again if sign-in has expired.

Sign-in or company access fails

Check the exact client ID in this guide. If the client is rejected, contact Network Perspective. For a missing company or access denied, ask your Network Perspective administrator to check membership, AI assistant access, and report permissions.

The callback does not match

Contact support with the client version and callback value only. Do not send a full authorization URL, sign-in code, token, or secret. Do not change callback hosts or paths to work around an error.

Disconnect whenever you need to

In Network Perspective, open Me → Connected agents, find the connection, and disconnect it. This revokes that connection’s access.

Removing it from your AI tool or clearing local files alone does not revoke access in Network Perspective. Disconnecting cannot remove information already shared with the AI provider.

Open Connected agents →