It must be a better way but here's how I did it.
Firstly it's important to understand that the mnemonic phrase could be used to generate an infinite number of private keys and the JSON Keystore format stores just one private key. That means that you'll need to do the following procedure for each private key you want to import on the Ethereum Wallet.
First you need to find the private key for a specific address:
- Go to MyEtherWallet.com
- Select the appropriated network on the upper right corner
- Click on 'View Wallet Info'
- Choose 'Mnemonic Phrase'
- Paste/type your mnemonic
- Type your password and unlock the account
- Select the correct derivation path. If the case of MetaMask that should be first one: m/44'/60'/0'/0
- Select the desired address
- You should see your private key under under field 'Private Key (unencrypted)'
Now that you have the private key you need to covert it to JSON Keystore file. You can do this using geth but in my case I've used a javascript library called ethereumjs-wallet as the following:
const fs = require("fs")
const wallet = require("ethereumjs-wallet")
const pk = new Buffer.from('c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3', 'hex') // replace by correct private key
const account = wallet.fromPrivateKey(pk)
const password = 'something' // will be required to unlock/sign after importing to a wallet like MyEtherWallet
const content = JSON.stringify(account.toV3(password))
// writes to a file
const address = account.getAddress().toString('hex')
const file = `UTC--${new Date().toISOString().replace(/[:]/g, '-')}--${address}`
fs.writeFileSync(file, content)
Hope somebody has a better alternative out there.