-
Notifications
You must be signed in to change notification settings - Fork 1
V3 Configuration
Complete configuration reference for DaemonsMCP Version 3.
V3 uses daemonsmcp.json for configuration instead of the standard appsettings.json. This allows for environment-specific overrides and clearer separation from ASP.NET defaults. so both are include because ef core uses appsettings.json... live and learn.
-
API Project:
server/DaemonsMCP.Api/daemonsmcp.json -
MCP Project:
server/DaemonsMCP/daemonsmcp.json -
Environment Override:
daemonsmcp.{Environment}.json
- Command line arguments
- Environment variables
-
daemonsmcp.{Environment}.json(e.g.,daemonsmcp.Development.json) daemonsmcp.json
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Database=DaemonsMCP;Integrated Security=True;TrustServerCertificate=True;"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}The ConnectionStrings:DefaultConnection setting controls database connectivity.
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Database=DaemonsMCP;Integrated Security=True;TrustServerCertificate=True;"
}
}Alternate format:
"DefaultConnection": "Server=localhost;Database=DaemonsMCP;Trusted_Connection=true;TrustServerCertificate=true;"{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Database=DaemonsMCP;User Id=your_username;Password=your_password;TrustServerCertificate=True;"
}
}{
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=DaemonsMCP;Trusted_Connection=true;"
}
}{
"ConnectionStrings": {
"DefaultConnection": "Server=192.168.1.100,1433;Database=DaemonsMCP;User Id=daemonsmcp_user;Password=SecurePassword123;TrustServerCertificate=True;"
}
}| Parameter | Description | Example |
|---|---|---|
Server |
SQL Server instance |
localhost, .\SQLEXPRESS, 192.168.1.100
|
Database |
Database name | DaemonsMCP |
Integrated Security |
Use Windows auth |
True or SSPI
|
Trusted_Connection |
Same as Integrated Security | true |
User Id |
SQL auth username |
sa, daemonsmcp_user
|
Password |
SQL auth password | YourPassword |
TrustServerCertificate |
Accept self-signed certs | True |
Encrypt |
Force encryption |
True (optional) |
MultipleActiveResultSets |
Enable MARS |
True (optional) |
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore": "Warning",
"DaemonsMCP": "Debug"
}
}
}-
Trace- Very detailed, typically only for debugging -
Debug- Detailed diagnostic information -
Information- General informational messages -
Warning- Warnings about potential issues -
Error- Error messages -
Critical- Critical failures -
None- Disable logging
Control logging for specific namespaces:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"DaemonsMCP.Application": "Debug",
"DaemonsMCP.Infrastructure.Services.FileWatcherService": "Debug",
"Microsoft.EntityFrameworkCore.Database.Command": "Warning",
"System.Net.Http.HttpClient": "Warning"
}
}
}Serilog is configured to write logs to:
Windows:
%LOCALAPPDATA%\DaemonsMCP\Logs\
Log Files:
-
D3MCP-YYYYMMDD.log- All logs (Information and above) -
D3MCP-errors-YYYYMMDD.log- Errors and warnings only
Retention:
- General logs: 7 days
- Error logs: 30 days
CORS (Cross-Origin Resource Sharing) is required for the Angular web interface.
Already configured in Program.cs:
builder.Services.AddCors(options =>
{
options.AddPolicy("LocalDev", policy =>
{
policy.WithOrigins("http://localhost:4200")
.AllowAnyHeader()
.AllowAnyMethod();
});
});For production deployments, restrict CORS to specific domains:
builder.Services.AddCors(options =>
{
options.AddPolicy("Production", policy =>
{
policy.WithOrigins(
"https://yourdomain.com",
"https://app.yourdomain.com"
)
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
});
app.UseCors("Production");Or configure via daemonsmcp.json:
{
"Cors": {
"AllowedOrigins": [
"https://yourdomain.com",
"https://app.yourdomain.com"
]
}
}Create daemonsmcp.Development.json:
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Database=DaemonsMCP_Dev;Integrated Security=True;TrustServerCertificate=True;"
},
"Logging": {
"LogLevel": {
"Default": "Debug",
"DaemonsMCP": "Trace"
}
}
}Create daemonsmcp.Production.json:
{
"ConnectionStrings": {
"DefaultConnection": "Server=prod-sql-server;Database=DaemonsMCP;User Id=daemonsmcp_app;Password=UseEnvironmentVariableInstead;TrustServerCertificate=True;"
},
"Logging": {
"LogLevel": {
"Default": "Warning",
"DaemonsMCP": "Information"
}
},
"AllowedHosts": "yourdomain.com"
}Visual Studio:
- Right-click project → Properties
- Debug → General → Open debug launch profiles UI
- Set
ASPNETCORE_ENVIRONMENTtoDevelopmentorProduction
Command Line:
# Windows
set ASPNETCORE_ENVIRONMENT=Production
dotnet run
# Linux/macOS
export ASPNETCORE_ENVIRONMENT=Production
dotnet runClaude Desktop Config:
{
"mcpServers": {
"daemons3mcp": {
"command": "C:\\YourPath\\DaemonsMCP\\server\\DaemonsMCP\\bin\\Debug\\net9.0-windows7.0\\Daemons3MCP.exe",
"args": []
}
}
}For development, use .NET User Secrets instead of committing sensitive data.
cd server/DaemonsMCP.Api
dotnet user-secrets initdotnet user-secrets set "ConnectionStrings:DefaultConnection" "Server=localhost;Database=DaemonsMCP;User Id=sa;Password=MySecretPassword;"dotnet user-secrets listUser secrets override daemonsmcp.json in Development environment only.
Projects are configured in the database, not in JSON files.
Using Swagger UI:
- Navigate to
https://localhost:44356/swagger - Expand
POST /api/projects - Click "Try it out"
- Enter project details:
{
"name": "MyProject",
"description": "My C# project",
"rootPath": "C:\\Code\\MyProject"
}- Click "Execute"
Using curl:
curl -X POST https://localhost:44356/api/projects \
-H "Content-Type: application/json" \
-d '{
"name": "MyProject",
"description": "My C# project",
"rootPath": "C:\\Code\\MyProject"
}'Using Postman:
- Method:
POST - URL:
https://localhost:44356/api/projects - Headers:
Content-Type: application/json - Body (raw JSON):
{
"name": "MyProject",
"description": "My C# project",
"rootPath": "C:\\Code\\MyProject"
}The Angular config viewer will provide project management UI.
Direct SQL insert:
INSERT INTO Projects (Name, Description, RootPath, CreatedAt)
VALUES ('MyProject', 'My C# project', 'C:\Code\MyProject', GETDATE());Projects enforce strict path security:
- All file operations are scoped within
RootPath - Path traversal attacks (
../,..\) are blocked - Paths are normalized to forward slashes
- Only absolute paths within project root are allowed
Configure EF Core performance in Infrastructure layer:
Connection Pooling (default: enabled):
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(connectionString, sqlOptions =>
{
sqlOptions.EnableRetryOnFailure(
maxRetryCount: 3,
maxRetryDelay: TimeSpan.FromSeconds(5),
errorNumbersToAdd: null
);
sqlOptions.CommandTimeout(30); // seconds
})
);File watcher behavior is controlled in code, but you can adjust:
Debounce Settings (in FileWatcherService.cs):
- Debounce delay: 5 seconds (default)
- Batch processing interval: 5 seconds
- Process after queue is idle for 5 seconds
Batch Size: Controlled in ObjectHierarchyIndexingService
- Default: Process all queued files per batch
- Files are indexed using Roslyn asynchronously
For large codebases:
- Increase SQL Server memory allocation
- Consider indexing hours (off-peak)
- Monitor
IndexingQueuetable size
V3 currently runs locally without authentication. For production:
Add Authentication in Program.cs:
builder.Services.AddAuthentication()
.AddJwtBearer(options => { /* config */ });
app.UseAuthentication();
app.UseAuthorization();Create Dedicated User:
CREATE LOGIN daemonsmcp_app WITH PASSWORD = 'SecurePassword123';
CREATE USER daemonsmcp_app FOR LOGIN daemonsmcp_app;
USE DaemonsMCP;
GRANT SELECT, INSERT, UPDATE, DELETE ON SCHEMA::dbo TO daemonsmcp_app;Connection String:
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Database=DaemonsMCP;User Id=daemonsmcp_app;Password=SecurePassword123;TrustServerCertificate=True;"
}
}Symptom: Changes to daemonsmcp.json not reflected
Solutions:
- Verify file is in correct directory (
DaemonsMCP.ApiorDaemonsMCP) - Check
Build Actionin Visual Studio: should beContent - Check
Copy to Output Directory: should beCopy if newer - Restart application
- Check for syntax errors (use JSON validator)
Symptom: "Cannot open database" or "Login failed"
Solutions:
- Verify SQL Server is running
- Test connection string with
sqlcmd:
sqlcmd -S localhost -U sa -P YourPassword -Q "SELECT @@VERSION"- Check SQL Server authentication mode (Windows + SQL)
- Verify database exists:
SELECT name FROM sys.databases - Check firewall if using remote server
Symptom: No log files in %LOCALAPPDATA%\DaemonsMCP\Logs\
Solutions:
- Check folder permissions
- Verify Serilog configuration in
Program.cs - Look for startup errors in console output
- Check if
CommonPath.LogsAppPathis correct
- Use
Integrated Security=True(Windows auth) - Keep verbose logging (
Debuglevel) - Use LocalDB for isolated testing
- Enable detailed EF Core logging
- Use dedicated SQL user with minimal permissions
- Store passwords in environment variables or Azure Key Vault
- Set logging to
WarningorErrorlevel - Enable connection pooling
- Use SSL/TLS for database connections (
Encrypt=True) - Restrict CORS to specific domains
- Monitor log files and set up alerts
- Commit
daemonsmcp.jsonwith safe defaults -
Never commit
daemonsmcp.{Environment}.jsonwith secrets - Add to
.gitignore:
daemonsmcp.Development.json
daemonsmcp.Production.json
**/appsettings.*.json
- Use User Secrets for local development
- Document required configuration in README
- Quick Start Tutorial - Learn basic operations
- Database Schema - Understand the data model
- MCP Tools Reference - Explore available tools
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Database=DaemonsMCP;Integrated Security=True;TrustServerCertificate=True;"
},
"Logging": {
"LogLevel": {
"Default": "Information"
}
}
}Then create projects via API:
-
MyWebApp→C:\Code\MyWebApp -
SharedLibrary→C:\Code\SharedLibrary -
MobileApp→C:\Code\MobileApp
Each developer maintains their own daemonsmcp.Development.json:
Developer 1 (LocalDB):
{
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=DaemonsMCP_Dev1;Trusted_Connection=true;"
}
}Developer 2 (Local SQL Express):
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost\\SQLEXPRESS;Database=DaemonsMCP_Dev2;Integrated Security=True;TrustServerCertificate=True;"
}
}Shared SQL Server:
{
"ConnectionStrings": {
"DefaultConnection": "Server=dev-sql-server;Database=DaemonsMCP_Shared;User Id=dev_user;Password=DevPassword123;TrustServerCertificate=True;"
}
}