PEA Tracker Shows How MCP Can Sit Beside REST in an AI-Connected Application
PEA Tracker uses API-first design, hexagonal architecture and server-side authorization to connect an AI assistant with portfolio data without giving the model direct control over approvals.

Key takeaways
PEA Tracker treats MCP as an adapter that shares application services with REST.
The project evolved from read-only portfolio access into transaction proposals with separate, server-enforced approval.
Cloudflare Workers, D1, TypeScript and Hono support the application, while Python and GitHub Actions handle quote collection.
Single-use, expiring proposals and distinct request audiences keep authorization outside the AI assistant.
Connecting an AI assistant to an investment portfolio quickly became a broader application-design problem for the creator of PEA Tracker. The initial goal was to let an assistant monitor and analyse a portfolio without repeatedly sharing broker screenshots or manually refreshing data. Building that connection required more than an MCP endpoint: it also required data ingestion, persistence, authentication, access control, financial rules and production-oriented safeguards.
PEA Tracker is structured around API-first design and hexagonal architecture. Its REST and Model Context Protocol (MCP) interfaces call the same application services, while the business rules are kept separate from both the interfaces and the database. In this design, MCP is an adapter alongside REST rather than a replacement for the application core.
Starting with communication, then adding capability
The first proof of concept exposed a simple ping tool to confirm that an AI client and MCP server could communicate. V1.0 then added read-only access to financial instruments, positions, available cash, market quotes and portfolio valuation. V1.1 introduced the ability to record transactions that had already occurred at the broker, along with an approval mechanism that does not depend on the AI assistant.
One early usability problem came from a portfolio-reading tool that required an identifier the assistant could not reliably find. Adding a separate portfolio-listing tool addressed that discovery problem without weakening the access-control model. By V1.1.5, the server exposed 19 MCP tools.
PEA Tracker does not place market orders. Instead, an assistant can prepare a transaction proposal, while the portfolio owner signs in through a browser, checks the details and approves it. Preparation and approval are separate steps, and the server verifies the required conditions before recording the transaction.
Proposals are tied to the information being approved, expire after a limited period and can be used only once. MCP and browser requests use different audiences, and authorization remains a server responsibility rather than an instruction delegated to the language model. The workflow uses OAuth 2.0 and Cloudflare access controls.
Infrastructure and data boundaries
Cloudflare Workers and D1 were selected to keep infrastructure spending close to zero without operating a server. Although Python and FastAPI were considered, integration constraints with Workers led to TypeScript and Hono for the application backend. Python remains in use for collecting market quotes with yfinance through GitHub Actions.
Market-data ingestion is separated from portfolio queries because the two activities have different responsibilities and authorization needs. During that work, a direct curl request succeeded while the Python request received HTTP 403. Adding certifi and changing the User-Agent allowed the script to run, although the original reason for the rejection remained unclear.
The approval flow was tested with a real transaction, but not every failure, concurrency or replay condition had been exercised in production. That limitation is important for teams treating MCP as an application boundary: a working tool connection is only the beginning of the security and reliability design.
Why it matters for your role
Pick the building you work in.

For software engineers
The project demonstrates a practical way to add MCP without duplicating business logic: expose a separate adapter over shared application services and keep rules independent of transport and storage.

For QA engineers
The transaction workflow includes expiry, one-time use and server-side condition checks, but the source notes that all failure, concurrency and replay cases had not been tested in production.

For AI and ML practitioners
AI tools can prepare actions without receiving final authorization. The application, rather than the model, remains responsible for identity, audience checks and approval enforcement.
Based on reporting by DEV Community (source article).
Written with AI assistance and reviewed under our editorial standards. Spotted an error? Tell the desk.








Comments