Session Configuration
Smithery allows clients to connect to MCP servers with a specific configuration. Configurations are JSON objects that customize how an MCP server behaves for a specific client connection. Configurations allow each client-server session to operate differently.
How Configurations Work
Every MCP server can define what configuration parameters it accepts. These parameters might include API keys, model settings, temperature values, or any other options that affect how the server responds to requests.
Configurations are bound to individual sessions. Each client connection has its own configuration that doesn't affect other sessions.
How Configs Are Declared
Session configurations are defined by the author of the MCP.
MCP server developers define their configuration requirements using JSON Schema in the configSchema
field of their smithery.yaml
file:
The configSchema
supports all standard JSON Schema features:
- Data types (
string
,number
,boolean
, etc.) - Required fields
- Default values
- Enumerated options
- Min/max constraints
- Descriptive titles and documentation
The schema is used to both validate configurations and generate user interfaces in the Smithery web app.
Supplying Configs at Connection Time
When connecting to an MCP server, clients must provide a configuration that satisfies the server's schema. This happens in two steps:
- Retrieve the schema: The Registry API returns the
configSchema
as part of the server connection details - Send the config: When establishing a connection, encode the configuration as base64 in the
config
query parameter of the connection URL.
You can also save configurations for reuse with Configuration Profiles, which eliminates the need to re-enter configs each time.
Security
Configurations sometimes contain sensitive information like API keys. It's recommended for users to save sensitive keys on Smithery as profiles to avoid passing them in the connection URL.
Examples
Minimal Configuration
If your server doesn't need any configuration, you can use an empty schema:
Database Connection Configuration
A database connector might require connection details:
Best Practices for MCP Authors
-
Provide clear documentation
- Use
description
fields in your schema - Document any non-obvious parameters
- Use
-
Set sensible defaults
- Users should be able to connect with minimal configuration
- Use the
default
property for optional parameters
-
Use enums for limited choices
- When there are specific valid options, list them in an
enum
- This creates a dropdown in the UI instead of a free text field
- When there are specific valid options, list them in an
-
Handle configuration securely
- Pass secrets as environment variables
- Never log or expose configuration values
- Validate input server-side even though Smithery performs validation
-
Keep configurations small
- Focus on essential parameters
- Large binary data should not be passed via configuration
Troubleshooting
What happens if my configuration is invalid?
If a configuration doesn't match the schema, Smithery will reject the connection attempt and provide an error message explaining what's wrong.
Can I change configuration mid-session?
No, configurations are bound to a session at connection time and cannot be changed during the session. To use a different configuration, establish a new connection.
Can configurations be optional?
Yes, by not including fields in the required
array of your schema, those fields become optional. You can also provide default values using the default
property.
Where can I find a server's configuration schema?
You can view any MCP server's configuration schema in its API Tab on the server page. It provides a clean, syntax-highlighted code block of the raw JSON schema for easy reference and copying.
See Also
- Configuration Profiles - Save and reuse configurations
- Registry API - Programmatically access server information
- Project Configuration - How to define server configuration in
smithery.yaml
- JSON Schema Documentation - Learn more about JSON Schema