Command Palette

Search for a command to run...

UnylyUnyly
Unyly▸ Q&A

How does MCP handle API keys and credentials?

▸ TL;DR

API keys are passed to the MCP server as environment variables when it starts. The MCP server reads them and uses them to call upstream APIs. The LLM never sees the raw credentials — only sees the tools they enable.

Open Unyly catalog

Full answer

When Claude Desktop or another client launches an MCP server (stdio mode), it passes env vars from the config. Example: GitHub MCP gets GITHUB_TOKEN set, then makes GitHub API calls with that token. The LLM only sees "list_repos called → returned 10 repos" — never the token. Best practice: use fine-grained tokens (read-only when possible), rotate periodically, store in OS keychain instead of plain config files. Unyly's MCP detail pages show exactly which env vars each MCP needs, so you can audit before installing.

Related questions