tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Agentic AI > MCP Protocol > MCP Server with Secret Manager

MCP Server with Secret Manager

Author: Venkata Sudhakar

Hardcoding API keys, database passwords, or service credentials inside an agent is a security risk. Google Cloud Secret Manager provides a central store for secrets with fine-grained IAM access controls and automatic versioning. By exposing Secret Manager operations through an MCP server, your ADK agents can retrieve credentials at runtime without any secrets appearing in source code.

In this tutorial, you will build an MCP server with three tools - get secret, create secret, and list secrets. An ADK agent uses the get secret tool to retrieve a database password before connecting, keeping all credential logic outside the agent instruction.

The MCP server below uses the google-cloud-secret-manager library. Secret values are returned as plain strings so the agent can pass them directly to downstream tool calls.

The ADK agent below uses the Secret Manager MCP server to fetch a database password at runtime. This means no credentials are stored in the agent definition or environment variables visible in code.

Using Secret Manager through MCP keeps credentials out of your agent code and centralises access control. You can extend the server with tools to rotate secrets, add new versions, or disable old versions as part of automated security workflows.


 
  


  
bl  br