# MCP server for my elastic search which is on cloud

**URL:** <https://discuss.elastic.co/t/mcp-server-for-my-elastic-search-which-is-on-cloud/380416>\
**Category:** Elastic Search\
**Created:** [July 24, 2025, 8:55am UTC](https://discuss.elastic.co/t/mcp-server-for-my-elastic-search-which-is-on-cloud/380416 "2025-07-24T08:55:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ravitejavemula333](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ravitejavemula333/32/138623_2.png) [@ravitejavemula333](https://discuss.elastic.co/u/ravitejavemula333)\
**Post date:** [July 24, 2025, 8:55am UTC](https://discuss.elastic.co/t/mcp-server-for-my-elastic-search-which-is-on-cloud/380416/1 "2025-07-24T08:55:01Z")

</div>

I am trying to setup MCP server for my elastic database which is on cloud. I want to connect to it using langchain. Is there any best for example for it

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [July 25, 2025, 9:44am UTC](https://discuss.elastic.co/t/mcp-server-for-my-elastic-search-which-is-on-cloud/380416/2 "2025-07-25T09:44:48Z")

</div>

Hi @ravitejavemula333,

Welcome back! To confirm, are you using [mcp-server-elasticsearch](https://github.com/elastic/mcp-server-elasticsearch)? Are you using LangChain JS or Python?

Generally to connect to any MCP server using [LangChain MCP adapters](https://changelog.langchain.com/announcements/mcp-adapters-for-langchain-and-langgraph).

Hope that helps!

---

<div class="post-metadata">

**Author:** ![ravitejavemula333](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ravitejavemula333/32/138623_2.png) [@ravitejavemula333](https://discuss.elastic.co/u/ravitejavemula333)\
**Post date:** [July 29, 2025, 5:50pm UTC](https://discuss.elastic.co/t/mcp-server-for-my-elastic-search-which-is-on-cloud/380416/3 "2025-07-29T17:50:15Z")

</div>

Hi,  
Yes i am using [GitHub - elastic/mcp-server-elasticsearch](https://github.com/elastic/mcp-server-elasticsearch)  
i am able to connect to mcp server, but not getting expected results, it is failing to extract the query and failing to get correct fields.  
i think i need to write a prompt.  
do you have any examples?

---

<div class="post-metadata">

**Author:** ![JD\_Armada](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jd_armada/32/142652_2.png) [@JD\_Armada](https://discuss.elastic.co/u/JD_Armada)\
**Post date:** [July 29, 2025, 7:20pm UTC](https://discuss.elastic.co/t/mcp-server-for-my-elastic-search-which-is-on-cloud/380416/4 "2025-07-29T19:20:58Z")

</div>

> [@ravitejavemula333](#):
>
> Hi,  
> Yes i am using [GitHub - elastic/mcp-server-elasticsearch](https://github.com/elastic/mcp-server-elasticsearch)  
> i am able to connect to mcp server, but not getting expected results, it is failing to extract the query and failing to get correct fields.  
> i think i need to write a prompt.  
> do you have any examples?

Hey @ravitejavemula333 ,  
Happy to hear that you were able to to connect to the Elasticsearch MCP server, that's a good starting point. Two things to consider if you are not getting the results you want.

1. **Model choice is super important:** Which LLM are you using? Some models are much better at following instructions and calling tools than others especially lightweight ones. Consider testing different models to see if your output improves. If possible, start with the larger models like GPT or Claude to pinpoint whether the model choice is the main blocker.

2. **You need a better system prompt:** Like you mentioned, you probably want to tweak your system prompt and be explicit in the instructions you give it. I would start with trying out different models first as this will also affect how effective your system prompt is. This also makes it hard to provide examples as you need to tune them to each model.

Some general tips when building a system prompt:

- Define the role and objective
- Be explicit when defining capabilities like which tools to call for which actions and what to expect in terms of the output of the tool
- Set boundaries like, "only use this index" or "only use this tool for this action" or "Don't make up any information"
- Give it a list of step by step instructions of the workflow you expect it to follow
- Provide a sample final output

Hope this helps, let us know how it goes!

---

<div class="post-metadata">

**Author:** ![ravitejavemula333](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ravitejavemula333/32/138623_2.png) [@ravitejavemula333](https://discuss.elastic.co/u/ravitejavemula333)\
**Post date:** [July 31, 2025, 7:13am UTC](https://discuss.elastic.co/t/mcp-server-for-my-elastic-search-which-is-on-cloud/380416/5 "2025-07-31T07:13:50Z")

</div>

Hi thank for the reply.

1. right now i am testing with mistral and llama, mistral is better i feel
2. Yes, i have added system prompt, then somehow i am getting expected results, but still needs to tuned.
3. Major concern is i have some fields which are keyword types, so i want to get the enum values from the field and i should be able to match those values with the user query. so that it helps a lot, It would be good if we have such tool which can give all enum values.

---

<div class="post-metadata">

**Author:** ![tarun-ghcp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tarun-ghcp/32/144783_2.png) [@tarun-ghcp](https://discuss.elastic.co/u/tarun-ghcp)\
**Post date:** [August 26, 2025, 12:02pm UTC](https://discuss.elastic.co/t/mcp-server-for-my-elastic-search-which-is-on-cloud/380416/6 "2025-08-26T12:02:00Z")

</div>

Hi Ravi, Could you please share what is the label value for mcp server. I am specifying localhost:8080/mcp as server but when initializing the MCPTool, its asking for label.

---

<div class="post-metadata">

**Author:** ![ravitejavemula333](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ravitejavemula333/32/138623_2.png) [@ravitejavemula333](https://discuss.elastic.co/u/ravitejavemula333)\
**Post date:** [August 28, 2025, 8:51am UTC](https://discuss.elastic.co/t/mcp-server-for-my-elastic-search-which-is-on-cloud/380416/7 "2025-08-28T08:51:23Z")

</div>

could you please elaborate your query ?

---

<div class="post-metadata">

**Author:** ![tarun-ghcp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tarun-ghcp/32/144783_2.png) [@tarun-ghcp](https://discuss.elastic.co/u/tarun-ghcp)\
**Post date:** [August 28, 2025, 1:24pm UTC](https://discuss.elastic.co/t/mcp-server-for-my-elastic-search-which-is-on-cloud/380416/8 "2025-08-28T13:24:12Z")

</div>

I was following this link learn.microsoft. com/en-us/azure/ai-foundry/agents/how-to/tools/model-context-protocol-samples?pivots=python to access a MCP server exists locally but couldn’t find what value should give for label. But lately found that it could be anything that client can provide.
