Query a million trades in natural language with AWS Quick and Elastic Agent Builder MCP server
A portfolio analyst uses AWS Quick to rank a month of market-moving events in Elasticsearch and chart a 10.7% intraday drop against the 8-K that caused it, over the Elastic Agent Builder MCP server.
Agent Builder is available now GA. Get started with an Elastic Cloud Trial, and check out the documentation for Agent Builder here.
Review the populated Name, Command, and Arguments fields, and add a description. Choose Test connection. AWS Quick asks for permission to run the command. Then choose Add server.With 30 minutes to prepare an investment committee report, a portfolio analyst uses AWS Quick to rank September 2026 market-moving events and tie each to its corresponding U.S. Securities and Exchange Commission (SEC) filing in under two minutes, without writing any Elasticsearch Query Language (ES|QL). Behind the chat, the Elastic Agent Builder Model Context Protocol (MCP) server connects via OAuth 2.1 to 1,004,837 trades, 24 companies, and 29 SEC filing excerpts in Elasticsearch. From there, a single follow-up question charts a 10.7% intraday drop with the Form 8-K filing time marked directly on the graph.
Elastic Agent Builder tools can be crafted as parameterized ES|QL that run under the hood during trading session hours, calculate volume-weighted average price (VWAP), or provide volume baselines. With these tools, the agents can spend their efforts answering a user's question rather than rediscovering the data model. Your private data is shielded from large language models (LLMs), even when you’re using a bigger context window. More tokens mean more noise, higher latency, higher cost, and a greater chance of missing the one document that matters.
In this post, we walk through how to build this workflow from scratch, from loading the sample dataset into Elasticsearch and defining nine curated Elastic Agent Builder tools to registering an OAuth client for the Elastic Agent Builder MCP server, configuring the connector in AWS Quick, and running the analyst session.
Prerequisites
Before you begin, make sure that you have:
An AWS account.
AWS Quick with an Author Pro subscription, and the AWS Quick desktop app installed on macOS or Windows.
An Elastic Cloud Serverless (Serverless) project (Elasticsearch). OAuth for the MCP server is available on Serverless projects only; Elastic Cloud Hosted (ECH) deployments on version 9.2 or later can use an API key instead. See the Elastic Agent Builder MCP server documentation.
Python 3.11 or later and Git, to load the sample data.
Node.js 18 or later on the analyst's machine. The AWS Quick connector runs the
mcp-remoteadapter withnpx.Permission in the Serverless project to create indices and Elastic Agent Builder tools; and the Elastic Agent Builder Read privilege to create an OAuth client.
We tested in October 2026 with the latest Serverless, AWS Quick desktop app 1.1, Python 3.13, Node.js 20, and mcp-remote 0.14.3.
How AWS Quick connects to Elasticsearch through the Agent Builder MCP server
Figure 1: AWS Quick connects to Elastic through the Agent Builder MCP server.
The request flow has four steps:
The analyst asks a question in AWS Quick chat.
AWS Quick selects tools from the Agent Builder MCP server connector. The connector runs
mcp-remoteon the analyst's machine, which signs in to Elastic with OAuth 2.1 and forwards MCP requests over HTTPS to the Agent Builder MCP endpoint in Kibana.Agent Builder runs the tool (an ES|QL query, a semantic search over filings, or a curated tool) with the analyst's own Elastic permissions.
Elasticsearch returns the results. AWS Quick reasons over them and answers in natural language. It also renders charts on request.
About the sample dataset: One million trades in Elasticsearch
The sample repository generates synthetic data for 24 fictitious companies across 10 sectors, covering the 21 trading sessions of September 2026. All companies, tickers, prices, and filings are invented. A fixed random seed means that you get the same numbers shown in this post.
Index | Documents | Purpose |
|---|---|---|
| 1,004,837 | Tick data: Time (UTC), symbol, sector, price, size, notional, side, venue, block flag |
| 24 | Fundamentals in a lookup index, joined to trades with ES|QL |
| 29 | Forms 10-K, 10-Q, and 8-K excerpts in a semantic_text field for semantic search |
The generator plants nine market events for the analyst to discover. For example:
An export-control disclosure drops Novalight Semiconductor (NVLT) 10.7% intraday.
A drug approval lifts Vitrexa Therapeutics (VTRX) after two days of one-sided block buying.
A regional bank credit warning hits Harborview Bancorp (HRBR) and pulls down an office real estate investment trust (REIT) with it.
Step 1: Load the sample market data into Elasticsearch
Clone the repository, and install the Python dependencies:
git clone https://github.com/aws-samples/aws-generativeai-partner-samples.git
cd elastic/integrations/elastic-quick-integration
python3 -m venv .venv && source .venv/bin/activate
pip install -r scripts/requirements.txt
cp .env.example .env # set ELASTIC_URL, KIBANA_URL, ELASTIC_ADMIN_API_KEY
python scripts/01_create_indices.py # --recreate rebuilds only these three indices
python scripts/02_load_data.py # about 30 seconds; --trades N to resizeEdit .env with three values before you run the scripts:
ELASTIC_URL, your project’s Elasticsearch endpoint, on the project overview page.KIBANA_URL, your project’s Kibana endpoint, on the same page.ELASTIC_ADMIN_API_KEY, an API key that can create indices and Elastic Agent Builder tools.
The .gitignore file excludes .env, so your credentials stay out of source control.
ELASTIC_URL=https://<project>.es.<region>.aws.elastic.cloud:443
KIBANA_URL=https://<project>.kb.<region>.aws.elastic.cloud:443
ELASTIC_ADMIN_API_KEY=<setup API key>Create the three indices. The trades mapping stores prices as double and precomputes notional, so ES|QL can calculate VWAP as SUM(notional) / SUM(size):
PUT trades
{
"mappings": {
"dynamic": "strict",
"properties": {
"time": { "type": "date" },
"sym": { "type": "keyword" },
"sector": { "type": "keyword" },
"price": { "type": "double" },
"size": { "type": "integer" },
"notional": { "type": "double" },
"side": { "type": "keyword" },
"exchange": { "type": "keyword" },
"is_block": { "type": "boolean" }
}
}
}The companies index uses "index.mode": "lookup" so that ES|QL can enrich trades with fundamentals at query time, and filings stores excerpt text in a semantic_text field, which generates embeddings at ingest time. The script creates all three:
python scripts/01_create_indices.py
python scripts/02_load_data.pyLoading takes about 30 seconds and ends with these counts:
companies: 24 docs
filings: 29 docs
trades: 1,004,837 docs in 30sTo confirm the load, run FROM trades | STATS COUNT(*) in Discover in Kibana, or run python scripts/06_validate_demo.py to print the expected answer to every demo question.
Step 2: Add domain context with curated ES|QL tools in Agent Builder
The Agent Builder MCP server exposes built-in tools, such as platform.core.search, platform.core.execute_esql, and platform.core.get_index_mapping, so any MCP client can explore the data. Curated tools add the domain knowledge that a general-purpose agent would otherwise rediscover on every question, such as session hours, VWAP, anomaly baselines, and valuation math. Each tool is a parameterized ES|QL query that you define once in Agent Builder and every MCP client reuses.
The following tool finds ticker-days whose volume is unusually high compared with that ticker's own median daily volume:
POST kbn:/api/agent_builder/tools
{
"id": "mi_volume_anomalies",
"type": "esql",
"description": "Ticker-days whose share volume is unusually high versus that ticker's median daily volume.",
"configuration": {
"query": "FROM trades | WHERE time >= TO_DATETIME(?first_day) AND time < TO_DATETIME(?last_day) + 1 day | STATS volume = SUM(size) BY sym, sector, day = DATE_TRUNC(1 day, time) | INLINE STATS median_volume = MEDIAN(volume) BY sym | EVAL volume_ratio = ROUND(volume / median_volume, 2) | WHERE volume_ratio >= ?min_ratio | SORT volume_ratio DESC | LIMIT 25",
"params": {
"first_day": { "type": "date", "description": "First trading day (ISO datetime)", "optional": true, "defaultValue": "2026-09-01T00:00:00Z" },
"last_day": { "type": "date", "description": "Last trading day (ISO datetime)", "optional": true, "defaultValue": "2026-09-30T00:00:00Z" },
"min_ratio": { "type": "float", "description": "Minimum volume / median ratio", "optional": true, "defaultValue": 2.0 }
}
}
}The repository defines nine tools in scripts/agent_tools.py. Register them with one command:
python scripts/04_create_agent_tools.pyTool | Answers questions such as |
|---|---|
| What moved the market this month? |
| How did NVLT trade on September 15, and when did the news hit? |
| Who were the top gainers? Which sectors led? |
| Was there unusual block buying before the announcement? |
| Compare P/E and EV/EBITDA for the technology names. |
| What risks did the latest 10-K add? |
MCP tool parameters of type date require a full International Organization for Standardization (ISO) datetime, such as 2026-09-15T00:00:00Z. AWS Quick can also answer every question in this post with the built-in tools alone; in the recorded session, it wrote its own ES|QL with platform.core.execute_esql.
Step 3: Create an OAuth 2.1 client for the Agent Builder MCP server
Serverless supports OAuth 2.1 for the Agent Builder MCP server. An OAuth connection acts with the permissions of the Elastic user who authorizes it. Its tokens work only with the MCP server, and it expires after 30 days without use. Register a client for AWS Quick in Kibana:
In Kibana, open Agents. Choose Tools, and select Manage all tools.
Choose Manage MCP, Manage MCP clients (OAuth), and then Add MCP client.
Enter a Client name, such as
AWS Quick desktop. Users see this name when they authorize the connection.For Redirect URI, choose Local and keep
http://localhost/oauth/callback, whichmcp-remoteuses. Keep the client public (no client secret).Save the client, and copy the client ID and the MCP server URL (
https://<project>.kb.<region>.aws.elastic.cloud/api/agent_builder/mcp).
For details, see Create or edit an OAuth client in Elastic Agent Builder.
To verify the endpoint, send an unauthenticated request. The server responds with HTTP 401 and points to its OAuth metadata, which is how MCP clients discover where to sign in:
curl -si -X POST "$KIBANA_URL/api/agent_builder/mcp" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | grep -i www-authenticate
www-authenticate: Bearer resource_metadata="https://<project>.kb.<region>.aws.elastic.cloud/.well-known/oauth-protected-resource/api/agent_builder/mcp"For automation or ECH deployments, use a scoped, read-only API key instead; scripts/03_create_api_key.py creates one limited to the three demo indices.
Step 4: Add the Agent Builder MCP server connector in AWS Quick
In the AWS Quick desktop app, add the Agent Builder MCP server as a local MCP connector:
Choose Customize, open the Connectors tab, and then choose Create to add an MCP connector.
For Connection type, choose Local, expand Paste JSON, paste the following configuration with your MCP server URL and client ID, and then choose Apply.
{
"mcpServers": {
"elastic-mcp-server": {
"command": "npx",
"args": [
"mcp-remote@0.14.3",
"https://<project>.kb.<region>.aws.elastic.cloud/api/agent_builder/mcp",
"--static-oauth-client-info",
"{\"client_id\":\"<your-client-id>\"}"
]
}
}
}Figure 2: Paste the Agent Builder MCP server configuration into a local MCP connector.
Figure 3: Add MCP screen, showing how to connect an MCP.
3. Review the populated Name, Command, and Arguments fields, and add a description. Choose Test connection. AWS Quick asks for permission to run the command. Then choose Add server.
Figure 4: AWS Quick asks for permission before it runs a local MCP server.
4. On first use, a browser window opens to the Elastic Cloud sign-in and consent page. Sign in and approve the connection. mcp-remote stores the OAuth tokens locally, so later sessions don't prompt again.
5. When the test reports Connected with the number of available tools, choose Add MCP.
Figure 5: The connection test lists the tools that the Agent Builder MCP server exposes.
Figure 6: Add MCP screen, showing how to connect an MCP.
6. Open the new Elastic MCP Server connector to set action permissions. For each tool, choose Ask each time, Always allow, or Always deny.
Figure 7: Set action permissions for each Elastic MCP tool.
Optional: Create an equity research agent in AWS Quick
The recorded session uses the default AWS Quick chat. For a reusable experience, create a chat agent for equity research. Add explicit data-scope guardrails to the system prompt, such as limiting the agent to the trades, companies, and filings indices; specific date ranges; and read-only query types.
Description: An expert-level financial research assistant and equity analyst that helps investors understand company market positions, financial health, and future potential through comprehensive analysis.
Instructions summary: Focus on providing objective, data-driven analysis of companies' financial health, competitive positioning, and growth prospects. Always consider both bullish and bearish perspectives. When discussing valuations, reference appropriate metrics, like P/E, EV/EBITDA, and sector comparisons. Highlight key risks and catalysts that could impact the investment thesis. Use only the trades, companies, and filings indices. Timestamps are UTC; present times in Eastern Time.
The repository includes the full instructions, with tool routing rules, in quick/chat-agent-config.md.
Select Chat to start interacting with your equity research assistant. The agent processes natural language queries, translates them into ES|QL, runs them against Elasticsearch through the MCP server, and returns insights.
Step 5: Run the analyst session in AWS Quick
Consider Maya, a portfolio analyst who has 30 minutes to prepare the September 2026 market review for an investment committee. She doesn't write ES|QL. The following prompts come from the recorded session. AWS Quick shows each tool call, so she can inspect the query that ran.
What data is available in Elasticsearch?
prompt
Using my Elastic MCP server endpoint, look at my trades, companies and filings information and tell me what data you have access to, and what time period it covers.
AWS Quick inspects the indices and mappings and summarizes them: 1,004,837 trades, September 1–30, 2026, during US market hours; 24 companies with fundamentals; and 29 SEC filings between May and September 2026.
Figure 8: AWS Quick discovers the data model through the MCP server.
What moved the market in September?
What were the biggest market-moving events in September? Rank them by unusual volume.AWS Quick writes and runs ES|QL against trades to build a daily volume series for each symbol. Expand any tool step to see the query and its raw result:
FROM trades
| EVAL day = DATE_TRUNC(1 day, time)
| STATS vol = SUM(size), notional = SUM(notional), trades = COUNT(*) BY sym, day
| SORT vol DESC
| LIMIT 100Figure 9: AWS Quick runs ES|QL through the Elastic Agent Builder MCP server.
AWS Quick measures each day against that symbol's median volume and searches filings for disclosures on the same days. It then ranks the results. Every top event matches a filing: the VTRX U.S. Food and Drug Administration (FDA) approval on September 24, 2026, (7.2x normal volume); the NVLT export license requirement on September 15, 2026, (4.4x); a Rover Motors (ROVR) vehicle recall (4.9x); an HRBR credit update (4.4x); and the Orchard Devices (ORCH) annual report on September 22, 2026. AWS Quick also flagged a market-wide volume surge on September 16, 2026, that had no company-specific filing.
Figure 10: Market-moving events ranked by unusual volume, each tied to a filing.
Figure 11: From question to ranked, explained events (2x speed).
How do I chart intraday price and volume?
Chart Novalight's intraday price and volume on September 15.AWS Quick builds an interactive chart with five-minute VWAP, a volume panel, and a marker at 2:10 PM ET, when the export-license 8-K was filed. The price falls from a $377.52 opening VWAP to $336.98 at the close (minus 10.7%) on 3.67 million shares. When the first render came up blank and the analyst pointed that out, AWS Quick found the missing charting module and fixed the chart. It then reopened it.
Figure 12: Intraday price and volume for NVLT, annotated with the filing time.
Figure 13: Exploring the interactive chart.
How did each sector perform in September?
How did each sector perform in September? Show it as a bar chart.Health Care led at 13.8%, driven almost entirely by VTRX. Technology and Financials trailed at minus 3.9% each, pulled down by NVLT and by HRBR and its peers. AWS Quick also noted that the equal-weighted average lets a single stock dominate small sectors, and it offered a volume-weighted alternative.
Figure 14: September 2026 sector performance rendered by AWS Quick.
More questions to ask AWS Quick
Ask AWS Quick | What a correct answer includes |
|---|---|
Was there anything unusual in Vitrexa trading before its FDA news? | 14 block trades, all buys, on September 22 and 23 block trades (21 buys) on September 23, about $50 million in total, ahead of the approval on September 24 |
What new risks did Orchard Devices add in its latest 10-K compared with its prior 10-Q, and how did volume change that week? | Supply-chain concentration, AI regulation, and an antitrust probe; weekly volume of 6.69 million shares versus 3.15 million at the start of the month |
Compare valuations for the technology names using September 30 prices. | ORCH: $3.27 trillion market cap, P/E 31.2, EV/EBITDA 23.1; NVLT: $842 billion, P/E 35.1 |
Which regional bank warned on credit, and did it affect real estate names? | HRBR fell 7.3% on September 9 after its 8-K on office loan losses; the office REIT KEYS fell 3.6% |
Write a one-page September market brief for the investment committee, with filing citations. | A summary of the events above that cites filings, for example, "NVLT 8-K (2026-09-15)" |
All companies, tickers, prices, and filings in the sample data are fictitious, so the numbers don't reflect real market behavior. AWS Quick's own analysis can differ from the reference answers in its rounding or method. The point is the workflow; the analyst doesn’t need any SQL or ES|QL knowledge.
To check the Elastic side independently of AWS Quick, run python scripts/08_e2e_mcp_tests.py. It connects over OAuth the same way that the connector does and makes the tool calls behind each question. It also checks the answers.
How does Elastic combine SEC filings with trade data?
Elasticsearch also searches unstructured text, so the same agent can combine trade data with documents. The filings index that you loaded in Step 1 stores excerpts in a semantic_text field, which generates embeddings at ingest time.
Ask a question that needs both sources, such as, What new risks did Orchard Devices add in its latest 10-K, and how did its trading volume change that week? The agent uses mi_filings_search or platform.core.search to retrieve the relevant filing passages, and it runs ES|QL against trades for the volume. It answers with both, citing the filing. This chained retrieval is agentic retrieval augmented generation (RAG); the agent decides which source to query and in what order, and it combines the results.
Security considerations for the Agent Builder MCP connection
Least privilege: An OAuth connection acts with the permissions of the Elastic user who authorizes it. Create a custom role with read access to the trades, companies, and filing indices, plus the Agent Builder read privilege, and authorize the connection as a user that holds only that role. Elastic enforces these permissions even if a prompt tries to steer the agent elsewhere.
Secrets: The connector configuration contains only a public client ID, with no client secret or API key.
mcp-remotestores OAuth tokens on the analyst's machine. If a device is lost or a user leaves, revoke the app connection in Kibana. Keep the setup API key in.envout of source control, and rotate it after you load the data.
Network: The local connector calls Elastic over HTTPS from the analyst's machine. Restrict which networks can reach the project with Elastic Cloud network security, such as IP filtering or AWS PrivateLink.
Auditing: Enable AWS CloudTrail for AWS Quick activity, and use Elastic audit logging for query-level visibility. Review active app connections in Kibana.
Review before run: Connector action permissions let users approve each tool call before it runs, which gives analysts a chance to inspect the generated query. Set tools that the demo doesn't need, such as the workflow tools, to Always deny.
Local execution: As the AWS Quick consent dialog states, a local MCP server runs with full access to the user's file system and network. Install only trusted packages, and pin the
mcp-remoteversion.
How to remove the Elastic MCP connector and demo indices
To remove the resources that you created in this walkthrough:
1. In AWS Quick, open Customize, Connectors, and delete the Elastic Mcp Server connector.
2. In Kibana, revoke the app connection and delete the OAuth client under Manage MCP clients (OAuth).
3. Delete the Agent Builder tools and the demo indices:
python scripts/04_create_agent_tools.py --delete
curl -X DELETE "$ELASTIC_URL/trades,companies,filings" -H "Authorization: ApiKey $ELASTIC_ADMIN_API_KEY"4. Invalidate the setup API key. If you created the Serverless project only for this walkthrough, delete the project in the Elastic Cloud console.
Conclusion: Querying Elasticsearch without ES|QL
Financial services firms face a significant challenge in democratizing access to market data. Querying high-volume time-series data requires specialized knowledge of query languages. With MCP integration in AWS Quick, using the Agent Builder MCP server with OAuth 2.1, analysts can explore market data and identify trends, as well as combine structured data with unstructured documents through conversation, without writing queries or understanding the underlying data model.
To try it, clone the sample repository, and see the documentation for AWS Quick MCP integration and the Elastic Agent Builder MCP server.
How helpful was this content?




