Skip to content

feat: 1Password secret integration - #316

Merged
ChrisJBurns merged 1 commit into
mainfrom
1password-secret-integration
May 6, 2025
Merged

ChrisJBurns merged 1 commit into
mainfrom
1password-secret-integration

Conversation

@ChrisJBurns

@ChrisJBurns ChrisJBurns commented May 1, 2025 •

Copy link
Copy Markdown
Collaborator

Description

This PR implements the 1Password secret integration with ToolHive. It currently only supports the retrieving of secrets and not the deleting/listing/setting of them (we leave the deleting/listing/setting methods as empty implementations until we get a demand for them). We also add some documentation showing how to use ToolHive with 1Password. We make use of the go-sdk for 1Password which was easy to use and only required a service account token.

Use of 1Password as a Secrets Provider

$ thv config secrets-provider 1password
# or
$ thv secret provider 1password

Both methods work the same way and call the same code internally to modify the toolhive/config.yaml file.

Example of using the secret with thv run:

$ OP_SERVICE_ACCOUNT_TOKEN="<populate>" thv run fetch -e OP_SERVICE_ACCOUNT_TOKEN="<populate>"  --secret "op://test/login/password",target=TEST_PASSWORD

I could then confirm that the MCP server started with the secret sourced as the environment variable by performing a docker exec -it <containerId> bash and then running env.

@ChrisJBurns ChrisJBurns changed the title DRAFT: 1password secret integration DRAFT: 1Password secret integration May 1, 2025
@ChrisJBurns
ChrisJBurns marked this pull request as draft May 1, 2025 22:05
@ChrisJBurns ChrisJBurns changed the title DRAFT: 1Password secret integration feat: 1Password secret integration May 1, 2025
Comment thread pkg/secrets/1password.go Resolved
Comment thread pkg/secrets/1password.go

// NewOnePasswordManager creates an instance of OnePasswordManager.
func NewOnePasswordManager() (Provider, error) {
token := os.Getenv("OP_SERVICE_ACCOUNT_TOKEN")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add docs for this environment variable in the README. Let's also add this as a constant on the top of the file.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The OP_SERVICE_ACCOUNT_TOKEN string itself or the token?

Comment thread pkg/secrets/1password.go Resolved
@ChrisJBurns
ChrisJBurns force-pushed the 1password-secret-integration branch from 447ec05 to be26024 Compare May 6, 2025 17:29
@ChrisJBurns
ChrisJBurns marked this pull request as ready for review May 6, 2025 19:07
@ChrisJBurns
ChrisJBurns merged commit b42b139 into main May 6, 2025
@ChrisJBurns
ChrisJBurns deleted the 1password-secret-integration branch May 6, 2025 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants