> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superwire.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Servers

> Connect MCP servers with endpoint and request headers for tools, resources, and prompts.

An `mcp` declaration defines a named MCP server connection used by imports.

```wire theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
mcp tasks {
    endpoint: "http://localhost:8000/mcp/tasks"
}
```

Imported tools, prompts, and resources reference that server through the `mcp` namespace.

```wire theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
tool fetch_task from mcp.tasks.tool.fetch_task
prompt writer_instructions from mcp.tasks.prompt.writer_instructions
resource project_readme from mcp.tasks.resource.project_readme
```

## Authenticated MCP servers

Use `headers {}` when the MCP server requires authentication or request-scoped metadata.

```wire theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
secrets {
    mcp_token: string
}

mcp summarizer {
    endpoint: "http://localhost:8000/mcp/summarizer"

    headers {
        Authorization: "Bearer {{ secrets.mcp_token }}"
    }
}
```

Headers can reference runtime values from `secrets` and `input`.

```wire theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
mcp internal_tools {
    endpoint: "https://tools.internal.example.com/mcp"

    headers {
        Authorization: "Bearer {{ secrets.internal_tools_token }}"
        X_Workspace_ID: "{{ input.workspace_id }}"
    }
}
```

## Practical guidance

* Keep one `mcp` declaration per backend capability domain (`tasks`, `knowledge`, `crm`).
* Pass credentials through `secrets`, never hardcode long-lived tokens.
* Add request-scoped headers (workspace, tenant, user context) when your MCP backend needs routing context.
* Keep endpoint URLs stable and move environment-specific values to deployment configuration.

Do not hardcode long-lived tokens in `.wire` files. Pass them through `secrets`.

## See also

* [MCP and Tools Overview](/mcp/overview)
* [MCP Tools](/mcp/tools)
* [MCP Resources](/mcp/resources)
* [MCP Prompts](/mcp/prompts)
