# mcp

Canonical URL: https://developers.iagenify.com/fr/sdk/agent/tools/mcp/
Language: fr

`mcp({ action: "list" | "get" | "tools" | "disconnect", server?, refresh? })`

The MCP servers connected to the account — what is plugged in, which of their tools are allowed, and what those tools cost on every turn. Connecting one is not here.

Status: read, or storage on disconnect · no token ever · declarations cost tokens

## The actions {#actions}

| Free (read) | Asked (storage) |
| --- | --- |
| `list` · `get` · `tools` | `disconnect` |

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `action` | string | required | `list` · `get` · `tools` · `disconnect`. |
| `server` | string |  | The server name, from `list`. Required by everything but `list`. |
| `refresh` | boolean |  | `get`: re-read the server's own tool list before answering. |

## Connecting is not one of the actions {#no-connect}

> **A token never passes through an agent**
>
> A connection carries an address and a token. The token is the customer's, it is encrypted at rest, and an agent is the wrong place for it — the same rule that keeps [storage.connect()](/fr/sdk/ref/storage/connect) out of the tools. The agent says where to do it instead of trying.

## Why an agent needs to see them at all {#why}

The allowed tools of a connected server are declared to the model directly, prefixed by the server name, so the agent uses them without knowing where they come from. Asked « which external tools do I have? » it had no answer, and it could not name a server whose tools this run was not given. This tool is that answer.

## What is allowed is what is billed {#cost}

Every allowed tool is declared on every turn of a run that includes its server, and a declaration costs tokens the customer pays for. That is why the allowed list is chosen at connection time and why `tools` reports what the set weighs.

## Reading is free, disconnecting is asked {#category}

Removing a server takes a capability away from the account, so it goes through the [storage](/fr/sdk/agent/permissions/categories/storage) category. Reconnecting needs the token again, which only the user has.

```javascript
mcp({ action: "list" })
// cloudflare (Cloudflare) · 4 of 11 tools allowed · category exec · mcp.example.com/sse

mcp({ action: "get", server: "cloudflare", refresh: true })
// - dns_record: Write a DNS record
// 7 tools exist on the server and are NOT allowed: the user chose that.
```

- [api.mcp](/fr/sdk/ref/mcp): Connecting, updating and calling, from your own code.
- [Agent tools](/fr/sdk/agent/tools): The 35, by family.

```python
# The Python engine has no mcp management tool; read the same facts from your code
for server in api.mcp.list():
    print(server)
# cloudflare (Cloudflare) · 4 of 11 tools allowed · category exec · mcp.example.com/sse

api.mcp.get("cloudflare")   # the allowed tools and their declarations
```
