Merge pull request #2314 from DuendeSoftware/mb/mcp

Add support for configurable database path and update README with usage instructions
This commit is contained in:
Maarten Balliauw 2026-01-07 22:56:11 +01:00 committed by GitHub
commit 71d8961a2a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 46 additions and 1 deletions

View file

@ -34,6 +34,21 @@ Alternatively, you can add a `.vscode/mcp.json` file to your workspace:
}
```
You can also add the `--database` parameter with a path to the database file to use:
```json
{
"servers": {
"duende-mcp": {
"type": "stdio",
"command": "dnx",
"args": ["Duende.Documentation.Mcp", "--yes", "--", "--database", "/path/to/database.db"],
"env": {}
}
}
}
```
Open GitHub Copilot and select Agent Mode to work with the MCP server.
### JetBrains Rider
@ -64,6 +79,19 @@ Set the working directory to a path on your machine where the Duende Documentati
index. Not setting the working directory will result in the MCP server failing to start because it cannot create the
database file.
Alternatively, you can add the `--database` parameter with a path to the database file to use:
```json
{
"mcpServers": {
"duende-mcp": {
"command": "dnx",
"args": ["Duende.Documentation.Mcp", "--yes", "--", "--database", "/path/to/database.db"]
}
}
}
```
## Tools and Example Prompts
The Duende Documentation MCP Server has several tools available:

View file

@ -20,9 +20,24 @@ builder.Logging.AddConsole(consoleLogOptions =>
consoleLogOptions.LogToStandardErrorThreshold = LogLevel.Trace;
});
// Determine database path
var databasePath = "mcp.db";
if (args.Length > 0)
{
var dbParameterIndex = args.IndexOf("--database");
if (dbParameterIndex >= 0 && args.Length > dbParameterIndex + 1)
{
var dbPathParameter = args[dbParameterIndex + 1].Replace("\"", "", StringComparison.OrdinalIgnoreCase);
if (Path.IsPathFullyQualified(dbPathParameter))
{
databasePath = dbPathParameter;
}
}
}
// Setup services
builder.Services.AddHttpClient();
builder.Services.AddSqlite<McpDb>("Data Source=mcp.db;Cache=Shared");
builder.Services.AddSqlite<McpDb>("Data Source=" + databasePath + ";Cache=Shared");
builder.Services.AddHostedService<DocsArticleIndexer>();
builder.Services.AddHostedService<BlogArticleIndexer>();
@ -73,6 +88,8 @@ async Task EnsureDb(IServiceProvider services, ILogger logger)
await using var db = scope.ServiceProvider.GetRequiredService<McpDb>();
if (db.Database.IsRelational())
{
logger.LogInformation("Using database: {DatabasePath}", databasePath);
logger.LogInformation("Updating database...");
await db.Database.MigrateAsync();
logger.LogInformation("Updated database");