MCPServerCSharp logo

MCPServerCSharp

by BoscoBecker

This project is an MCP (Modular Command Platform) server created in C#, with support for custom tools. It includes features like executing dynamic queries in a Firebird database with filter and record limit.

View on GitHub

Last updated: N/A

šŸ› ļø MCP Server with C# + Firebird

This project is an MCP (Modular Command Platform) 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.


šŸ“¦ Technologies Used

  • NPX
  • C# (.NET 9)
  • MCP (Modular Command Platform)
  • FirebirdSql.Data.FirebirdClient
  • Dependency Injection via Host.CreateApplicationBuilder
  • Configuration via appsettings.json

āš™ļø Configuration

Install dependencies by nuget

dotnet add package ModelContextProtocol --prerelease

šŸ”§ appsettings.json File

Create 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

🧩 MCP Tool Available

šŸ” ListTable

[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)

{DF1F6239-E983-45A0-87E3-645291A6D2C7}

{DF1F6239-E983-45A0-87E3-645291A6D2C7}

Example of use:

{
  "tool": "ListTable",
  "args": {
    "tableName": "CUSTOMERS",
    "filter": "STATUS = 'ACTIVE'",
    "limitRecords": 10
  }
}

Run MCP server

  npx @modelcontextprotocol/inspector dotnet run

{58D6C0FD-B032-48FC-9F16-8769A9403E82}

{58D6C0FD-B032-48FC-9F16-8769A9403E82}