Template
Clone
1
configuration
Jonathan Miller edited this page 2026-05-20 01:25:20 +00:00
Table of Contents
← Home
Configuration
Configuration file reference for MCP servers built from the Template-MCP template.
Config File Location
The config file is stored at ~/.<project>.json (e.g., ~/.mcp_mokowaas.json).
Override the location with the {{ENV_PREFIX}}_CONFIG environment variable:
export MY_MCP_CONFIG=/custom/path/config.json
Config File Schema
{
"defaultConnection": "production",
"connections": {
"production": {
"baseUrl": "https://api.example.com",
"apiKey": "your-api-key"
},
"staging": {
"baseUrl": "https://api-staging.example.com",
"apiKey": "staging-key",
"insecure": true
}
}
}
Top-Level Fields
| Field | Type | Required | Description |
|---|---|---|---|
defaultConnection |
string | Yes | Name of the connection to use when no connection parameter is provided |
connections |
object | Yes | Map of named connections |
Connection Fields
| Field | Type | Required | Description |
|---|---|---|---|
baseUrl |
string | Yes | Base URL of the API (including protocol, no trailing slash) |
apiKey |
string | Yes | API key or token for authentication |
insecure |
boolean | No | Skip TLS certificate verification (default: false) |
Creating the Config
Interactive Setup
npm run setup
The wizard prompts for:
- Connection name (e.g.,
production,staging) - API base URL
- API key/token
- TLS verification preference
Run npm run setup again to add more connections.
Manual Creation
cat > ~/.<project>.json << 'EOF'
{
"defaultConnection": "default",
"connections": {
"default": {
"baseUrl": "https://api.example.com",
"apiKey": "your-key"
}
}
}
EOF
chmod 600 ~/.<project>.json
Multi-Connection Usage
Every MCP tool accepts an optional connection parameter:
# Uses default connection
tool_name(id: 42)
# Uses specific connection
tool_name(id: 42, connection: "staging")
Common Connection Patterns
| Connection Name | Use Case |
|---|---|
production |
Live/production API |
staging |
Pre-production testing |
dev |
Local development instance |
client-name |
Multi-tenant setups (one connection per client) |
Claude Code Registration
Register the MCP server in .mcp.json (project) or ~/.claude.json (global):
{
"mcpServers": {
"my-mcp": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/dist/index.js"]
}
}
}
| Field | Detail |
|---|---|
type |
Always "stdio" for Template-MCP servers |
command |
"node" |
args |
Absolute path to the compiled dist/index.js |
Restart Claude Code after changing MCP configuration.
Environment Variables
| Variable | Purpose | Default |
|---|---|---|
{{ENV_PREFIX}}_CONFIG |
Custom config file path | ~/.<project>.json |
NODE_TLS_REJECT_UNAUTHORIZED |
Global TLS override (avoid) | 1 |
Prefer per-connection "insecure": true over the global NODE_TLS_REJECT_UNAUTHORIZED=0.
Validation
Check Config Syntax
node -e "console.log(JSON.parse(require('fs').readFileSync(process.env.HOME + '/.<project>.json', 'utf8')))"
List Connections
Use the list_connections tool (built into every Template-MCP server) to verify the loaded connections.
Related
- Installation -- initial setup and registration
- Security -- credential management and TLS
- Development -- config system internals
- Troubleshooting -- config-related errors
Repo: Template-MCP · MokoStandards
| Field | Value |
|---|---|
| Minimum Version | 04.07.00 |
| Platform | mcp-server |
| Applies To | MCP server repositories |
| Revision | Date | Author | Description |
|---|---|---|---|
| 1.0 | 2026-05-19 | Moko Consulting | Initial version |