Nilay Baranwal
  • WorkSection
  • WritingSection
  • LabSection
  • Open sourceSection
  • GallerySection
  • AboutSection
  • ResumeSection
  • ContactSection
  • Hive MindProject
  • Pre-trade dashboardProject
  • Social LineProject
  • PartymakerProject
  • Generative engine optimisation platformProject
  • Agentic property managementProject
  • I built ChatVault: an open source plugin to back up your AI chat historyArticle
  • No shared service accounts: per-user tokens for MCP serversGuide
  • Webhook agents that wait for a human on the risky callsGuide
  • Door scanning when the club's wifi dropsGuide
  • Measuring AI citations with a frozen prompt panelGuide
  • Treat AI agents like insiders, not tools: 5 guardrails for enterprise MCP serversArticle
  • Gating agent tool calls with MCP annotationsGuide
  • AI agents now outwork humans at Anthropic. Junior engineers are feeling it first.Article
  • Anthropic replaced git. Here's why you probably shouldn't.Article
  • Recruiters can now interview your AI twin. Here's what it actually checks.Article
  • Everyone's building a Jev rival. The independent numbers tell a different story.Article
  • Jev vs OpenAI Decisions API: which decision model should your agent use?Article
  • Top 10 Jev use cases in agentic appsArticle
  • Jev vs Laya: decision modelsArticle
  • LLMs or Jev: where each one actually fitsArticle
  • Everyone's talking about Jev. Here's a closer look at what the data shows.Article
  • Live agent with an approval gateLab
  • Eval a prompt on a real modelLab
  • Prompt injection against a real modelLab
  • GEO audit across AI enginesLab
  • Prompt caching, measuredLab
  • AI engineer interview, beginner pathLab
  • From DSA to a job offer, beginner pathLab
  • Behavioural interview coachLab
  • Interview drill, experiencedLab
  • AI adoption plannerLab
  • Discovery call simulatorLab
  • Scope a vague problemLab
  • MCP analyzerLab
  • MCP inspectorLab
  • Per-user tokens for an MCP serverLab
  • Webhook agent with approval gatesLab
  • Offline door scanningLab
  • Tool gate playgroundLab
  • Prompt-injection spotterLab
  • RAG chunking visualizerLab
  • Eval benchLab
  • Measure AI citationsLab
  • Agent trace debuggerLab
  • Prompt caching simulatorLab
  • Context window budgetLab
  • ChatVaultOpen source
  • textagentOpen source
  • Help EngineerOpen source
  • Email nilaybaranwal@gmail.comContact
  • Connect your agent to my MCP serverLab
  • LinkedInContact
  • GitHubContact
Lab

For forward deployed work

Per-user tokens for an MCP server

Switch between each user's own token and one shared service account, call the tools, and read the audit log.

From my work on Hive Mind

How the agent signs in
Who is asking the agent

Audit log

Call a tool to write the first entry.

How the client gets a per-user token (OAuth 2.1 with PKCE)
  1. The client makes a random code_verifier and sends only its SHA-256 hash (the code_challenge).
  2. The user signs in with the company's SSO and agrees to the scopes the client asked for.
  3. The identity provider redirects back with a one-time authorization code.
  4. The client swaps the code plus the original code_verifier for an access token. A stolen code is useless without the verifier.
  5. The token names the user, carries only their scopes and expires in 15 minutes. The MCP server checks it on every tool call.