import { McpClient } from "iagenify";
const client = new McpClient({ url: "https://mcp.example.com/sse", token, name: "example" });
await client.initialize();
const tools = await client.listTools();
const result = await client.call("search_docs", { query: "retry policy" });from iagenify import McpClient
client = McpClient("https://mcp.example.com/sse", token=token, name="example")
client.initialize()
tools = client.list_tools()
result = client.call("search_docs", {"query": "retry policy"})
client.close()urlstringrequiredThe server's address.
tokenstring|nullnullCleaned on the way in — surrounding spaces, quotes and a copied « Bearer » are removed.
namestring"mcp"Used to prefix tool names and in the header the specification asks for.
fetchImplfunctionA fetch of your own, for a runtime that needs it.
The methods
| Call | Does |
|---|---|
| initialize() | Shakes hands and agrees a revision. |
| listTools() | Every tool, paginated. |
| call(name, args) | Runs one. |
And the pure helpers
| Export | Does |
|---|---|
| sanitizeSchema() | A tool schema reduced to what providers accept. |
| toolNameFor() | The prefixed, trimmed tool name. |
| createMcpTools() | Servers into engine-shaped tools. |
MCP_PROTOCOL_VERSION | The revision this client prefers. |
It knows nothing about the account
Those belong to api.mcp. Holding the client directly means the address is yours to vet — which is fine for a server you wrote, and a bad idea for one a user typed.
Nothing to close
The revision this client prefers made the protocol core stateless: a call is an ordinary request and response. There is no connection to keep open and nothing to resume after a restart.