> For the complete documentation index, see [llms.txt](https://docs.mozark.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mozark.ai/mcp/mozark-mcp-docs/getting-started/authentication-and-context.md).

# Authentication and context

Sign in securely and select your Mozark workspace.

## Authentication

Mozark MCP uses browser-based sign-in. When the first tool call is made, your client opens the Mozark login page; approve it and you're done. The token is stored by your client — the AI model never sees it.

Your MCP session has exactly the permissions your Mozark user has. If you can't delete a test plan in the Mozark web app, the assistant can't either.

To sign out, remove or disconnect the Mozark server in your client's settings.

## Understanding “active context”

Almost every Mozark tool operates inside a hierarchy:

```
Organisation
 └── App
      └── Project
           └── Test cases, folders, plans, runs, bugs, knowledge base
```

The MCP server keeps an **active context** (organisation + project + app) for your session so you don't have to repeat yourself. The assistant resolves it in this order:

1. An ID you explicitly mention in the conversation.
2. A context set earlier this session (`mozark_set_active_context` or a `switch` tool).
3. Headers from your client config (`X-Mozark-*`).
4. Your account's default organisation/project/app from the Admin Control Panel.
5. Nothing — the assistant will ask.

{% hint style="info" %}
**Why the assistant sometimes double-checks.** If the only context available is your account-wide default and you belong to more than one organisation, the assistant confirms which one you mean before creating or saving anything. This prevents test cases landing in the wrong project.
{% endhint %}

## Setting or switching context

Just say it in plain language:

| You say                             | What happens                                                                                            |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------- |
| *"Use the Acme organisation."*      | `mozark_switch_organization` — this also clears project and app, so you'll be asked to pick those next. |
| *"Switch to the Checkout project."* | `mozark_switch_project` (same organisation).                                                            |
| *"Use the Android app."*            | `mozark_switch_app` (same organisation/project).                                                        |
| *"Reset my context."*               | `mozark_clear_active_context`.                                                                          |
| *"What am I working in?"*           | `mozark_get_active_context`.                                                                            |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mozark.ai/mcp/mozark-mcp-docs/getting-started/authentication-and-context.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
