- Custom C# agent — you own the LLM orchestration and want MCP tools to be part of a larger workflow. Recommended when you need latency, auth, or retry control.
- Azure AI Foundry — you want the Foundry Responses API or Agent service to handle orchestration, with the MCP server plugged in as a tool provider.
- A scoped environment client key (
Query API+MCP Serverat minimum). See the Overview. - The production endpoint
https://mcp.query.enterspeed.com/— the root URL, withhttptransport. There is no separate/sseendpoint.
Part 1 — C# agent (MCP client SDK)
Agents talk to the Enterspeed MCP server over MCP Streamable HTTP. In C#, the most direct client is the officialModelContextProtocol NuGet package — it opens the connection, negotiates the protocol, lists tools, and lets you call them. Authentication is a single x-api-key header on the transport.
The transport class is named
SseClientTransport for historical reasons. Pointed at the root URL, as below, it speaks Streamable HTTP — you do not need a separate /sse endpoint, and there isn’t one.Prerequisites
dotnet user-secrets (never commit them):
Program.cs
enterspeed_query tool, and one query_<indexName> tool per index you have access to) and then prints the result of the first tool call.
Driving it from an LLM (tool-use loop)
To turn this into an LLM-driven agent, hand thetools list to the model of your choice. The pattern is identical for every major LLM provider:
- Call
ListToolsAsync()once per session and cache the result. - Send the tool schemas to the LLM alongside the user prompt.
- When the LLM emits a tool call, invoke
mcpClient.CallToolAsync(name, args)and feed the response back in the next turn. - Repeat until the LLM produces a final answer.
Alternative — the Anthropic Remote MCP connector
If you prefer to let Claude open the MCP connection itself via the inlinemcp_servers feature of the Messages API, you can — but note that Anthropic’s spec currently only supports an Authorization: Bearer <token> header on the upstream MCP server; it does not let you set a custom header name. The Enterspeed MCP server reads x-api-key, so the inline connector does not work with a raw scoped key today.
Workarounds:
- Pass the key as an
?apiKey=query-string parameter on the MCP URL (supported by the server, but the key ends up in request logs — acceptable for prototyping only). - Use the explicit
ModelContextProtocolclient above and drive the tool-use loop yourself.
Alternative — Semantic Kernel plugin
If you use Microsoft.SemanticKernel, turn every MCP tool into aKernelFunction:
Part 2 — Azure AI Foundry (step-by-step)
Azure AI Foundry’s Responses API and Agent service can attach an MCP server as a tool provider. The flow is: your code → Foundry (withmcp_servers in the request) → MCP server → Query API.
Step 1 — Create an AI Foundry project
- In the Azure portal, create an AI Foundry resource.
- Inside it, create a project — e.g.
enterspeed-mcp-demo. - Pick a region that supports the Responses API with MCP tool calling.
swedencentralis EU-based and supported;eastusis the most feature-complete. - Deploy a model.
gpt-4ois a good starting point; Claude models (claude-sonnet-4) are also available onswedencentral.
Step 2 — Create a service principal
appId, password, and tenant.
If the subscription owner has not granted the service principal the Azure AI User role on the AI Services account, no MCP-enabled API call will succeed. This is the most common failure mode.
Step 3 — Configure secrets
Step 4 — Call the Responses API with MCP attached
Step 5 — Validate end-to-end
Run this known-good smoke sequence:- “List my Enterspeed indices” — expect an index-listing tool call, then a list in the response.
- “Describe index
<name>” — expect adescribe_indexcall with fields grouped by type. - A domain-specific question — expect one or more
query_*tool calls and a synthesised answer.
Query API scope. The tool was listed (because MCP Server is present) but the call is rejected by the Query API.
Foundry Agent service (alternative)
Foundry also has a persistent Agent service. The MCP wiring is identical (anmcp tool with server_url and headers) but the agent persists across calls. Use it when you want a long-running conversation with the same tool set attached. The same Entra ID requirement applies.
Custom domain / enterprise note
If you are proxying the MCP server behind your own domain:- The Query API still validates the scoped key — the proxy must forward
x-api-keyverbatim. - The proxy must support HTTP streaming (chunked / SSE). Several AWS ALB and classic CDN configurations do not by default.
- The MCP transport is Streamable HTTP over HTTP/1.1. Check your hop-by-hop limits before forcing HTTP/2.
Troubleshooting
Next steps
- Connecting a client — VS Code, Claude Code, Claude Desktop, and the Anthropic Messages API in C#.
- Overview — sample prompts and the full scope table.