---
schema: rendered-html/v1
title: "Namespace Transform - FastMCP"
source_url: https://gofastmcp.com/servers/transforms/namespace
generated_at: 2026-06-11T19:39:54.068670+00:00
---




[FastMCP home page![light logo](images/gofastmcp__com__servers__transforms__namespace__wordmark.avif)![dark logo](images/gofastmcp__com__servers__transforms__namespace__wordmark-white.avif)](gofastmcp__com.md)







Working with Tools

Namespace Transform









  - [Overview](gofastmcp__com__servers__transforms__transforms.md)
  - [Tool Transformation](gofastmcp__com__servers__transforms__tool-transformation.md)
  - [Code Mode

    NEW](gofastmcp__com__servers__transforms__code-mode.md)
  - [Tool Search

    NEW](gofastmcp__com__servers__transforms__tool-search.md)
  - [Namespace](/servers/transforms/namespace)
  - [Visibility

    NEW](gofastmcp__com__servers__visibility.md)
  - [Resources as Tools

    NEW](gofastmcp__com__servers__transforms__resources-as-tools.md)
  - [Prompts as Tools

    NEW](gofastmcp__com__servers__transforms__prompts-as-tools.md)
  - [Tool Fingerprinting](gofastmcp__com__servers__tool-fingerprinting.md)













Working with Tools

# Namespace Transform


Prefix component names to prevent conflicts


The `Namespace` transform prefixes all component names, preventing conflicts when composing multiple servers.
Tools and prompts receive an underscore-separated prefix. Resources and templates receive a path-segment prefix in their URIs.

| Component | Original | With `Namespace("api")` |
| --- | --- | --- |
| Tool | `my_tool` | `api_my_tool` |
| Prompt | `my_prompt` | `api_my_prompt` |
| Resource | `data://info` | `data://api/info` |
| Template | `data://{id}` | `data://api/{id}` |

The most common use is through the `mount()` method’s `namespace` parameter.


weather = FastMCP("Weather")
calendar = FastMCP("Calendar")

@weather.tool
def get_data() -> str:
    return "Weather data"

@calendar.tool
def get_data() -> str:
    return "Calendar data"

# Without namespacing, these would conflict
main = FastMCP("Main")
main.mount(weather, namespace="weather")
main.mount(calendar, namespace="calendar")

# Clients see: weather_get_data, calendar_get_data

You can also apply namespacing directly using the `Namespace` transform.

from fastmcp.server.transforms import Namespace

mcp = FastMCP("Server")

def greet(name: str) -> str:
    return f"Hello, {name}!"

# Namespace all components
mcp.add_transform(Namespace("api"))

# Tool is now: api_greet

[Tool Search

Previous](gofastmcp__com__servers__transforms__tool-search.md)[Component Visibility

Next](gofastmcp__com__servers__visibility.md)






