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

# Sign in to the service

> How Local MCP authenticates to the OData service on your behalf.

Local MCP signs in to the OData service on your behalf — `$metadata`, collections, POST. It uses your credentials, not the assistant's.

`try` prints the flags. Common cases:

| Situation | Add this |
| - | - |
| The service is public | nothing |
| You already have a bearer token | `--auth-token "<token>"` |
| The service uses OAuth (including Microsoft Graph) | `--client-id <your-app-id>` — you get a URL and a code the first time; after that it remembers |
| Unattended, no person to click | `--grant client_credentials --client-secret <secret>` |
| API key or HTTP Basic | `--api-key` / `--basic-user` as `try` suggests |

Example (Microsoft Graph):

```bash theme={null}
dotnet odata-mcp start https://graph.microsoft.com/v1.0 \
  --client-id "{your-app-registration-id}" \
  --scopes "https://graph.microsoft.com/.default"
```

Sign-in prompts show as `Sign in at <url>` and `Code: <code>`. Tokens stay on your machine and refresh for you. They never appear in tool results or in the command that `add` prints.

A daemon must pass `--grant client_credentials` (and `--client-secret` or `ODATA_MCP_CLIENT_SECRET`). There is no TTY detection; an interactive grant with nobody present will hang.

## If you own the OData API

Publish protected resource metadata on **that API**. Local MCP then discovers the authorization server from a `401`.

```csharp theme={null}
builder.Services.AddProtectedResourceMetadata(options =>
{
    options.AuthorizationServers.Add(new Uri("https://login.microsoftonline.com/contoso.com/v2.0"));
    options.ScopesSupported.Add("api://contoso-odata/Data.Read");
});
```

There is no `Use` call. The document is public at `/.well-known/oauth-protected-resource`. Operators still need a client id when the authorization server does not allow dynamic registration.

Every flag: [How Local MCP works](https://ai.easyaf.dev/odata-mcp/guides/local/how-it-works.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.