
Bitwarden
STDIOBitwarden密码管理器MCP服务器
Bitwarden密码管理器MCP服务器
Model Context Protocol (MCP) server that enables interaction with the Bitwarden password manager vault via the MCP protocol. The server allows AI models to securely communicate with a user's Bitwarden vault through defined tool interfaces.
bw
) installed and authenticatedOpen up your application configuration, e.g. for Claude Desktop:
{ "mcpServers": { "bitwarden": { "command": "npx", "args": ["-y", "@bitwarden/mcp-server"] } } }
Requires that this repository be checked out locally. Once that's done:
npm install npm run build
Install Bitwarden CLI:
npm install -g @bitwarden/cli
Log in to Bitwarden:
bw login
Get session token:
export BW_SESSION=$(bw unlock --raw)
The project includes Jest unit tests covering validation, CLI commands, and core functionality.
# Run all tests npm test # Run tests in watch mode npm run test:watch # Run tests with coverage npm test -- --coverage # Run specific test file npm test validation.spec.ts # Run tests matching a pattern npm test -- --testNamePattern="validation"
Use the MCP Inspector to test the server interactively:
# Start the inspector npm run inspect
This will:
The server provides the following Bitwarden CLI tools:
Tool | Description | Required Parameters |
---|---|---|
lock | Lock the vault | None |
unlock | Unlock with master password | password |
sync | Sync vault data | None |
status | Check CLI status | None |
list | List vault items/folders | type (items/folders/collections/organizations) |
get | Get specific item/folder | object , id |
generate | Generate password/passphrase | Various optional parameters |
create | Create new item or folder | objectType , name , additional fields for items |
edit | Edit existing item or folder | objectType , id , optional fields to update |
delete | Delete vault item/folder | object , id , optional permanent |
Start the server:
export BW_SESSION=$(bw unlock --raw) node dist/index.js
Test with an MCP client or use the inspector to send tool requests.
Enable debug logging by setting environment variables:
export DEBUG=bitwarden:* export NODE_ENV=development
Check Bitwarden CLI status:
bw status
Verify session token:
echo $BW_SESSION
BW_SESSION
token"Please set the BW_SESSION environment variable"
export BW_SESSION=$(bw unlock --raw)
Tests failing with environment errors
restoreEnvVars()
Inspector not starting
npm run build
CLI commands failing
bw --version
bw status
echo $BW_SESSION