<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rak</title>
    <description>The latest articles on DEV Community by Rak (@raklabsai).</description>
    <link>https://dev.to/raklabsai</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4272012%2F24464a60-014e-484e-8d8f-a8df4363cb43.jpg</url>
      <title>DEV Community: Rak</title>
      <link>https://dev.to/raklabsai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/raklabsai"/>
    <language>en</language>
    <item>
      <title>Why Shared Admin Keys Break Enterprise AI (And the OAuth MCP Gateway Pattern)</title>
      <dc:creator>Rak</dc:creator>
      <pubDate>Sun, 29 Nov 2026 09:26:55 +0000</pubDate>
      <link>https://dev.to/raklabsai/why-shared-admin-keys-break-enterprise-ai-and-the-oauth-mcp-gateway-pattern-kpm</link>
      <guid>https://dev.to/raklabsai/why-shared-admin-keys-break-enterprise-ai-and-the-oauth-mcp-gateway-pattern-kpm</guid>
      <description>&lt;p&gt;Working across enterprise data estates and AI delivery engagements over the last couple of years, I have seen a lot of promising internal AI prototypes stall before ever reaching real users. In most cases, the model quality was fine. What stopped the rollout was how the prototype connected to company data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Problem statement
&lt;/h2&gt;

&lt;p&gt;When a team builds its first internal AI assistant, the quickest path is usually to drop a service-account admin key for SharePoint, Google Drive, HubSpot, or Snowflake into a workflow tool and connect an LLM to the search endpoint. It gets a demo working quickly.&lt;/p&gt;

&lt;p&gt;The trouble starts as soon as Information Security reviews the architecture. If an agent holds a broad service-account token, what stops a junior user in one department from asking the assistant about restricted finance, HR, or deal-room files belonging to another team?&lt;/p&gt;

&lt;p&gt;Often the answer is that someone added a line in the system prompt instructing the model to respect team permissions. That does not hold up in production. An LLM processes your system prompt and retrieved document content as one stream of tokens, so a single indirect prompt injection buried inside an external PDF or email can bypass prompt-level restrictions.&lt;/p&gt;

&lt;p&gt;Across work for a &lt;strong&gt;FTSE 100 Regulated Energy Utility&lt;/strong&gt; and a &lt;strong&gt;Top-Tier Private Equity Firm&lt;/strong&gt;, this permission gap has been the number one barrier between a Friday demo and a governed production deployment.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Area&lt;/th&gt;
&lt;th&gt;Shared service-account key&lt;/th&gt;
&lt;th&gt;Per-user OAuth MCP gateway&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Access boundary&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Broad tenant-wide read/write&lt;/td&gt;
&lt;td&gt;Exact Entra ID or Google Workspace ACL of the signed-in user&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Prompt injection impact&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Can expose restricted board, HR, or deal-room documents&lt;/td&gt;
&lt;td&gt;Limited strictly to files the user can already open natively&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Audit trail&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Single generic &lt;code&gt;ai-bot@company.com&lt;/code&gt; identity&lt;/td&gt;
&lt;td&gt;Real employee identity, OAuth scope, tool inputs, and latency per trace&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Offboarding&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Rotating one key breaks multiple workflows at once&lt;/td&gt;
&lt;td&gt;Standard IdP offboarding revokes agent access immediately&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Security sign-off&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Blocked in regulated and PE reviews&lt;/td&gt;
&lt;td&gt;Aligns with existing Zero Trust and least-privilege policies&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;When you walk a security team through that comparison early on, the conversation becomes straightforward. Instead of asking Infosec to trust an LLM with access control, you keep enforcement inside the identity provider they already run.&lt;/p&gt;

&lt;h2&gt;
  
  
  One FastAPI MCP gateway in front of your tools
&lt;/h2&gt;

&lt;p&gt;Rather than letting each agent manage its own connectors and credentials, I put a single stateless FastAPI Model Context Protocol (MCP) gateway between the agent mesh and downstream systems such as SharePoint, Google Drive, Slack, GitHub, Jira, Confluence, Snowflake, and Neo4j.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Signed-In User (Entra ID / Google OAuth)
        |
        v
[ FastAPI MCP Policy Gateway ]
   |-- 1. Validate JWT &amp;amp; run OAuth 2.0 On-Behalf-Of (OBO) exchange
   |-- 2. Enforce read-only scopes and role-based tool allowlists
   |-- 3. Lazy-load only the 3-5 tool schemas needed for the request
   |-- 4. Scrub PII &amp;amp; inspect payloads for prompt injection
   |-- 5. Emit OpenTelemetry + Langfuse trace tied to user identity
        |
        +---&amp;gt; SharePoint MCP      (User OBO token, Sites.Read.All)
        +---&amp;gt; Snowflake MCP       (Scoped role, read-only warehouse)
        +---&amp;gt; Neo4j GraphRAG MCP  (Entity lineage + page citations)
        +---&amp;gt; Email / Slack MCP   (Draft-only; sending requires human sign-off)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice the last connector. Even with valid per-user OAuth tokens, external write actions (sending a client email, posting an invoice in Xero, deleting a file) stay in draft-only mode until a human clicks &lt;strong&gt;Approve&lt;/strong&gt;. Keeping a single human-in-the-loop gate on state-changing actions avoids avoidable mistakes in live operations.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the request guard looks like
&lt;/h2&gt;

&lt;p&gt;The gateway code does not need to be complicated. Keeping the request boundary small and easy to audit is the whole point. Here is the stripped-down FastAPI guard pattern I use before forwarding any MCP tool call downstream:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;fastapi&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Depends&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;FastAPI&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;HTTPException&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Request&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pydantic&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;BaseModel&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;FastAPI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"MCP Policy Gateway"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="no"&gt;WRITE_TOOLS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"email.send"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"xero.post_invoice"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"sharepoint.delete_file"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ToolCallRequest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;arguments&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;
    &lt;span class="n"&gt;approval_token&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;verify_user_context&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;bearer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;bearer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startswith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Bearer "&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;HTTPException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;401&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;detail&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Missing user OAuth token"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# Validate signature, audience, and tenant claims against IdP JWKS&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;validate_idp_jwt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bearer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeprefix&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Bearer "&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nd"&gt;@app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/mcp/invoke"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;invoke_mcp_tool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ToolCallRequest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Depends&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;verify_user_context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tool&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;WRITE_TOOLS&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;approval_token&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"pending_human_approval"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"tool"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"preview"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arguments&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;# Exchange caller JWT for a short-lived downstream token scoped to this user&lt;/span&gt;
    &lt;span class="n"&gt;scoped_token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;exchange_obo_token&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;user_assertion&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"raw_token"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;target_scope&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;resolve_scope&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;forward_to_mcp_server&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;arguments&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arguments&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;access_token&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;scoped_token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;emit_langfuse_audit_span&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"sub"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One small practical gotcha to watch out for: if you add in-memory caching for downstream OBO tokens, always key the cache by &lt;code&gt;(user_sub, target_scope)&lt;/code&gt; with a short TTL, never just by server name. Better still, start without caching until real latency traces show you need it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dealing with tool bloat at ten connectors
&lt;/h2&gt;

&lt;p&gt;Another issue shows up once a gateway grows from two connectors to eight or ten.&lt;/p&gt;

&lt;p&gt;Across SharePoint, Jira, Confluence, Slack, GitHub, Snowflake, and internal APIs, you can easily end up with 70 to 90 MCP tools. Passing every tool's JSON schema into every prompt burns 15,000 to 25,000 input tokens before the model even reads the user's question. Latency increases, token spend climbs, and tool selection accuracy drops.&lt;/p&gt;

&lt;p&gt;To keep prompts lean, I split tool invocation into two small steps at the gateway:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;catalog.search(intent)&lt;/code&gt; returns only the top 3 to 5 matching tool definitions that the signed-in user is permitted to call.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;mcp.invoke(server, tool, arguments)&lt;/code&gt; runs the chosen tool with Pydantic validation and bounded output truncation.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Combining lazy MCP discovery with Neo4j GraphRAG lineage cut prompt token overhead by more than 60% across regulatory and due-diligence pipelines while keeping page-level citation groundedness at &lt;strong&gt;99.4%&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do you need this on day one?
&lt;/h2&gt;

&lt;p&gt;Ok, great, so should every AI project start by building a full OAuth MCP gateway on day one?&lt;/p&gt;

&lt;p&gt;Well, no. If I am validating an idea during a five-day prototype using anonymised sample files, a simple Python script or low-code tool like n8n is completely fine. You want to confirm that the workflow genuinely saves people time before investing in production infrastructure.&lt;/p&gt;

&lt;p&gt;The point to move behind a governed OAuth MCP gateway is straightforward: when different users need different data permissions, when auditors or clients need a clear trail of who approved an output and which source page backed it up, or when the system needs regression tests and spend limits running inside your own Azure, AWS, or GCP environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Thoughts
&lt;/h2&gt;

&lt;p&gt;Enterprise security principles have not changed just because an LLM is calling the API. Keep your first prototype lean on safe sample data, verify the business value, and then put per-user OAuth, lazy tool loading, and a human approval gate in place before real company records flow through it.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://intelligentstack-ai.com/writing/oauth-mcp-gateways-without-shared-admin-keys/" rel="noopener noreferrer"&gt;Intelligentstack AI&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>python</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Seeding Engineering Norms for AI Coding Agents</title>
      <dc:creator>Rak</dc:creator>
      <pubDate>Sun, 29 Nov 2026 09:26:47 +0000</pubDate>
      <link>https://dev.to/raklabsai/seeding-engineering-norms-for-ai-coding-agents-40l0</link>
      <guid>https://dev.to/raklabsai/seeding-engineering-norms-for-ai-coding-agents-40l0</guid>
      <description>&lt;p&gt;Back in 2019, I wrote an article on Contino Engineering about &lt;a href="https://medium.com/contino-engineering/seeding-a-winning-engineering-culture-107e909fe790" rel="noopener noreferrer"&gt;seeding a winning engineering culture&lt;/a&gt; across distributed software teams. The core lesson from years of building scalable platforms was simple: good code begins with good engineering, and shared engineering norms are what stop a codebase from quietly eroding sprint by sprint.&lt;/p&gt;

&lt;p&gt;Seven years later, AI coding agents have joined the delivery team, and interestingly, the exact same problem has come right back in a faster form.&lt;/p&gt;

&lt;h2&gt;
  
  
  Problem statement
&lt;/h2&gt;

&lt;p&gt;When teams first try AI coding tools without shared norms, the experience is usually frustrating. You give an agent a loose prompt, it generates a thousand lines of plausible-looking code in thirty seconds, and at first glance it feels like huge progress.&lt;/p&gt;

&lt;p&gt;Then you inspect the diff. Logic is duplicated across files, assumptions conflict with the rest of the architecture, a helper library gets invented or pulled in unnecessarily, and subtle edge-case bugs slip through. It is the exact same failure mode I used to see with siloed human coding, just happening ten times faster. Bad things lead to the creation of new bad things!&lt;/p&gt;

&lt;p&gt;Engineers still want autonomy, speed, and clean architecture. The goal is not to slow coding agents down with bureaucracy; it is to give them the same shared engineering norms a strong delivery team works to.&lt;/p&gt;

&lt;h2&gt;
  
  
  Norms to the rescue (for agents too)
&lt;/h2&gt;

&lt;p&gt;In 2019, the way to make engineering norms stick was to agree them early, document them clearly, and put them up on the wall where the entire team could see them every day.&lt;/p&gt;

&lt;p&gt;With AI coding agents, the repository itself is that wall. Every codebase I deliver now, including &lt;code&gt;intelligentstack-ai.com&lt;/code&gt;, carries four tracked documents at the root so any agent reads the exact same standards before editing a single file:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tracked file&lt;/th&gt;
&lt;th&gt;Role in the repository&lt;/th&gt;
&lt;th&gt;What it prevents&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;CONSTITUTION.md&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Non-negotiable architecture and security principles (static edge boundary, OAuth scopes, HTTP headers, client anonymisation)&lt;/td&gt;
&lt;td&gt;Agents casually adding backend state or weakening security to make a feature easier&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;AGENTS.md&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Shared working norms imported identically by Claude Code, Gemini, and Codex (&lt;code&gt;CLAUDE.md&lt;/code&gt;, &lt;code&gt;GEMINI.md&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Tool drift when switching between different models across a project&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;specs/NNN-*.md&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Written functional requirements and concrete acceptance criteria&lt;/td&gt;
&lt;td&gt;Ambiguous prompts and half-finished features&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;docs/adr/ADR-NNNN-*.md&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Short Architecture Decision Records for choices that are costly to reverse&lt;/td&gt;
&lt;td&gt;Future sessions undoing deliberate architectural trade-offs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Having a single &lt;code&gt;AGENTS.md&lt;/code&gt; imported by &lt;code&gt;CLAUDE.md&lt;/code&gt; and &lt;code&gt;GEMINI.md&lt;/code&gt; matters more than it looks. Earlier on I kept slightly separate notes per tool and they drifted out of sync within a fortnight. One shared contract solves that cleanly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Are markdown rules enough on their own?
&lt;/h2&gt;

&lt;p&gt;Ok, great, so if we write &lt;code&gt;AGENTS.md&lt;/code&gt; and a few specs, will coding agents follow every norm reliably?&lt;/p&gt;

&lt;p&gt;Well, no, prose alone is not enough. In a long session, written guidelines can get overlooked. For any norm that genuinely protects quality or security, you want an automated check that fails loudly with a non-zero exit code.&lt;/p&gt;

&lt;p&gt;On web platforms I wrap everything into one command (&lt;code&gt;npm run verify&lt;/code&gt;); on Python FastAPI agent backends I use an equivalent single target covering &lt;code&gt;pytest&lt;/code&gt;, &lt;code&gt;ruff&lt;/code&gt;, &lt;code&gt;mypy&lt;/code&gt;, and &lt;code&gt;bandit&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Enforced identically in .githooks/pre-commit, CI, and every agent run&lt;/span&gt;
npm run test:security   &lt;span class="c"&gt;# Scans for secrets, .env files, local paths &amp;amp; unsafe links&lt;/span&gt;
npm run build           &lt;span class="c"&gt;# Deterministic static build into dist/&lt;/span&gt;
npm run test:e2e        &lt;span class="c"&gt;# Verifies compiled HTML, interactive state &amp;amp; schema outputs&lt;/span&gt;
npm run verify          &lt;span class="c"&gt;# Single verification gate before any commit succeeds&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wiring that gate into tracked &lt;code&gt;.githooks/pre-commit&lt;/code&gt; hooks (and explicitly prohibiting &lt;code&gt;--no-verify&lt;/code&gt;) changes the whole dynamic. When an agent introduces a broken link, misses a security header, or regresses a DOM behaviour, it sees the exact failure immediately, fixes the root cause, and re-runs the checks before a pull request is ever opened.&lt;/p&gt;

&lt;h2&gt;
  
  
  Maintaining the norms and keeping humans on merge
&lt;/h2&gt;

&lt;p&gt;Just like with human teams, repository norms are not static. They evolve as you hit real friction. Whenever an agent repeats a subtle mistake twice, I treat it the same way I used to treat a slow PR queue on a human team: pause briefly, ask what gap allowed it, and either tighten the verification script or add one crisp line to &lt;code&gt;AGENTS.md&lt;/code&gt;. If a norm gets too dogmatic and slows delivery down without adding real safety, I trim it back.&lt;/p&gt;

&lt;p&gt;The one norm I never relax is the merge boundary:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Agents open pull requests; engineers review and merge them.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Working across isolated feature branches or git worktrees keeps each diff focused on a single spec. Every pull request arrives with green security, build, and E2E checks, and I still read the diff myself before merging or triggering a production deployment. Often the tests pass, yet a simpler design is obvious once you read the code as a whole.&lt;/p&gt;

&lt;h2&gt;
  
  
  Thoughts
&lt;/h2&gt;

&lt;p&gt;Building a good engineering culture has always been an investment that pays off steadily over time. In the AI era, encoding your engineering norms into version control and automated verification gates is the modern equivalent of putting them up on the team wall. It clears away repetitive boilerplate so experienced engineers can focus on architecture, security boundaries, and delivering software that holds up in production.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://intelligentstack-ai.com/writing/spec-driven-agentic-coding-playbook/" rel="noopener noreferrer"&gt;Intelligentstack AI&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>devops</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
