This page explains how to register OpenCode as an OAuth client in Pricefx and configure an authenticated MCP connection in OpenCode.
Prerequisites
OAuth Client ID Registration
To use OAuth, each client must be registered with a specific client_id. This configuration is defined through the oauthConfiguration Advanced Configuration Option. Multiple clients can be registered within this setting.
-
Login to your Pricefx partition.
-
Go to Administration > Configuration > System Configuration > Advanced Configuration Options.
-
Click Add.
-
In the Add Option menu:
-
Enter
oauthConfigurationinto Name. -
Enter the following JSON code into Value.
-
Replace the
<client_id>with a name of your choosing, usuallyopen-code. -
Replace the
<port_number>with a port of your choosing, usually3334.JSON{ "knownClients": { "<client_id>": { "redirect_uri": "http://127.0.0.1:<port_number>/mcp/oauth/callback" } } }
-
-
-
Click Add.
|
Property |
Example Value |
Required |
Description |
|---|---|---|---|
|
client_id |
|
Yes |
Client ID example. |
|
redirect_uri |
|
Yes |
Must be configured, as it will be sent by the client. See below about |
|
port_number (configurable) |
|
Yes |
The port on your local machine which OpenCode will use for OAuth handshake. This can be any valid port of your choosing, OpenCode documentations most often use port |
MCP Connection
-
Open your terminal.
-
Type the following command to start a helper process which will guide you through install
Bashopencode mcp addReview the following table before selecting wizard options.
-
If you would like to configure a custom callback port, see the JSON example below to customize. (Optional)
-
Type the following command into your terminal to authenticate.
Bashopencode mcp auth <server_name>
|
Variable |
Description |
|---|---|
|
Location |
The |
|
MCP Server Name |
This option can be any general label you like, such as |
|
MCP Server Type |
|
|
MCP Server URL |
The |
|
Require OAuth |
|
|
MCP Client ID |
The |
|
MCP Client Secret |
|
MCP JSON
If you would like to directly add the MCP server via JSON configuration instead of the terminal command above, you can use the below example reference. Make sure to replace the same <variables> as above.
Note, the
callbackPort field can be omitted entirely if you do not wish to customize.
"<server_name>": {
"type": "remote",
"url": "https://mcp.pricefx.com/mcp/<cluster_host>/<partition>",
"oauth": {
"clientId": "<client_id>",
"callbackPort": <port_number>
}
}
|
Variable |
Description |
|---|---|
|
|
Replace the |
|
|
Replace the |
|
|
Replace |
|
|
Replace |
|
|
Replace the |