# Google Pub/Sub MCP MCP

> The pubsub_publish_message MCP lets your AI client trigger cloud events by publishing payloads to a single, designated Google Pub/Sub Topic. It acts as a reliable event producer for distributed systems architecture, notifying multiple downstream workers immediately after an action is confirmed.

## Overview
- **Category:** industry-titans
- **Price:** Free
- **Tags:** event-driven, messaging, pub-sub, gcp, notifications

## Description

You need a way for one service update to reliably alert several other services without needing complex, hardcoded API calls. This MCP gives your agent exactly that: the power to publish messages directly to a specific Google Pub/Sub Topic. It's built for event-driven systems where you can't rely on synchronous responses from all parties. When an action completes—say, a user profile is updated or inventory changes status—your AI client publishes the message and the system reacts instantly. This isolation means your agent never has to worry about permissions outside of this single topic, keeping things safe while giving you serious publishing power. Accessing this capability through Vinkius lets your agent interact with enterprise-grade cloud services using simple messaging primitives, treating event generation like a first-class action.

## Tools

### pubsub_publish_message
Sends a defined message payload and attributes to the configured Google Cloud Pub/Sub Topic.

## Prompt Examples

**Prompt:** 
```
Publish an event indicating that the user sign-up was verified.
```

**Response:** 
```
Done! I've published the message to the topic. The generated Message ID is '3910398201'.
```

**Prompt:** 
```
Send the invoice payload to the topic with the attribute 'type=invoice_ready'.
```

**Response:** 
```
The payload was successfully published. The attribute 'type: invoice_ready' was attached for downstream filtering.
```

**Prompt:** 
```
Trigger the background data export via Pub/Sub.
```

**Response:** 
```
Message sent. The workers subscribed to the topic will now begin the background export process.
```

## Capabilities

### Generate system notifications
Publish immediate alerts or status updates to subscribing microservices.

### Trigger backend workflows
Send a structured message that signals downstream workers (like data processing jobs) to start their processes.

### Pass detailed event metadata
Attach custom attributes alongside the main payload, allowing subscribers to filter or route messages precisely.

### Confirm message delivery status
Receive confirmation that the payload was successfully accepted by the Pub/Sub Topic.

## Use Cases

### The user profile updated, but nothing is notifying search.
A user's email changes. Instead of manually calling a Search Index API endpoint and then telling the Notification Service to run, your agent uses `pubsub_publish_message` with the payload 'user:updated'. The Search Index worker and the Email Worker both listen for this event and update their systems simultaneously.

### The payment gateway finished processing an invoice.
An invoice is finalized. Rather than building a dedicated API call to tell the Billing Audit Service it's ready, your agent uses `pubsub_publish_message` and adds the attribute 'type: invoice_ready'. The Billing Audit service immediately picks up this signal.

### Need to restart all background data exports.
The data warehouse needs a nightly refresh. Instead of logging into three different system dashboards, your agent calls `pubsub_publish_message` with the prompt 'Trigger background data export'. All subscribed worker services pick up the instruction and start their jobs.

### User signs up and verification is needed.
A user completes sign-up. The agent uses `pubsub_publish_message` to send an event indicating 'user sign-up was verified.' This triggers the welcome email worker and updates the CRM system instantly.

## Benefits

- Decouple services. You no longer need to call Service B directly from Service A. Just send the event via `pubsub_publish_message`, and every interested worker picks it up.
- Guaranteed delivery signal. The tool confirms that the payload was successfully accepted by the topic, giving you reliable proof of the trigger.
- Contextual messaging. You can attach custom message attributes—like 'source: billing' or 'type: invoice_ready'—so subscribers know exactly how to handle the event.
- Scales with your architecture. Since it uses a standard pub/sub model, you don't worry about managing API rate limits for every single consuming service.
- Simplified agent logic. Your AI client only needs to know one action: calling `pubsub_publish_message`. It abstracts away the complexity of the entire message bus.

## How It Works

The bottom line is that your agent sends an atomic signal to the topic, and everything subscribed listens for it.

1. Your AI client determines an event needs to happen (e.g., 'order confirmed').
2. It uses the tool to publish a message payload, including any necessary data and custom attributes, to the topic.
3. The system confirms the successful publication of the message, allowing downstream services to immediately process the event.

## Frequently Asked Questions

**What data does pubsub_publish_message send?**
It sends a payload (the main message body) and allows you to attach custom attributes. You can include structured JSON data in the payload, plus metadata like 'source' or 'status' in the attributes.

**Is pubsub_publish_message reliable?**
Yes. It confirms that your message was successfully received by the Google Pub/Sub Topic. This means the event signal was sent reliably, even if downstream workers are temporarily offline.

**How does pubsub_publish_message handle errors?**
The tool only handles publishing; it doesn't manage consumption failure. If a worker fails to process the message, Pub/Sub's built-in retry mechanisms handle that, keeping your agent clean.

**Does pubsub_publish_message require GCP permissions?**
No, this MCP is scoped only to publishing messages on a single topic. It strips away dangerous global permissions, giving you surgical access and nothing more.

**What is the security scope of pubsub_publish_message?**
The tool's access is strictly confined to publishing messages only on your single designated topic. It physically prevents the agent from configuring or altering any other resources in GCP, ensuring absolute containment.

**How do I use message attributes with pubsub_publish_message?**
You pass key-value pairs as metadata when publishing a message. Downstream services read these specific attributes to filter messages, allowing only relevant workers to process the payload.

**Does pubsub_publish_message handle authentication for my AI client?**
Authentication is managed securely by Vinkius using service account credentials. You don't need to worry about keys; your agent simply connects via its secure, authorized token.

**Are there rate limits when calling pubsub_publish_message?**
While Pub/Sub is built for high throughput, sustained excessive calls can trigger throttling. We recommend batching related messages to stay within service limits and maintain smooth event flow.

**Why limit the agent to a single Pub/Sub Topic?**
To enforce zero-trust architecture. An autonomous AI agent should not have the ability to publish events to arbitrary critical infrastructure topics (e.g., billing alerts or user deletion events).

**Do I need to base64-encode my messages manually?**
No. Provide plain text or JSON strings directly to the tool. The engine will automatically convert your payload to base64 as required by the Google Cloud Pub/Sub REST API.

**Can the agent receive messages with this tool?**
No. This tool only has `publish_message` capabilities to enforce unidirectional isolation. If the agent needs to receive messages, it must use the Google Pub/Sub Subscription MCP.