← All work

04 Qik Office AI + Backend

Letting AI agents act without letting them run wild

Qik Office's agents can reach hundreds of tools over MCP, including tools that write. My part was the guardrails: permissions declared on each tool, and third-party MCP servers treated as untrusted.

Role
AI Product Engineer · team project
When
2026
  • MCP
  • OpenAI Agents SDK
  • TypeScript
  • Node.js
  • Express
  • SSRF protection
  • ~350MCP tools on the team-built platform
  • 1source of truth for tool permissions
  • 6defences on third-party connectors
How it works
  1. 01AgentOpenAI Agents SDK
  2. 02Tool filtertool metadata
  3. 03MCP toolsQik + company
  4. 04Guarduntrusted results
  5. 05Approvalfor writes

Context

Qik Office runs AI agents that work inside a company’s workspace. They schedule meetings, update tasks and draft documents. The agents (built on the OpenAI Agents SDK) reach the product through an MCP server that exposes about 350 tools.

This is a team project. The MCP server and agent runtime were built mostly by other engineers. This case study covers the pieces I built: making it safe to give an agent that much reach.

Permissions live on the tool

An agent with 350 tools needs answers to three questions for each one. Can it run this tool without asking? Does this tool write? Should this app even see it?

Hard-coding allowlists in the agent drifts out of date as soon as someone adds a tool. Instead, I made each tool declare its own policy in its MCP metadata: whether it writes, whether it always needs confirmation, and which app can see it. The agent runtime reads that metadata. So “manual mode” can hide every write tool, and writes can turn into approval cards, without anyone keeping a separate list.

One small detail mattered: the metadata lives under _meta, not annotations, because MCP clients strip unknown keys from annotations.

Bring-your-own MCP servers, treated as untrusted

Companies can also connect their own MCP servers to the agent. That means running tools you don’t control, which return text that goes straight into an LLM’s context. I built the connector layer on the assumption that any of those servers could be malicious:

  1. An SSRF guard, re-checked on every run, not just at setup
  2. Private IP ranges blocked
  3. No tool shadowing: when names collide, the built-in tool always wins
  4. External results wrapped as untrusted data, so injected instructions are not treated as commands
  5. Caps on calls and result size per run
  6. Failure isolation: a broken connector can’t take down the run

Smaller pieces

I also moved agent conversations to server-side response chaining (previous_response_id) instead of replaying the full history on every turn. And I added image generation with prompt moderation and token accounting.