Guide

API, MCP, CLI or computer use: how to connect an AI agent to your research tools

Use the lowest-level, most structured interface the job allows. That means SQL or an API for data, the command line for software, and the screen only when nothing else reaches it.

AI Fin ResearchStarter4 min read

You can connect an AI agent to your software through an API, a database connection, an MCP server, a command line or control of the screen.

Use the lowest-level, most structured interface the job allows.

For data, use the API or the database

If the data has an API or you can query the database directly, use that. You do not need MCP and you do not need computer use.

A structured query is faster, cheaper and deterministic. The same SQL returns the same rows tomorrow, and you can put the query in the replication package. A screenshot of a dashboard is a worse version of a SQL query.

For a finance researcher this covers most of the pipeline. WRDS takes SQL through its Python client. SEC EDGAR, FRED and most central bank portals have public APIs. If you can write the request, the agent can too, and it can check the row count afterward.

Use MCP when the vendor offers nothing else, or the app is the product

MCP (Model Context Protocol) is a standard way to describe tools to an AI application.

The vendor offers no other door. Several data vendors now expose their products to AI assistants as connectors, and for some of them it is the only supported route from an assistant to the data. The vendor AI map shows which ones.

The interface is the product. If you are building something where the interface is what you ship (an experiment that runs on tablets, a trading simulator, a mobile survey), the agent has to see and operate the real thing. Do not make it guess at pixels. Put an MCP server inside the app. The agent on your laptop can then drive the device directly: real actions, real state, and an answer when it asks what is on screen.

Computer use is the last resort

Computer use means the agent looks at screenshots and moves the mouse. It is the right tool when you do not own the software and there is no API: a legacy desktop program, a third-party application, a site with no integration.

It is the slowest and least reliable option, and a result that depends on where a button was drawn is hard to reproduce. Before you point an agent at a vendor terminal or portal, read the license. Many data agreements restrict automated extraction, and a screen-driving agent is still automated extraction.

If a task can be scripted, use the command line

Agents work well with text, flags and exit codes, and so do replication packages.

Most research software has a non-interactive mode even when people rarely use it:

stata -b do analysis.do      # Stata in batch mode
Rscript estimate.R           # R without the console
python pull.py --start 2000-01-01 --end 2023-12-31

Graphical interfaces are for people. Route an agent through one only when there is no other door.

Stop at the first row that fits

You have Use Why
An API or a database you can query The API or SQL Fast, cheap, deterministic, easy to replicate
A program with a batch or command-line mode The CLI Text in, text out, exit code tells you if it worked
A vendor that only offers an assistant connector MCP It is the supported route
An app you are building where the interface is the product An MCP server inside the app Real actions and state instead of pixels
Software you do not own, with no API and no CLI Computer use Nothing else reaches it

Work down the table and stop at the first row that fits. If you find yourself at the last row for a data task, look again for an export button, a bulk download or an email address for the data team. One of them usually exists.

References