Inspiration
Travel planning is fragmented...
As developers, we lose 20% of our time writing Pull Request (PR) descriptions. We currently bounce between our terminal, git logs, error files, and a blank PR template. Existing AI tools only generate code—they don't understand the context of our local environment.
I wanted to move beyond a "chatbot that talks" to an agent that acts. Inspired by the Model Context Protocol (MCP), I built FlowState, a context-aware copilot. It doesn't just generate text; it autonomously orchestrates local system tools to solve a complex problem: drafting a perfect PR based on your actual Git state and error logs.
What it does
FlowState is a self-hosted MCP server with a sleek, dark-mode web interface. When a developer types "Draft a PR for my current work", the agent autonomously:
- Inspects Git Context: Fetches the current branch, last 3 commits, and staged files.
- Analyzes Error Logs: Parses recent terminal warnings and errors to understand what was fixed.
- Generates PR Draft: Synthesizes this local context using an LLM (AWS Bedrock or local Ollama) to generate a highly accurate, markdown-formatted PR description (Summary, Technical Changes, Testing Notes).
How we built it
We built a strict Agentic Loop using Node.js, TypeScript, and the @modelcontextprotocol/sdk (MCP spec).
- The MCP Server: Exposes 3 custom tools (
get_git_context,get_recent_errors,generate_pr_draft). It uses Node'schild_processto execute real Git commands andfsto read logs. - The Intelligence Layer: Powered by AWS Bedrock (Claude 3.5 Sonnet) with an Ollama fallback for offline reliability. The system prompt strictly enforces "Tool-Use-Only" to prevent AI hallucinations.
- The UI: A blazing-fast React frontend (via CDN) with Tailwind CSS, featuring a live "Tool Call Trace" so users can watch the agent think in real-time.
Challenges we ran into
- The "Hallucination" Trap: Early versions of the agent guessed git branches instead of checking them. We solved this by strictly defining the JSON schema for the tools and forbidding the LLM from generating factual data without a tool call.
- Git Command Failures: If a repo was clean, the
git diffcommand returned empty, crashing the agent. We implemented a robusttry/catchfallback mechanism that gracefully degrades to realistic mock data, ensuring a 100% reliable demo. - Context Window Bloat: Passing raw terminal logs to the LLM caused latency. We built a parser in
get_recent_errorsthat only extractsERRORandWARNlines, keeping the context lean.
Accomplishments that we're proud of
- Zero-Hallucination Context: The AI strictly relies on the real-time local file system and Git state.
- Model-Agnostic Architecture: By using MCP, we decoupled the tools from the LLM. The system works flawlessly with AWS Bedrock, and can instantly switch to a local Ollama model.
- Polished Developer UX: The UI doesn't just show a chat; it shows a visual "Tool Call Trace", proving to the user that the agent is actively reading their codebase.
What we learned
MCP is a paradigm shift. It transforms LLMs from "text generators" to "system orchestrators." We learned that prompt engineering is as critical as the code itself—specifically, how enforcing a strict JSON output schema allows for a rich, component-based UI.
What's next for FlowState
- Direct GitHub Integration: Creating the actual PR via the GitHub API instead of just drafting it.
- Multi-Repo Support: Allowing developers to switch contexts between different projects.
- Local File Watching: Using
fs.watchto proactively alert developers when their current working directory has uncommitted changes that might break the build.
Built With
- agentic-ai
- aws-bedrock
- claude-3.5-sonnet
- developertool
- express.js
- git
- model-context-protocol-(mcp)
- node.js
- ollama
- react
- tailwind-css
- typescript
Log in or sign up for Devpost to join the conversation.