Choose a retrieval interface
Glean exposes enterprise knowledge through two main retrieval interfaces: REST APIs and the Glean MCP server. Choosing the right one depends on what you are building.
Glean REST APIs
The Glean REST APIs give you direct, programmatic access to Glean functionality. You control exactly what to query, when to query it, and how to handle the response. Use the REST APIs when you are building:
- A custom search experience
- A backend pipeline that processes or aggregates Glean data
- An integration that needs deterministic, structured results
Glean MCP server
The Glean MCP server exposes Glean's capabilities as tools that an LLM can invoke. The model decides when to call a tool and what to send. The MCP server includes tools for search, chat, document retrieval, code search, people lookup, and more. Use MCP when you are building:
- An LLM-based application or agent that needs to retrieve enterprise context
- A chat experience backed by Glean's knowledge graph
- Any integration where the LLM, not your code, drives retrieval
Example: retrieving context for an LLM
A common mistake is calling the Search REST API from an LLM-based application. The Search API expects a deterministic query and returns structured results — it is not designed for the variable, rewritten queries an LLM produces.
For LLM applications, use the MCP tools instead:
| Goal | Use |
|---|---|
| Retrieve documents for an LLM to reason over | Glean MCP search tool — send the LLM-rewritten query |
| Build an end-to-end chat experience | Glean MCP chat tool — send the original user query |
| Build a custom search UI | Search REST API — send the user query directly |
For a full list of available MCP tools, see the MCP documentation.