Article: Building a Secure MCP Server on AWS for a Million-Company B2B Platform
Summary
An editorial analyst details the process of building a secure Model Context Protocol (MCP) server on AWS for a B2B intelligence platform managing over one million company profiles. The project aimed to enable LLM clients to interact with the platform via structured requests, such as "find SaaS companies in Germany with 50-200 employees," instead of manual portal queries. The MCP server was treated as a first-class interface, not a mere wrapper, emphasizing its own contracts, security, testing, and operational controls. The architecture leveraged GraphQL on AWS AppSync for data exposure and a Go-based MCP server to translate user requests into narrowly scoped tools. Key design decisions included separating read and write operations, implementing a default-deny approach for mutations, and using layered testing with mocked GraphQL clients and real-system validation via MCP Inspector.
Key takeaway
For AI Engineers integrating LLMs with production systems, prioritize designing MCP servers as first-class interfaces with explicit security controls. You should separate read and write operations at the tool level and enforce a default-deny policy for mutations. Implement robust, layered testing, including mocked clients for unit tests and real-system validation with tools like MCP Inspector, to catch backend-specific failures early and ensure predictable behavior.
Key insights
Treating MCP servers as first-class interfaces with narrow tool contracts enhances security and maintainability for LLM integrations.
Principles
- Separate read and write operations in tool design.
- Adopt a default-deny approach for mutations.
- Narrow tool contracts improve safety and maintainability.
Method
Implement an MCP server with a Go-based tool layer, GraphQL on AWS AppSync, OIDC authentication, and layered testing using mocked clients and MCP Inspector for real-system validation.
In practice
- Use `mcp-go` for GraphQL client integration.
- Implement `allowMutations` flag for mutation tools.
- Capture GraphQL variables in mocked tests.
Topics
- Model Context Protocol
- AWS AppSync
- LLM Integration Security
- Read/Write Separation
- GraphQL
Best for: AI Engineer, MLOps Engineer, Software Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by InfoQ.