DEV Community

Hanieh Zahiremami
Hanieh Zahiremami

Posted on

Automate Research & Analysis Workflows Across Any Domain with `mcp-agent`

I’ve been using this agentic framework to automate both personal and work-related research, everything from analyzing real estate deals and comparing healthcare options to doing deep dives for product marketing, like competitor analysis or market sizing. It’s saved me tons of time by offloading the data pulling, cross-checking, and report writing to agents that actually get the job done.

So I built a universal research agent on top of mcp-agent a framework that lets you coordinate tools, APIs, memory, and LLM calls in one streamlined workflow.

It’s modular, agentic, and fully customizable for any domain.


System architecture diagram


⚙️ What it does

This framework gives you an end-to-end research pipeline:

  • Pluggable MCP Servers for your domain’s APIs (think finance, real estate, PubMed, etc.)
  • Automatic elicitation to ask the right questions before researching
  • Evaluator agent to make sure the final report meets your quality standards
  • Web search fallback when APIs fail or miss something
  • Domain-specific analysis with insights, calculations, and summaries
  • Markdown report writer that actually sounds smart

🧠 How it works

Here’s the architecture under the hood and how to run it:

1. Clone the repo

git clone https://github.com/lastmile-ai/mcp-agent.git
cd mcp-agent/examples/usecases/mcp_research_agent
uv init && uv sync
uv add mcp-agent fastmcp aiohttp
npm i -g g-search-mcp @modelcontextprotocol/server-filesystem
Enter fullscreen mode Exit fullscreen mode

2. Set your API keys

Copy the secrets template and add your keys for your preferred domain:

openai:
  api_key: "sk-..."
environment:
  BLOOMBERG_API_KEY: "..."
Enter fullscreen mode Exit fullscreen mode

3. Configure your servers

In mcp_agent.config.yaml, set up:

  • Your domain’s custom MCP server
  • Web search fallback (g-search)
  • Filesystem server for saving reports

4. Customize agent instructions

Swap in your domain and goals:

instruction = f"""You are a {{DOMAIN}} research expert.
Use tools to gather data, fallback to web if needed.
Focus on {{INSIGHT_TYPE}} and make recommendations."""
Enter fullscreen mode Exit fullscreen mode

5. Run it like this:

uv run main.py "Austin real estate"
uv run main.py "AAPL earnings analysis"
uv run main.py "diabetes treatment comparison"
Enter fullscreen mode Exit fullscreen mode

✨ Why it’s cool

  • Auto-elicitation: Agents ask for user preferences up front
  • Evaluator agent: Iterates until the report meets brand/tone/quality
  • Built-in fallback: If APIs fail, web search steps in
  • Composable: Plug in any tool or data source, adapt to any industry
  • Markdown reports: Clean and structured output for your team

🚀 Build your own agent

Want to do legal research? Healthcare summaries? Market analysis?

All you need to change are:

  • The agent instructions
  • Your custom MCP server
  • API integrations and schemas

Everything else stays the same.


👉 The code is here: https://github.com/lastmile-ai/mcp-agent/tree/main/examples/usecases/mcp_research_agent

If you’re into automating research, orchestrating APIs, or just hate writing the same analysis reports over and over, this one’s for you.

Would love to hear what domain you’d apply this to. Drop it in the comments! 💬

Top comments (0)