Acts as a security proxy between AI agents and MCP servers to intercept and validate write operations against predefined safety lists.
Also known as goran-revops/mcp-write-gate, mcp-write-gate
- Stars
- 0
- Tools
- —
- Downloads, 30 days
- 91
- Latest version
- 0.2.0
- Last commit
- Sep 26, 2026
- License
- MIT
What is Write Gate MCP?
Write Gate acts as a security proxy between AI agents and MCP servers to intercept and validate write operations against predefined safety lists.
Summary generated from the project's README
About Write Gate MCP server
MCP Write Gate acts as a security proxy designed for GTM and operations teams who want to connect AI agents like Claude Code or Cursor to sensitive systems. It sits between the agent and MCP servers such as HubSpot, Salesforce, Gmail, or Slack to intercept and validate every write operation. While agents can read data freely, any attempt to modify information is checked against predefined safety lists to ensure protected customers or open deals are not contacted or altered.
Users set up the gate locally using Python 3.10 or newer. The proxy manages real API keys and OAuth tokens within its own secure folder, ensuring the AI agent never holds these credentials. It supports both local servers and remote servers via URL. The system can operate in a strict read-only mode where every write is refused, or it can use CSV, TXT, or JSON files to manage specific contact rules and rate limits.
What you can do with it
- 1Prevent unauthorized customer contactAn AI agent can be restricted from sending emails to specific domains or individuals listed in an off-limits file.
- 2Enforce strict read-only accessYou can connect a full-scope API key to a CRM while ensuring the agent can only view data without making changes.
- 3Secure sensitive API credentialsThe proxy keeps authentication tokens hidden from the AI agent to prevent credential theft.
- 4Audit agent tool usageEvery interaction, whether permitted or blocked, is recorded in a log for later review.
Written from the project's README. Every use case is checked against a quote from it.
How to install Write Gate MCP
Formats verified 10 Nov 2026Add to CursorAdd to GooseInstall Write Gate MCP in Claude Code
$ claude mcp add mcp-write-gate -- uvx mcp-write-gateInstall Write Gate MCP in Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"mcp-write-gate": {
"command": "uvx",
"args": [
"mcp-write-gate"
]
}
}
}Install Write Gate MCP in VS Code
.vscode/mcp.json
{
"servers": {
"mcp-write-gate": {
"type": "stdio",
"command": "uvx",
"args": [
"mcp-write-gate"
]
}
}
}Install Write Gate MCP in VS Code CLI
$ code --add-mcp '{"name":"mcp-write-gate","type":"stdio","command":"uvx","args":["mcp-write-gate"]}'Install Write Gate MCP in Claude Desktop
claude_desktop_config.json
{
"mcpServers": {
"mcp-write-gate": {
"command": "uvx",
"args": [
"mcp-write-gate"
]
}
}
}Install Write Gate MCP in Codex
$ codex mcp add mcp-write-gate -- uvx mcp-write-gateInstall Write Gate MCP in Codex config.toml
~/.codex/config.toml
[mcp_servers.mcp-write-gate] command = "uvx" args = ["mcp-write-gate"]
Install Write Gate MCP in Gemini CLI
$ gemini mcp add -s user mcp-write-gate uvx -- mcp-write-gateInstall Write Gate MCP in Gemini settings.json
~/.gemini/settings.json
{
"mcpServers": {
"mcp-write-gate": {
"command": "uvx",
"args": [
"mcp-write-gate"
]
}
}
}Automated checks
Ran Nov 15, 2026Full report →Passed our automated checks. That is not a security audit: read the code and give the server the narrowest access it needs. How checks work
- Source repository linked and reachablegoran-revops/mcp-write-gate is public and reachablegithub.com/goran-revops/mcp-write-gate ↗Pass
- Package names this repository as its sourcemcp-write-gate names goran-revops/mcp-write-gate as sourcepypi.org/project/mcp-write-gate/ ↗Pass
- Build provenance (Sigstore attestation)Sigstore attestation for mcp-write-gatepypi.org/project/mcp-write-gate/ ↗Pass
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-09-26github.com/goran-revops/mcp-write-gate ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNo popular package one edit away from mcp-write-gatePass
- No critical advisory in the package or its dependencies29 resolved dependencies checked; no critical advisoryosv.dev ↗Pass
- No hidden instructions to the model0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNot checked
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubmcp-write-gate
mcp-write-gate sits between an AI agent and the tools it uses through MCP, such as email, a CRM, Smartlead, or Slack. The agent can read freely, but every write is checked before it goes out, and anything aimed at a customer, an open deal, or anyone else on your lists is refused before it reaches the tool.
I built it for GTM and ops teams who connect an agent like Claude Code to their real systems and want a rule the agent cannot argue its way around. The most common setup is read-only mode: you connect Smartlead, HubSpot, or Salesforce with a full-scope API key, and the agent can look at everything but change nothing.
+---------------+ +------------------+ +-------------------+
| AI agent | tool call | mcp-write-gate | allowed calls | Real MCP server |
| (Claude Code, | ------------> | | ---------------> | (HubSpot, Gmail, |
| Cursor, ...) | <------------ | | <--------------- | Smartlead, ...) |
+---------------+ the result, +--------+---------+ results +-------------------+
or why it |
was refused v
+-----------------------------+
| read -> forward |
| write, safe -> forward |
| write, listed -> refuse |
| write, unsure -> hold |
| read-only -> refuse |
| every call -> log |
+-----------------------------+
How it works
The agent connects to mcp-write-gate instead of the real server and sees the same tools, with the same names and inputs. When it calls one, the gate decides what happens. A read goes straight through. A write is checked against your lists, and if it touches a customer, an open deal, or anyone marked do not contact, it is refused and the agent is told why. Nothing reaches the tool. A write to someone who is on no list goes through by default, or waits for a person to approve it if you prefer. You can also cap how often one person is contacted, for example one email per week, and on a read-only server every write is refused no matter what the key allows.
The agent never holds the real API key. The key stays in the gate's own folder, and the gate strips it from anything the server sends back. Every call, allowed or refused, goes into a log that shows if anyone edits it later.
Quick start
You need Python 3.10 or newer.
pip install mcp-write-gate
mcp-write-gate init
mcp-write-gate add mail -- npx -y your-mail-mcp-server
init creates the gate folder in your user folder, away from your projects. It holds gate.json with the rules and the servers, a starter list in lists/off-limits.csv, keys.env for the real servers' API keys, and the log.
add starts the real server once, reads its tools, and guesses which ones read and which ones write. It prints each guess along with a block for your agent's MCP config. Look over the guesses, then paste that block where the real server's entry used to be. In Claude Code it is one command:
claude mcp add mail -- mcp-write-gate serve mail --config "<gate folder>/gate.json"
Remote servers are added by URL, with their keys kept in keys.env and referred to as ${NAME}. A server that uses OAuth needs one sign-in by a person, and after that the gate refreshes the tokens itself:
mcp-write-gate add crm --url https://mcp.example.com/mcp --header 'Authorization: Bearer ${CRM_TOKEN}'
mcp-write-gate add crm --url https://mcp.example.com/mcp --oauth
mcp-write-gate login crm
Before you rely on a rule, you can test it without sending anything:
mcp-write-gate check mail send_email --args '{"to": ["ceo@example.com"]}'
Read-only mode
mcp-write-gate add smartlead --preset read-only --url 'https://mcp.smartlead.ai/sse?user_api_key=${SMARTLEAD_KEY}'
mcp-write-gate reads smartlead
mcp-write-gate confirm smartlead get_campaigns get_campaign_stats
In read-only mode every write is refused, and no list, mode, or approval can change that. A read passes only when it is vouched for, either because the server marks the tool as read-only and its name reads like a read, or because a person confirmed it with mcp-write-gate confirm. mcp-write-gate reads lists every read and who vouched for it.
The gate does not take the server's word for everything. A tool called delete_campaign that the server labels read-only is still treated as a write. If the server changes a tool after you confirmed it, the tool is refused until you confirm it again. A read that tries to change something through its arguments, such as an HTTP DELETE, a SQL statement that writes, or a GraphQL mutation, is refused as well.
That makes it safe to put a full-scope key behind the gate, as long as four things hold:
- The gate is the agent's only way to reach that tool.
- The agent cannot read the gate folder or run code as the gate's user, because then it could find the key and call the API directly. docs/security.md describes three ways to prevent that, the strongest being a separate container.
- You checked each read before confirming it. Generic tools like
call_apiorrun_queryneed extra care, because a vendor API that deletes on a GET looks like a read. - The key still has the narrowest scopes the vendor offers. The gate is a second lock, so keep the first one too.
Lists
Lists are plain CSV, TXT, or JSON files in the lists/ folder, so you can export them from your CRM or keep them by hand. Every file is read, and a change takes effect on the next call.
target,status,note
example.com,customer,paying account
ceo@example.org,open_deal,in a live deal
partner@example.com,allow,partner contact inside a customer
#sales-internal,blocked,chat channel the agent must not post in
*/contracts/*,blocked,signed contracts stay untouched
A domain covers all its subdomains, and an email row also covers the same mailbox written with a +tag or with Gmail's dots. When two rows match, the more specific one wins, which is how partner@example.com,allow can sit inside a customer's domain. A status the gate does not recognize counts as a refusal, so a typo cannot open the gate. If the truth lives in your CRM instead of a file, the gate can run a lookup command for anything that is on no list, as described in docs/configuration.md.
Tested with real servers
| Server | What was tested |
|---|---|
| Smartlead | All 170 tools sorted into reads and writes. Replying to a lead, starting a campaign, and forwarding an email were refused and never sent, confirmed reads passed through, and the API key never reached the agent. |
| HubSpot | Reads passed through to HubSpot. Creating records and logging engagements were refused and never sent. |
| Gmail | All 23 tools sorted. Drafts, labels, spam, and trash are treated as writes. |
| Salesforce | All 74 tools sorted. Deploys, permission changes, and Apex tests are writes, and queries are reads. |
| Notion | All 24 tools sorted. Creating, editing, moving, and deleting pages are writes, and retrieving is a read. |
| MCP filesystem and everything servers | File paths as targets, resources, prompts, completions, and long-running calls. |
I also ran it with Claude Code as the agent. Without the gate, Claude sent the email it was asked to send. With the gate in read-only mode, the email was never sent, and the log showed the refusal.
What it does not protect against
The gate checks who and what a call touches, not what a message says, so a customer's name in the body of an email to someone else is not caught. It cannot see targets hidden in encrypted payloads, custom binary formats, or a bare record id like contact 123. For ids you can add a lookup command, and for the rest you can set that tool to refuse anyone who is not on a list. It cannot stop an agent that runs code as the same OS user as the gate, which is why the Dockerfile runs the gate in its own container. And it only controls what the agent sends to a server, so put only servers you trust behind it.
Learn more
docs/configuration.md covers every setting in gate.json: targets, presets, rate limits, the lookup command, held calls and the approval page, serving over HTTP, and the full command list. docs/security.md explains how to keep the gate out of the agent's reach, where the secrets live, how the log shows tampering, and what the attack tests cover.
Running the tests
pip install -e ".[dev]"
pytest
The tests start a real MCP server behind the gate and talk to it with the official MCP client, over stdio and over HTTP.
License
MIT
Write Gate MCP questions
How do I add Write Gate MCP to Claude Code?
Run claude mcp add mcp-write-gate -- uvx mcp-write-gate in your terminal. Add --scope user to make it available in every project.
How do I add Write Gate MCP to Cursor?
Open ~/.cursor/mcp.json and add the server under mcpServers, using the Cursor config shown in the install section above.
How does the gate protect my API keys?
The agent never holds the real API key; the key stays in the gate's own folder and the gate strips it from any responses sent back to the server.
Can I use this in a read-only mode?
Yes, in read-only mode every write is refused regardless of the key's permissions, and reads only pass if they are vouched for or confirmed by a person.
What kind of files can I use for my safety lists?
You can use plain CSV, TXT, or JSON files located in the lists folder to define targets and statuses.
Does it support OAuth?
Yes, for servers using OAuth, a person performs one sign-in and the gate handles subsequent token refreshes automatically.