Configuration
Environment variables and configuration options for the NAICS MCP Server.
Environment Variables
Server Settings
| Variable | Default | Description |
|---|---|---|
NAICS_HOST | 127.0.0.1 | Bind address |
NAICS_PORT | 9090 | HTTP port |
NAICS_LOG_LEVEL | INFO | Log level (DEBUG, INFO, WARNING, ERROR) |
NAICS_LOG_FORMAT | text | Log format (text, json) |
Data Settings
| Variable | Default | Description |
|---|---|---|
NAICS_DATA_DIR | ~/.naics-mcp | Data directory |
NAICS_DB_PATH | {data_dir}/naics.db | SQLite database path |
NAICS_EMBEDDINGS_PATH | {data_dir}/embeddings.npy | Embeddings file |
Search Settings
| Variable | Default | Description |
|---|---|---|
NAICS_EMBEDDING_MODEL | all-MiniLM-L6-v2 | Sentence transformer model |
NAICS_DEFAULT_SEARCH_LIMIT | 10 | Default search results limit |
NAICS_MIN_CONFIDENCE | 0.3 | Minimum confidence threshold |
Performance Settings
| Variable | Default | Description |
|---|---|---|
NAICS_WORKERS | 4 | Number of worker threads |
NAICS_MAX_BATCH_SIZE | 100 | Maximum batch classification size |
NAICS_CACHE_SIZE | 1000 | Search result cache size |
Configuration File
Create a configuration file at ~/.naics-mcp/config.yaml:
# Server settings
server:
host: "0.0.0.0"
port: 9090
# Logging
logging:
level: INFO
format: json
# Search
search:
default_limit: 10
min_confidence: 0.3
embedding_model: all-MiniLM-L6-v2
# Performance
performance:
workers: 4
max_batch_size: 100
cache_size: 1000CLI Options
The naics-mcp serve command accepts options that override configuration:
naics-mcp serve \
--host 0.0.0.0 \
--port 8080 \
--log-level DEBUGAvailable Options
| Option | Description |
|---|---|
--host | Bind address |
--port | HTTP port |
--log-level | Log level |
--data-dir | Data directory |
--config | Path to config file |
Priority Order
Configuration is resolved in this order (highest to lowest priority):
- Command-line options
- Environment variables
- Configuration file
- Default values
Production Configuration
Docker
docker run -p 9090:9090 \
-e NAICS_LOG_LEVEL=INFO \
-e NAICS_LOG_FORMAT=json \
-e NAICS_HOST=0.0.0.0 \
ghcr.io/mfbaig35r/naics-mcp-server:latestKubernetes ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
name: naics-mcp-config
data:
NAICS_LOG_LEVEL: "INFO"
NAICS_LOG_FORMAT: "json"
NAICS_HOST: "0.0.0.0"
NAICS_PORT: "9090"Logging Configuration
Text Format (Development)
export NAICS_LOG_FORMAT=text
export NAICS_LOG_LEVEL=DEBUGOutput:
2024-01-15 10:30:00 INFO [naics_mcp] Server starting on 0.0.0.0:9090
2024-01-15 10:30:01 DEBUG [naics_mcp.search] Loading embeddings...JSON Format (Production)
export NAICS_LOG_FORMAT=json
export NAICS_LOG_LEVEL=INFOOutput:
{"timestamp":"2024-01-15T10:30:00Z","level":"INFO","logger":"naics_mcp","message":"Server starting on 0.0.0.0:9090"}Model Configuration
Embedding Model
The default model is all-MiniLM-L6-v2. To use a different model:
export NAICS_EMBEDDING_MODEL=all-mpnet-base-v2
naics-mcp embeddings # Regenerate embeddings
naics-mcp serveSupported models:
all-MiniLM-L6-v2(default, fast, 384 dimensions)all-mpnet-base-v2(slower, better quality, 768 dimensions)- Any sentence-transformers compatible model
Regenerating Embeddings
After changing the model:
# Remove existing embeddings
rm ~/.naics-mcp/embeddings.npy
# Generate new embeddings
naics-mcp embeddings
# Restart server
naics-mcp serveSecurity Configuration
Bind to Localhost Only
For development or when behind a reverse proxy:
export NAICS_HOST=127.0.0.1Bind to All Interfaces
For container deployments:
export NAICS_HOST=0.0.0.0Rate Limiting
Configure rate limits (future feature):
rate_limiting:
enabled: true
requests_per_minute: 60
burst: 10Troubleshooting
Check Current Configuration
naics-mcp config showValidate Configuration
naics-mcp config validateReset to Defaults
rm ~/.naics-mcp/config.yaml
naics-mcp init