Overview
Most MCP servers need user-provided values like API keys, preferences, or settings. How these values reach your server depends on how it’s deployed:| Server Type | How Users Provide Config |
|---|---|
| Remote (HTTP) | Query parameters or HTTP headers |
| Local (stdio) | Command-line arguments |
- Generates an OAuth UI form for remote servers
- Passes values to your server in the appropriate format
- Validates inputs and applies defaults
Defining Your Schema
- TypeScript
- JSON Schema
Export a Smithery extracts this schema automatically — no additional configuration needed.
configSchema using Zod to declare what configuration your server accepts:Config Transport (x-from and x-to)
The x-from and x-to extensions control how config values flow through the gateway:
x-from — Where Smithery reads config
Specifies where Smithery looks for the value when a user connects:
x-from is specified, defaults to { query: "<propertyName>" }.
x-to — Where Smithery sends config to upstream
Specifies how Smithery forwards the value to your upstream server. Use this when your server expects a different header name than what clients provide:
- Your upstream server expects an
Authorizationheader, but you can’t useauthorizationasx-from(it’s reserved for Smithery OAuth) - You want to rename headers for compatibility with existing APIs
- You need to map user-friendly parameter names to technical header names
x-to is specified, values are forwarded using the same location as x-from.
Example: PostHog API Key
- Clients connect with header
posthog-api-key: sk-xxx - Your server receives header
Authorization: sk-xxx
Type Support
Only simple types supportx-from:
stringnumberboolean
Reserved Headers
The following headers cannot be used asx-from sources:
authorization— Used for Smithery OAuthcookie— Reserved for session managementcf-*— Cloudflare infrastructure headerssmithery-*— Internal service headers
These restrictions only apply to
x-from. You can use any header name (including Authorization) in x-to to forward values to your upstream server.How Configuration Reaches Your Server
- URL
- Hosted
- Local
For URL-published servers, Smithery Gateway passes through all query parameters and headers to your upstream server.Your server receives headers and query params directly — Smithery proxies them as-is.
Type Coercion
Since query parameters, headers, and CLI arguments are strings, Smithery automatically coerces values:| Schema Type | Coercion |
|---|---|
string | No coercion |
number | Number(value) — fails if non-numeric |
boolean | "true" / "1" → true, "false" / "0" → false |
Best Practices
Schema Design
Schema Design
- Use clear descriptions — These become form labels and help text
- Set sensible defaults — Minimize required fields
- Use enums for fixed options — Creates dropdown menus in the UI
- Keep required fields minimal — Only require what’s essential
Security
Security
- Use headers for secrets — Configure
"x-from": { header: "x-api-key" }for API keys - Never log sensitive values — Treat keys and tokens as secrets
- Validate server-side — Don’t rely solely on client validation
Troubleshooting
Configuration not detected?
Configuration not detected?
- Export
configSchemafrom the same file ascreateServer - Ensure schema is a valid Zod object
Type errors?
Type errors?
- Accept
{ config }in yourcreateServerfunction - Use
z.infer<typeof configSchema>for typing
Common Questions
Can users change configuration mid-session?
Can users change configuration mid-session?
No — configuration is bound at connection time. A new connection is needed for different settings.
Can all fields be optional?
Can all fields be optional?
Yes — use
.optional() or provide .default() values.Where can I see a server's configuration?
Where can I see a server's configuration?
View the API tab on any server’s page on Smithery.