Opal API
About
A RESTful API to programmatically interact with the Opal Security platform.
Details
- Author
- opalsecurity
- Categories
- Cloud Service, Security, Infrastructure, API
Jump to
Setup
Install Opal API in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/opalsecurity/opal-mcp
Follow the installation instructions in the repository README, then restart your MCP client.
Developer-friendly & type-safe Typescript SDK specifically catered to leverageopal-mcpAPI.
Opal API: The Opal API is a RESTful API that allows you to interact with the Opal Security platform programmatically.
- opal-mcp
- Build the image
- Run the container
This SDK is also an installable MCP server where the various SDK methods are exposed as tools that can be invoked by AI applications.
⚠️WARNING: Node.js v20 or greater is required to run the MCP server from npm.
To authenticate with the Opal API, you'll need to generate an API token:
- Log in to the Opal dashboard as an Admin
- Navigate to theSettingspage
- Select the API Tokens section
- Click "Generate new token"
- Choose the appropriate access level:
- Read-only: For applications that only need to view resources
- Full-access: For applications that need to create or modify resources
If a token is compromised, you can revoke it at any time from the Opal Admin page.
For more information, see theOpal API Authentication Documentation.
The following environment variables can be used to configure the SDK and MCP server:
The library can be installed with eithernpm,pnpm,bunoryarnpackage managers.
yarn add opal-mcp zod # Note that Yarn does not install peer dependencies automatically. You will need # to install zod as shown above.
[!NOTE] This package is published with CommonJS and ES Modules (ESM) support.
Add the following server definition to yourclaude_desktop_config.jsonfile:
{ "mcpServers": { "OpalMcp": { "command": "npx", "args": [ "-y", "--package", "opal-mcp", "--", "mcp", "start", "--bearer-auth", "<API_TOKEN>" ] } } }
Create a.cursor/mcp.jsonfile in your project root with the following content:
{ "mcpServers": { "OpalMcp": { "command": "npx", "args": [ "-y", "--package", "opal-mcp", "--", "mcp", "start", "--bearer-auth", "<API_TOKEN>" ] } } }
You can also run MCP servers as a standalone binary with no additional dependencies. You must pull these binaries from available Github releases:
curl -L -o mcp-server \ https://github.com/opalsecurity/opal-mcp/releases/download/v0.0.6/mcp-server-bun-darwin-arm64 && \ chmod +x mcp-server
If the repo is a private repo you must add your Github PAT to download a release-H "Authorization: Bearer {GITHUB_PAT}".
{ "mcpServers": { "Todos": { "command": "./DOWNLOAD/PATH/mcp-server", "args": [ "start" ] } } }
For a full list of server arguments, run:
npx -y --package opal-mcp -- mcp start --help
The SDK includes a Dockerfile and docker-compose.yaml for easy containerization and deployment.
-
Create a.envfile with your configuration:
BEARER_AUTH=your_api_key_here PORT=32000 SERVER_URL=https://api.opal.dev/v1 LOG_LEVEL=info
Configure your MCP client to connect to the server by adding the following to your configuration file:
{ "mcpServers": { "opal-mcp": { "url": "http://localhost:32000/sse", "env": { "API_KEY": "your_api_key_here" } } } }
You can also build and run the Docker image directly:
# Build the image docker build -t opal-mcp-server . # Run the container docker run -p 32000:32000 -e BEARER_AUTH=your_api_key_here opal-mcp-server
Here are some common issues you might encounter when using the MCP server and how to resolve them:
- Verify Node.js version is v20 or greater
- Check if port 32000 is already in use
- Ensure you have proper permissions to run the server
- Try running withLOG_LEVEL=debugfor more detailed output
- Verify your API token is valid and not expired
- Check if the token has the correct permissions
- Ensure the token is properly set in the environment variables
- Confirm theSERVER_URLpoints to the correct environment
- Slow Response Times
- Check network connectivity to the Opal API
- Be aware of the token limit for the model you are using and the number of paginated results
- Unlikely. Verify you're not hitting rate limitsOpal API Rate Limits
- Cursor/Claude Not Connecting
- Verify yourmcp.jsonconfiguration is correct
- Ensure the MCP server is running before starting Cursor/Claude
- Check if the bearer auth token is properly formatted
- Confirm the SSE endpoint URL is accessible
- Ensure only one Cursor/Claude window is open
-
Error: listen EADDRINUSE: address already in use :::32000
- Another process is using port 32000
- Either stop the other process or change the PORT environment variable
- The provided API token is invalid or malformed
- Generate a new token from the Opal dashboard
Error: Node.js version must be >= 20.0.0
- Update your Node.js installation to version 20 or greater
- SetLOG_LEVEL=debugfor more detailed logs
- Check theOpal API Documentation
- File an issue on the GitHub repository
- createAccessRule- Creates a new access rule config for the given group_id.
- getAccessRule- Returns a list of access rule config given the group_id of the access rule.
- updateAccessRule- Updates the access rule config for the given group_id.
- getApps- Returns a list ofAppobjects.
- getApp- Returns anAppobject.
- getSyncErrors- Returns a list of recent sync errors that have occurred since the last successful sync.
- getBundles- Returns a list ofBundleobjects.
- createBundle- Creates a bundle.
- getBundle- Returns aBundleobject.
- deleteBundle- Deletes a bundle.
- updateBundle- Updates a bundle.
- getBundleResources- Returns a list ofResourceobjects in a given bundle.
- addBundleResource- Adds a resource to a bundle.
- removeBundleResource- Removes a resource from a bundle.
- getBundleGroups- Returns a list ofGroupobjects in a given bundle.
- addBundleGroup- Adds a group to a bundle.
- removeBundleGroup- Removes a group from a bundle.
- getBundleVisibility- Gets the visibility of the bundle.
- [setBundleVisibility- Sets the visibility of the bundle.
…
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.
