Run Spanway beneath an enterprise search assistant
Many companies already run an enterprise search or knowledge assistant that indexes their documents, tickets, chat and code, and knows who may open what. Spanway does not replace it. Spanway runs on your own infrastructure beneath it and beneath the AI tools your people use, such as coding assistants, chat apps and agents. The search platform keeps doing what it is good at, finding the right company context for the right person. Spanway does the rest: it picks the model, keeps every team inside its budget, runs your guardrails on prompts and answers, and logs and audits every call. The search platform's tools reach those AI tools through the Spanway MCP gateway, and every person signs in to the search platform as themselves, so an assistant only ever finds what that person could find on their own.
A real-world scenario
An engineering organization already has an enterprise search platform connected to its wiki, ticket tracker and code hosting, and wants its coding assistants to use that knowledge. Security wants three things: model traffic must stay on the company's own gateway with per-team budgets, prompts must pass the company's guardrails, and no assistant may see a document the developer could not open. The admin adds the enterprise search connector from the Spanway catalogue with per-user sign-in and gives the engineering team's keys access to it. Each developer connects once in the browser. From then on a developer asks the assistant "how do we rotate the payments service keys?", the assistant calls the search tool through Spanway as that developer, gets back only pages that developer may read, and answers with a model Spanway routes, inside the team's budget and with the guardrails applied. The admin sees each search and each model call on the Logs page under the developer's key.
What each side does
| Job | Handled by |
|---|---|
| Indexing company content and enforcing each document's permissions | The enterprise search platform. |
| Searching, reading documents and looking up people, meetings and code for a signed-in person | The search platform's remote MCP server, reached through the Spanway MCP gateway. |
| Choosing and calling models, with fallbacks when a provider fails | Spanway routing. |
| Per-team and per-key spend limits | Spanway budgets. |
| Checking prompts, answers and tool results | Spanway guardrails and MCP guardrails. |
| Which teams and keys may use the search tools, and which tools they get | Spanway MCP access control and the read-only default of the connector catalogue. |
| Request logs, spend and the audit trail | Spanway logging and audit logs. |
Before you start
On the search platform, an administrator turns on its OAuth authorization server and its remote MCP server, and notes the MCP server address for your company. The catalogue connector is filled in with the vendor's address pattern, and you replace the {instance} part with your company's instance name. The gateway signs itself in to the search platform as an OAuth client. When the search platform allows dynamic client registration, the gateway registers itself and you enter nothing. When it does not, create a static OAuth client on the search platform with the redirect address https://<your gateway host>/ui/mcp/oauth/callback and keep its client ID and client secret for step 2.
On the gateway you need a database, because per-user tokens are stored in it, and a proxy admin key.
The connector has not yet been tested end to end against a live tenant, so it is labelled Unverified in the catalogue. Try it with one user before you roll it out to everyone.
Steps
-
Add the connector. In the Admin UI, open MCP Servers, click + Add New MCP Server, type
enterprisein the template search box and pick the Enterprise search tile from the Search category. The form is filled in with the transport, the address and Authentication set to OAuth, and a note says the server starts read-only. -
Fill in your tenant. Replace
{instance}in MCP Server URL with your instance name. Keep OAuth Flow Type at Interactive (PKCE), which gives every person their own token. Leave the client fields blank when the search platform supports dynamic client registration, or enter the static client's Client ID and Client Secret. -
Check it and save. Click Authorize & Fetch Token, sign in to the search platform in the browser window that opens, and check that the form lists the server's tools. Click Add MCP Server. The token you fetched is stored for you only, and nobody else can use it.
The same server through the API, with the address in
SEARCH_MCP_URL:curl -X POST http://localhost:4000/v1/mcp/server \-H "Authorization: Bearer $SPANWAY_MASTER_KEY" -H "Content-Type: application/json" \-d '{"server_name": "enterprise_search", "url": "'"$SEARCH_MCP_URL"'", "transport": "http", "auth_type": "oauth2", "oauth2_flow": "authorization_code", "catalog_entry": "enterprise_search"}'Expected result, with status 201, is the stored server with
"auth_type": "oauth2","oauth2_flow": "authorization_code"and"catalog_entry": "enterprise_search". When the search platform needs a static client, add"credentials": {"client_id": "...", "client_secret": "..."}to the body. -
Give the right people access. On Virtual Keys, edit a key or a team's key and pick
enterprise_searchin the MCP server picker, or grant it with the API:curl -X POST http://localhost:4000/key/update \-H "Authorization: Bearer $SPANWAY_MASTER_KEY" -H "Content-Type: application/json" \-d '{"key": "sk-developer-key", "object_permission": {"mcp_servers": ["enterprise_search"]}}'Expected result is the key with
"mcp_servers": ["enterprise_search"]in itsobject_permission. -
Each person connects once. Each person opens the gateway's connect page at
/ui/connect, for examplehttps://gateway.example.com/ui/connect, signs in to the gateway, clicks Connect next to the enterprise search server, signs in to the search platform and is sent back. A person who has not connected yet and lists tools from an assistant sees one tool,enterprise_search-connect, which hands back the connect link, as described in lazy authentication. Check a person's connection with their own key:curl http://localhost:4000/v1/mcp/server/8f1c2d3e-4b5a-4c6d-9e7f-0a1b2c3d4e5f/oauth-user-credential/status \-H "Authorization: Bearer $SPANWAY_API_KEY"Expected result:
{"server_id": "8f1c2d3e-4b5a-4c6d-9e7f-0a1b2c3d4e5f", "has_credential": true, "expires_at": "2026-11-24T10:00:00Z", "is_expired": false, "connected_at": "2026-11-24T09:00:00Z"} -
Point the AI tools at the gateway. Give each assistant two things that both go through Spanway. For models, set its OpenAI or Anthropic compatible base address to the gateway and its key to the person's virtual key, as shown in connect any client. For company context, add the gateway's MCP endpoint, as shown in MCP clients, for example in Cursor's
mcp.json:{"mcpServers": {"spanway": {"url": "http://localhost:4000/mcp","headers": {"Authorization": "Bearer ${env:SPANWAY_API_KEY}", "x-mcp-servers": "enterprise_search"}}}}The assistant then lists tools such as
enterprise_search-searchandenterprise_search-read_document. A model request through the gateway can use the same tools directly:curl -X POST http://localhost:4000/v1/responses \-H "Authorization: Bearer $SPANWAY_API_KEY" -H "Content-Type: application/json" \-d '{"model": "claude-sonnet-5-5","input": "How do we rotate the payments service keys?","tools": [{"type": "mcp", "server_label": "enterprise_search", "server_url": "spanway_proxy/mcp/enterprise_search", "require_approval": "never"}]}'Expected result is the model's answer with an
mcp_calloutput item for each search, and both the model call and the tool calls appear on Logs under the key, with their cost counted against the key's and the team's budget.
Which tools are on
Like every catalogue connector, this one starts read-only. Only tools named search, tools ending in _search (such as code_search or employee_search), read_document and tools ending in _lookup are served. Every other tool stays off until a proxy admin turns it on by name. That includes chat, which asks the search platform's own assistant for an answer, and any agent or action tool that could change something in a connected app. To turn one on, open the server, type its exact name, for example chat, under "Exact tool name" on the Tool access card of the Overview tab and click Enable write tool, or use PUT /v1/mcp/server/{server_id}/tool-policy as described in the connector catalogue. Turning a tool on helps when a team wants the search platform's own answers or actions inside its assistant. Leaving it off keeps assistants to finding and reading, which is the safe default because a prompt injection hidden in a document cannot make an assistant act through the search platform. Each change is written to the audit log.
What is recorded
Adding, editing or deleting the server, granting it to a key and changing its enabled tools each write an audit row with who made the change and the values before and after, with secrets masked, as listed in audit logs. Each person's search platform token is encrypted and stored for that person only, and deleting it with DELETE /v1/mcp/server/{server_id}/oauth-user-credential, as described in per-user credentials, cuts that person's access at once. Tool calls show on Logs with the server, the tool, the key and the cost. The search results themselves follow your logging settings, the same as model answers.
Errors
| Symptom or status | Where | Meaning | Fix |
|---|---|---|---|
400 missing_client_id with "No client_id available for this MCP server. Either configure the server with a client_id or supply one in the request." | Authorize & Fetch Token, or Connect on /ui/connect | The search platform does not allow dynamic client registration and the server has no client ID. | Create a static OAuth client on the search platform with the redirect address from Before you start and enter its client ID and secret on the server. |
| The sign-in page of the search platform shows an invalid redirect error | Browser, during sign-in | The static OAuth client does not list the gateway's redirect address. | Add https://<your gateway host>/ui/mcp/oauth/callback to the client on the search platform. |
| Card badge Unhealthy, or the form lists no tools | MCP Servers | {instance} was not replaced, the address is wrong, or the remote MCP server is off on the search platform. | Check the address against the one the search platform shows its administrators, and that the gateway can reach it. |
The assistant lists only enterprise_search-connect | Any MCP client | The person has not connected yet, or the search platform rejected their stored token. | Open the connect link, or click Connect on /ui/connect. |
403 {"error": "Tool chat is not allowed for server enterprise_search. Contact proxy admin to allow this tool."} | tools/call | The tool is off by the read-only default. | Enable it by name as described in Which tools are on, or leave it off. |
400 {"error": "Unknown catalog_entry '<x>': it must name a connector in the MCP catalogue"} | POST and PUT /v1/mcp/server | The catalog_entry is misspelled. | Use enterprise_search. |
| Client sees no tools | Any MCP client | The key has no grant for the server. | Grant it as in step 4. GET /v1/mcp/tools shows what a key ends up with. |
The connector catalogue, OAuth and MCP gateway pages list the other errors these routes can return.
Logs
This setup adds no new log lines. The lines to watch are the lazy authentication ones, for example INFO MCP list_tools: enterprise_search has no per-user credential for this caller; serving its connect tool, which is normal before a person connects, and MCP list_tools: upstream enterprise_search rejected the stored per-user credential (HTTP 401); serving its connect tool, which needs action only when many people hit it at once, usually because the OAuth client changed on the search platform. See lazy authentication and the log reference.
Related
- MCP connector catalogue for the read-only default and the other connectors.
- MCP OAuth and dynamic client registration for every OAuth setting.
- MCP per-user credentials for inspecting and deleting stored tokens.
- MCP access control for grants per key, team and client application.
- Team budgets and guardrails for the controls Spanway adds on top.