Inspect an MCP server before granting an AI agent access
An MCP connection gives an assistant a set of tools. Before granting it access to a business account, it helps to answer three questions: what can these tools do, what inputs do they expect, and which ones change state?
An MCP connection gives an assistant a set of tools. Before granting it access to a business account, it helps to answer three questions: what can these tools do, what inputs do they expect, and which ones change state?
Infinite Audience exposes its MCP tool definitions publicly so developers can inspect that contract before connecting an account. The same registrations produce the authenticated catalog, with the authenticated response filtered to the scopes a user grants.
This walkthrough reads public metadata only. It does not run a discovery query, read customer records, or create a segment.
1. Inspect the public tool catalog
The hosted Streamable HTTP endpoint is:
https://mcp.infiniteaudience.ai/mcp
For a quick HTTP inspection of this endpoint, send a JSON-RPC tools/list request. This Python example uses only the standard library and handles either a JSON response or an SSE data message:
import json
import urllib.request
endpoint = "https://mcp.infiniteaudience.ai/mcp"
payload = {
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list",
"params": {},
}
request = urllib.request.Request(
endpoint,
data=json.dumps(payload).encode("utf-8"),
headers={
"Content-Type": "application/json",
"Accept": "application/json, text/event-stream",
},
method="POST",
)
with urllib.request.urlopen(request, timeout=30) as response:
content_type = response.headers.get("Content-Type", "")
raw = response.read().decode("utf-8")
if "text/event-stream" in content_type:
messages = [
line.removeprefix("data:").strip()
for line in raw.splitlines()
if line.startswith("data:")
]
candidates = [json.loads(message) for message in messages]
reply = next(message for message in candidates if message.get("id") == 1)
else:
reply = json.loads(raw)
if "error" in reply:
raise RuntimeError(reply["error"])
for tool in reply["result"]["tools"]:
annotations = tool.get("annotations", {})
print(tool["name"])
print(" ", tool.get("description", ""))
print(" read-only:", annotations.get("readOnlyHint", "unspecified"))
print(" destructive:", annotations.get("destructiveHint", "unspecified"))
print(" external interaction:", annotations.get("openWorldHint", "unspecified"))
print(" inputs:", json.dumps(tool["inputSchema"]))
if "outputSchema" in tool:
print(" outputs:", json.dumps(tool["outputSchema"]))
print()
if reply["result"].get("nextCursor"):
print("More tools are available; pass nextCursor as params.cursor.")
This is a small inspector for Infinite Audience's public metadata endpoint, rather than a general-purpose MCP client. For an application or interactive assistant, use a compatible MCP client that manages initialization, transport and OAuth.
The response describes the current server, so the example does not depend on a copied tool count or a catalog embedded in this article.
2. Read behavior as well as names
A tool name is not its complete contract. Inspect its description, input schema, output schema when present, and annotations together.
-
readOnlyHintdescribes whether the tool has side effects. -
destructiveHintdescribes potentially destructive changes. -
openWorldHintidentifies interaction outside the server's own first-party environment.
These are useful planning signals. They do not replace authorization checks or the user's approval for an action.
For Infinite Audience, a segment describes a population, an audience combines saved segments for delivery, and a delivery is an output operation. Understanding those distinctions helps an assistant choose the right next step.
3. Connect an account when you need to execute
Public tool definitions do not grant access to data. Every Infinite Audience tools/call request requires authentication and the tool's required scope.
Configure the hosted endpoint in your MCP-compatible assistant and follow its OAuth flow. Start with the scopes you need. Discovery access permits exploration, while creator access enables operations such as saving segments, matching and delivery. Discovery is not a promise that every tool is side-effect-free.
A useful first prompt is:
Inspect the available Infinite Audience tools and explain their inputs and side effects. Help me plan an audience exploration workflow. Do not create, match, enrich, refresh or deliver anything until I approve the specific action.
4. Discover field values before constructing filters
Once connected, use get_field_catalog to inspect field names, supported operators, coded values and which fields support filtering. Follow pagination instead of assuming the first response is the entire catalog.
For example:
Find the supported ZIP Code, State and age fields. Show me their exact field names, formats and operators. Then propose conditions for adults aged 35 and over in ZIP Code 10001. Do not run the count yet.
After reviewing the conditions, you can authorize an unsaved population count. An unsaved preview and a saved segment are different operations; ask the assistant to explain which it intends to use. Matching and delivery use organization subscription capacity and should have a separate approval step.
The important pattern is to build against the published contract: inspect tools, discover field metadata, construct valid inputs, then approve execution.
Resources
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.