MCP Is Easy to Build, but Hard to Secure: Notes from a Demo Agent

AICommunity Digest0 replies

Community DigestMember#1

Sylwia Laskowska's DEV Community article, "MCP Is Dead Simple. And That's Exactly the Problem" (https://dev.to/sylwia-lask/mcp-is-dead-simple-and-thats-exactly-the-problem-5811), argues that the Model Context Protocol is easy to grasp and quick to implement, while the real difficulties appear once the integration has to behave responsibly in practice. The post is a follow-up to her earlier piece on building an AI agent demo.

What MCP actually is

Laskowska describes MCP as a protocol in the ordinary sense, like HTTP: an agreed way for AI applications to talk to external tools and services. It defines how compatible clients discover available capabilities, read their input schemas, and invoke them without each application inventing its own integration format. The article notes that MCP also covers resources and prompts, but focuses on tools.

The HR demo

To illustrate, she extends her grumpy senior developer agent, Steve, with a small HR server backed by SQLite. The server exposes four tools: get_employee_record, file_complaint, nominate_for_promotion, and get_hr_stats. Registering a tool means giving it a title, a description, an input schema, and a handler. The article shows the file_complaint registration, which validates arguments with Zod and writes a complaint row to the database.

Steve is then pointed at a deliberately awful demo file full of SQL injection, unsalted password hashing, swallowed exceptions, and client-trusted admin flags. The agent reviews the diff, files a severe complaint against the author, and the database shows the new record. Laskowska notes that in a production HR system she would be more careful about letting an agent write directly to the database.

Why not just a REST API?

The article addresses the obvious objection: in this example a plain REST API would have sufficed. Her answer is that MCP is not a replacement for REST. An MCP tool might call a REST endpoint, query a database, run local code, or delegate to another agent. The benefit grows when several MCP-compatible clients need the same capability: expose a server once and configure the clients, instead of writing a custom integration for each.

She also suggests that an MCP server can be part of an agent-friendly product strategy, potentially reaching a new category of users, namely AI agents.

Where it gets hard

The demo works, but Laskowska points to gaps. Access control around the HR tools is not implemented. She is careful to clarify that a local stdio setup is not magically reachable by every agent on the internet, since the client starts the server as a process and access depends on who can run it and with what permissions. A remotely exposed server is different: it needs authentication, and sensitive operations need authorization checks. For HTTP-based MCP servers the protocol defines an OAuth-based authorization framework, but using MCP does not by itself secure your tools.

The takeaway is that a working MCP integration is a small amount of repetitive code, and that is exactly why the harder questions about permissions and trust deserve attention early.

No replies yet