Separate configuration by responsibility
Do not use one unstructured configuration object for every concern.
Use a clear precedence order
A predictable order might be:Validate at startup
Before the server accepts a request, validate:- Required values are present.
- URLs use approved schemes and hosts.
- Timeouts and limits are positive and bounded.
- Tool names are unique.
- Capability declarations match registered handlers.
- Auth issuer, audience, and scopes are defined.
- Local paths are absolute and within allowed roots.
- Production mode does not use development credentials.
Keep secrets out of configuration files
Store secret values in a managed secret store, workload identity, or protected environment injection. Use references such as:.env files, tokens, private keys, or complete client configurations containing credentials. Follow API key management best practices.
Configure least privilege
Enable only the capabilities and operations required for the deployment.Set timeouts and limits
Configure:- Connection and upstream request timeouts
- Maximum request and result sizes
- Tool-specific execution deadlines
- Rate and concurrency limits
- Pagination limits
- Retry count and backoff
- Session and idle expiration
Configure each transport safely
Forstdio:
- Use an explicit executable path in managed environments.
- Reserve
stdoutfor protocol messages. - Send logs to
stderr. - Pass only required environment variables.
- Avoid an unnecessary shell wrapper.
- Use HTTPS.
- Validate
Origin. - Configure authentication for protected servers.
- Bind local-only services to loopback.
- Set proxy and SSE timeouts deliberately.
- Decide whether the server uses sessions and how they are stored.
Separate environments
Development, staging, and production should use different:- Credentials
- Upstream accounts
- Endpoints
- data stores
- log destinations
- allowed origins
- rate limits
Version configuration
Review configuration changes like code:- Store non-secret configuration in version control.
- Validate it in CI.
- Record who approved a production change.
- Publish changes as an identifiable server version.
- Preserve the previous known-good version.
- Test rollback before you need it.
Example production configuration
Configure a server in 0mcp
With 0mcp, you can configure and host MCP servers from OpenAPI 3.x, Swagger 2.0, direct REST API, and GraphQL sources. Review the generated tools, add resources and prompts, test in the Playground, and publish a version. Use logs, analytics, and versioning to operate the server after release.Production checklist
- Configuration schema is validated at startup
- Precedence and defaults are documented
- Secrets are stored outside source control
- Only required capabilities are enabled
- Network, file, and identity permissions are restricted
- Timeouts, limits, and retry rules are explicit
- Development and production are isolated
- Configuration changes are reviewed and auditable
- Rollback has been tested