Why OpenCode?
OpenCode is an AI-powered coding agent that gives you unprecedented flexibility in choosing your AI provider. Unlike tools locked to a single vendor, OpenCode supports 75+ LLM providers from major platforms like Anthropic, OpenAI, and AWS Bedrock to local models via Ollama or llama.cpp. Whether you're optimizing for cost, privacy, or specific model capabilities, OpenCode's unified provider system lets you connect any compatible service through a simple /connect command.
This flexibility becomes particularly powerful when building specialized agents. In this article, we'll leverage public AWS MCP (Model Context Protocol) servers to create a powerful architect buddy.
AWS MCP Servers: Extending agents with AWS Context
AWS provides official MCP servers that extend AI assistants with deep AWS knowledge and tooling capabilities. The Model Context Protocol, developed by Anthropic, offers a standardized way to connect AI models to external data sources and tools through a client-server architecture.
The AWS Documentation MCP Server is particularly valuable for architecture work. It provides three core capabilities: fetching and converting AWS documentation pages to markdown format, searching the official AWS documentation using the AWS Search API, and retrieving content recommendations for related AWS services. This means your AI assistant can reference authoritative AWS documentation, verify best practices in real-time, and suggest relevant services based on your architecture requirements.
AWS also offers the AWS Diagram MCP Server, which generates professional architecture diagrams using the Python diagrams package with the complete AWS icon set. Combined with documentation lookup, this enables AI assistants to create accurate, best-practice-compliant architecture diagrams through simple natural language prompts—transforming hours of manual diagramming work into minutes of conversation.
We're going to use the ones above with the combination of a powerful agent specification to create our AWS architect buddy.
Combining the best of both worlds
With the combination of OpenCode and AWS MCPs, you have the flexibility of using any of your LLM provider's license while also having access to the most up-to-date AWS documentation and diagramming capabilities. Unlocking the limits of your vendor's toolkit or pricing model.
Defining MCPs in OpenCode
Prerequisites
To make the MCP servers work, you need uv and graphviz installed and available on your machine.
Configuration
I have a ready-made sample for OpenCode with AWS local MCP servers. To define the AWS MCPs, you have to add them to your opencode.jsonc.
{
"awslabs.aws-diagram-mcp-server": {
"type": "local",
"command": [
"uvx",
"awslabs.aws-diagram-mcp-server"
],
"environment": {
"FASTMCP_LOG_LEVEL": "ERROR"
},
"enabled": true
},
"awslabs.aws-documentation-mcp-server": {
"type": "local",
"command": [
"uvx",
"awslabs.aws-documentation-mcp-server@latest"
],
"environment": {
"FASTMCP_LOG_LEVEL": "ERROR"
},
"enabled": true
}
},
Permissions
Make sure that for all other agents the MCP servers above are disabled, by adding the following line to your opencode.jsonc:
"tools": {
"awslabs*": false
},
We're going to enable them only for the AWS architect agent that we define later.
Testing MCP configuration
Check if the specified MCP servers are working correctly with the following OpenCode CLI command:
opencode mcp list
Alternatively you can just type /mcps in OpenCode.
OpenCode - Agent Specification
Fortunately, there are ready-made samples for Claude Code in this repo, so we're not going to start from scratch. I tailored the sample above and added some AWS specifics. You can grab the OpenCode version from here.
Installing the Agent
You can install the agent in various ways. The agent configuration can be found over here. Make sure to save this file in the appropriate location. Either in ~/.config/opencode/agents (global config) or in .opencode/agents for your project specific configuration.
Agent Permissions
If you open the markdown file you'll notice that many of the tools are disabled. All awslabs prefixed tools are turned on to make sure only this agent has access to the MCP servers. More about agent permissions are in the OpenCode documentation.
permissions:
bash: deny
tools:
write: false
read: true
grep: true
glob: true
awslabs*: true
The AWS Architect Buddy in Action
Time for truth, time for giving tasks for our new architect. Start opencode and use the <TAB> key to switch to the Aws-Architect agent.
We're going to use an architecture kata for this exercise.
⚠️Note: All the content below was generated by the agent. I pasted them without any modifications.
Working with NFRs
Summary of Key Quantifiable NFRs
| Pillar | Critical Metrics |
|---|---|
| Operational Excellence | Deploy frequency (weekly), MTTR < 30 min, automated recovery 95%+ |
| Security | Zero data breaches, < 1% false positive cheat detection, PCI-DSS compliant |
| Reliability | 99.9% uptime, RPO < 1 hour, RTO < 2 hours, match completion rate > 98% |
| Performance | < 50ms latency, 60+ FPS, < 30s matchmaking, < 3s map load |
| Cost Optimization | < $0.05 per player-hour, 30%+ cost reduction YoY, 70%+ infrastructure utilization |
| Sustainability | 50%+ renewable energy regions, ARM instances where possible, < 2GB RAM usage |
Technology Choices
Some of the proposed AWS technology stack by the agent (I skipped some of the boring parts for clarity):
Game-Specific Services
| Technology | Use Case | NFR Mapping |
|---|---|---|
| Amazon GameLift FlexMatch | Skill-based matchmaking with custom rulesets | < 30 second matchmaking, fair matches |
| Amazon IVS (Interactive Video Service) | Live streaming for tournament observation (ghost mode) | Low-latency streaming for spectators |
| Amazon Chime SDK | Voice chat for proximity-based communication | Real-time voice with spatial audio |
Compute Performance
| Technology | Use Case | NFR Mapping |
|---|---|---|
| EC2 C6g/C7g Instances (Graviton3) | ARM-based game servers for better price/performance | 40% better performance per dollar |
| EC2 C6i/C7i Instances | Intel-based game servers for single-threaded performance | High clock speed for game physics |
| EC2 G5 Instances | GPU-based instances for server-side rendering, AI opponents | GPU acceleration for complex physics |
| Lambda Provisioned Concurrency | Eliminate cold starts for critical paths (matchmaking, authentication) | < 10ms response time |
| Lambda SnapStart (Java) | Faster cold starts for Java-based services | 10x faster Lambda startup |
Data Resilience
| Technology | Use Case | NFR Mapping |
|---|---|---|
| Amazon DynamoDB Global Tables | Multi-region, active-active database for player profiles, inventories | < 100ms read/write latency globally, 99.999% availability |
| DynamoDB Point-in-Time Recovery | Continuous backups for 35 days | RPO of seconds, recover from accidental deletes |
| Amazon Aurora Global Database | Multi-region relational database for transactional data (payments) | Cross-region replication < 1 second lag |
| Amazon ElastiCache (Redis) | Session state, leaderboards, matchmaking queue | Sub-millisecond latency, 99.99% availability |
| Amazon S3 | User-generated content (maps, weapons), game assets | 99.999999999% durability, 99.99% availability |
| S3 Cross-Region Replication | Replicate UGC and assets to multiple regions | Disaster recovery, local access |
| AWS Backup | Centralized backup management for all AWS resources | Automated backup scheduling, compliance reporting |
Cost Estimates
The agent even included a cost estimate for the stack of choice.
Monthly Cost Breakdown
| Service Category | Estimated Monthly Cost |
|---|---|
| Compute (GameLift, Lambda, ECS) | $80,000 |
| Database (DynamoDB, Aurora, ElastiCache) | $30,000 |
| Storage (S3, EBS) | $10,000 |
| Data Transfer (CloudFront, outbound) | $25,000 |
| API Gateway (WebSocket, REST) | $15,000 |
| Monitoring (CloudWatch, X-Ray, Grafana) | $5,000 |
| Security (WAF, Shield Advanced, GuardDuty) | $5,000 |
| Other (Cognito, SNS, SQS, etc.) | $5,000 |
| TOTAL | ~$175,000/month |
Cost per player-hour: ~$0.04 (within target of < $0.05)
Optimization opportunities:
- Use Spot instances for game servers: 40% savings on compute
- Reserved Instances for baseline capacity: 30% additional savings
- Optimize data transfer with better CDN caching: 20% savings
Putting all to a diagram
Now, diagramming capabilities are quite limited, but they're still valuable if we want to evaluate multiple choices or get an early draft visualized. Let's do this!
Further improvements
We can even extend this agent with various skills. This can include a Markdown-formatted ADR template, so you can formulate all the wisdom collected by an agent into a set of decision records. I'll do this later in another article with the introduction of additional skills.





Top comments (0)