# Components

Code to copy. These files are not part of the npm package: pick one, copy it into your application and change it
as you like. Each has no dependency other than `ngx-mcp-apps` and Angular, and is compiled and used on this site,
so what you copy is code that runs.

## Start from a whole app

One file that is the entire application, written for Angular 22. Its page runs it live. The chart of
[The example](example.md) is another whole app in one file.

- [A whole MCP App in one file](component-one-file-app.md): One component and three lines of bootstrap: this file is the entire application.

## Or take the pieces

Nine small files, one job each, for when the app grows. They work from Angular 18 and take their colours from
the text around them, so they follow your theme without a stylesheet.

- [Connection status](component-mcp-status.md): A small badge that says whether the app is talking to a host.
- [Tool result states](component-mcp-tool-state.md): Wraps the part of the app that needs the tool result.
- [Button that calls a server tool](component-mcp-call-tool.md): Put it on a `<button>`: a click calls a tool of your MCP server through the host.
- [Follow server state](component-mcp-live-value.md): A tool result reaches the app once.
- [Host theme](component-mcp-theme.md): Follows the light or dark theme of the host.
- [Fullscreen button](component-mcp-fullscreen-button.md): Asks the host to show the app in fullscreen, and back.
- [Tell the model](component-mcp-tell-model.md): A text box with the two ways an app can talk back.
- [Link opened by the host](component-mcp-host-link.md): Inside the host iframe a normal link is usually blocked by the sandbox.
- [Standalone notice](component-mcp-standalone-notice.md): A line shown only when the app runs outside a host, for example with `ng serve`.

## How to use a piece

Put the file in a folder such as `src/app/mcp/` and import the class where you use it:

```ts
import { McpStatus } from './mcp/mcp-status';

@Component({
  imports: [McpStatus],
  template: `<mcp-status />`,
})
export class App {}
```

From Angular 19 you can delete the line `standalone: true` of a piece: it is the default.

