Asked about Building and shipping a server

How do you handle credentials in an MCP server?

An answer that works

The server reads them from the environment and the model never sees them. Never accept a key as a tool argument, because arguments are generated by the model and end up in conversation history.

Reading an answer is not being able to give one. The section that teaches this is Building and shipping a server, 5 hours of MCP & tool interfaces.

Learn this properly