This project is an MCP ( Model Context Protocol ) server created in C#, with support for custom tools. One of the features included is the execution of dynamic queries in a Firebird database with filter and record limit.
- NPX
- C# (.NET 9)
- MCP ( Model Context Protocol )
- FirebirdSql.Data.FirebirdClient
- Dependency Injection via
Host.CreateApplicationBuilder - Configuration via
appsettings.json
Install dependencies by nuget
dotnet add package ModelContextProtocol --prereleaseCreate an appsettings.json file in the project root with the following content:
{
"ConnectionStrings": {
"FirebirdDb": "Database=C:\\yourdata.fdb;User=SYSDBA;Password=masterkey;Dialect=3;Charset=NONE;" }
}π Change the path of the .FDB file according to the location of your database.
π Recommended Project Structure
src/
βββ MCPServer/
β βββ Factory/
β β βββ FbConnectionFactory.cs
β βββ Tools/
β β βββ FbQueries.cs
β βββ Program.cs
β βββ appsettings.json
[McpTool, Description("List all records from a Firebird table")]
public List<Dictionary<string, object>> ListTable(string tableName, string filter = "", int limitRecords = 0)This tool returns records from a Firebird database table with:
π Conditional filter via SQL
π’ Limitation of number of records (using FIRST)
Example of use:
{
"tool": "ListTable",
"args": {
"tableName": "CUSTOMERS",
"filter": "STATUS = 'ACTIVE'",
"limitRecords": 10
}
} npx @modelcontextprotocol/inspector dotnet run
