โ† all systems
AGENT INFRAENRICHMENTAI AGENT

In-House Clay MCP Server

A paid hosted MCP dependency sat between our agents and client workspaces. I replaced it with one we own. Same tool names, validated live.

MCP (stdio) ยท TypeScript / Node ยท Clay ยท Env-only credentials

The Problem

Our agents talked to Clay through a third-party hosted MCP server. It worked, but every call routed client workspace access through someone else's proxy, and the vendor controlled uptime, pricing, and which tools existed. For a consultancy running live client workspaces, that is the wrong place for a dependency. I built a drop-in replacement: same tool names, so nothing upstream changed; our own credential handling, so no third party sits between us and a client workspace; and every tool validated against a production workspace before it replaced anything.

Stack

๐Ÿ”Œ
MCP (stdio)
Drop-in replacement โ€” identical tool names to the hosted server
๐ŸŸฆ
TypeScript / Node
Server, tool layer, live validation suite
๐Ÿงฑ
Clay
Table status, credits, counts, schema, export, column operations
๐Ÿ”
Env-only credentials
Loaded at startup โ€” never accepted as a tool argument

How It Works

The execution path

ready7 steps
Map the tools
Hosted MCP server01
Inventory every tool it exposed
Names, inputs, outputs
Rebuild in-house
TypeScript ยท MCP02
Implement each tool with the same name
Same name and shape as the hosted server
Env only03
Load credentials from env at startup
Never accepted as a tool argument
Validate live
โ†ณ real tools/call on production
Clay04
Call every tool on the live workspace
Status, credits, count, schema, export, add column, update column
Swap check05
Did every call return 200?
all 200no swap yet
all 200
no swap yet
Swap the dependency
MCP06
Repoint agents to the in-house server
Same tool names07
Agents and skills keep working
Nothing upstream changes. No third party in the path.
StepGateOutput
The migration was invisible to everything upstream. Every skill and agent that used the hosted server kept working the moment we pointed it at ours, because tool-name parity was a design requirement, not a nice-to-have. Before the swap, each tool was exercised through real MCP tools/call on the live workspace โ€” status, credits, count, schema, paginated export, add column, update column โ€” and every one returned 200. The security rule is one line and non-negotiable: credentials load from the environment at startup and are never accepted as a tool argument.

Key Design Decisions

๐Ÿ”
Drop-In, Not Rewrite
Same tool names as the vendor. Every agent and skill that used the hosted server kept working the moment we pointed it at ours.
๐Ÿ”
Credentials Never Cross the Tool Boundary
Loaded from the environment at startup. They cannot be passed, logged, or leaked through a tool argument.
๐Ÿงช
Validated Against Production
Every tool was exercised through real MCP tools/call on the live workspace before it replaced anything.
๐Ÿ 
Own the Dependency
Uptime, cost, and the tool surface are ours to control. No third party between an agent and a client workspace.

By The Numbers

7
Tools validated live
0
Third parties in the path
1:1
Tool-name parity with hosted server
100%
Upstream agents unchanged
โ† back to all systemsmatthew batterson ยท gtm engineer