# MCP Environments (https://www.agentenvframework.com/docs/environments/mcp)

> An MCP environment is a server that offers an agent tools over MCP and holds the state those tools change

An MCP environment is a server that offers an agent tools over the Model Context Protocol (MCP) and
holds the state those tools change. You write it as a subclass of `AgentEnvEnvironment`, from the
`agentenv-framework-protocol` package. Its tools are what the agent can do. Its data plane is a
second endpoint, never offered to the agent, through which the framework loads, reads and resets
that state.

These pages follow one such server, `EmailEnv`, an inbox that an agent can search and send from:

1. [Creating your own MCP environment](https://www.agentenvframework.com/docs/environments/mcp/creating.md): write `EmailEnv`, with the
   tools an agent calls and the data plane the framework uses.
2. [Composing many MCP environments](https://www.agentenvframework.com/docs/environments/mcp/composing.md): add `ContactsEnv` and serve
   both as one `multi` env.
3. [Deploying your MCP environment](https://www.agentenvframework.com/docs/environments/mcp/deploying.md): register it, deploy it in a
   sandbox, use it through its card and tear the instance down.

The other [Environments](https://www.agentenvframework.com/docs/environments.md) pages cover topology, the environment card, the
virtual clock, per-role tool access, triggers and more extensions.