Skip to content

Configuration (YAML + Env)

When you ship your MCP server as a compiled binary, your users need to configure auth and settings without modifying code. @casys/mcp-server supports file-based configuration with environment variable overrides — the same pattern used by Docker, Kubernetes, and every serious deployment tool.

programmatic (code) > environment variables > YAML file > defaults (no auth)

Higher priority wins. This means you can ship sane defaults in YAML and override specific values per environment with env vars.

Create a mcp-server.yaml in the working directory:

mcp-server.yaml
auth:
provider: auth0
audience: https://my-mcp.example.com
resource: https://my-mcp.example.com
domain: my-tenant.auth0.com
scopesSupported:
- read
- write
- admin
ProviderRequired Fields
googleaudience, resource
auth0domain, audience, resource
githubaudience, resource
oidcissuer, audience, resource

Every YAML field can be overridden with MCP_AUTH_* environment variables:

VariableYAML FieldExample
MCP_AUTH_PROVIDERauth.providergoogle, auth0, github, oidc
MCP_AUTH_AUDIENCEauth.audiencehttps://my-mcp.example.com
MCP_AUTH_RESOURCEauth.resourcehttps://my-mcp.example.com
MCP_AUTH_DOMAINauth.domainmy-tenant.auth0.com
MCP_AUTH_ISSUERauth.issuerhttps://my-idp.example.com
MCP_AUTH_JWKS_URIauth.jwksUrihttps://.../.well-known/jwks.json
MCP_AUTH_SCOPESauth.scopesSupportedread write admin (space-separated)
Terminal window
# Ship with staging config in YAML, override audience for production
MCP_AUTH_AUDIENCE=https://prod.example.com ./my-server --http --port 3000

If you need programmatic access to the loaded configuration:

import {
loadAuthConfig,
createAuthProviderFromConfig,
} from "@casys/mcp-server";
// Auto-loads from mcp-server.yaml + MCP_AUTH_* env vars
const config = await loadAuthConfig();
if (config) {
const provider = createAuthProviderFromConfig(config);
// Pass to ConcurrentMCPServer options
}
FROM denoland/deno:2.0
COPY . .
RUN deno compile --allow-net --allow-read --allow-env -o server main.ts
ENV MCP_AUTH_PROVIDER=google
ENV MCP_AUTH_AUDIENCE=https://my-mcp.example.com
ENV MCP_AUTH_RESOURCE=https://my-mcp.example.com
CMD ["./server", "--http", "--port", "3000"]