High-performance recutils database MCP (Model Context Protocol) tool implemented in Go, providing type-safe operations.
GNU Recutils is a lightweight text-based database toolkit that stores structured data in plain text files. Key features include:
- Human-readable - Data stored in plain text format, easy to read and edit
- Typed records - Supports multiple record types, similar to tables in relational databases
- Powerful queries - Provides SQL-like query language (
recsel) - Serverless - No database server process required, zero dependencies
- VCS-friendly - Text format naturally supports Git and other version control tools
- β High Performance - Compiled language, 2x faster startup, 50% less memory usage
- β Type Safety - Compile-time checking, fewer runtime errors
- β Simple Deployment - Single binary file (~7.3MB), no runtime environment required
- β Concurrency Support - goroutine provides better concurrency performance
- β Complete Functionality - Support for query, insert, update, delete, and get database info
- β MCP Protocol - Complies with Model Context Protocol standard
- Go 1.21+ (for development)
- recutils tool package (for runtime)
# Install recutils
# Ubuntu/Debian
sudo apt-get install recutils
# macOS
brew install recutils# Install directly to GOBIN
go install github.com/nixihz/recutils-mcp@latest
# The binary will be installed to $GOBIN (default: ~/go/bin)
# Add to PATH if needed:
export PATH=$PATH:$(go env GOBIN)
# Run the server
recutils-mcp# 1. Clone the repository
git clone https://github.com/nixihz/recutils-mcp.git
cd recutils-mcp
# 2. Install dependencies
go mod download
# 3. Run tests
make test
# 4. Build project
make build
# 5. Run server
./recutils-mcpAdd the following configuration to Claude Desktop's config file:
{
"mcpServers": {
"recutils": {
"command": "$(go env GOBIN)/recutils-mcp",
"args": []
}
}
}Note: Replace
$(go env GOBIN)/recutils-mcpwith the actual path if you installed it elsewhere. On macOS/Linux withgo install, the default path is~/go/bin/recutils-mcp.
make all # Run tests and build
make test # Run all tests
make test-cover # Run tests with coverage
make build # Build binary
make clean # Clean build files
make fmt # Format code
make vet # Static check
make bench # Benchmark test
make security # Security check
make help # Show help| Tool Name | Description | Parameters |
|---|---|---|
recutils_query |
Query records | database_file, query_expression (optional), output_format (optional) |
recutils_insert |
Insert record | database_file, record_type, fields |
recutils_update |
Update records | database_file, query_expression, fields |
recutils_delete |
Delete records | database_file, query_expression |
recutils_info |
Get database info | database_file |
# 1. Start server
./recutils-mcp
# 2. Call tools via MCP client (Example JSON)
# Query records
{
"method": "tools/call",
"params": {
"name": "recutils_query",
"arguments": {
"database_file": "example.rec",
"query_expression": "Name = 'John Doe'"
}
}
}
# Insert records
{
"method": "tools/call",
"params": {
"name": "recutils_insert",
"arguments": {
"database_file": "example.rec",
"record_type": "Person",
"fields": {
"Name": "John Doe",
"Age": 25,
"City": "New York"
}
}
}
}package main
import (
"context"
"fmt"
"github.com/nixihz/recutils-mcp/recutils"
)
func main() {
ctx := context.Background()
op := recutils.NewRecordOperation()
// Insert record
result, err := op.InsertRecord(ctx, "test.rec", "Person", map[string]interface{}{
"Name": "John Doe",
"Age": 25,
})
if err != nil {
fmt.Printf("Error: %v\n", err)
return
}
fmt.Printf("Insert successful: %+v\n", result)
// Query records
queryResult, err := op.QueryRecords(ctx, "test.rec", "", "")
if err != nil {
fmt.Printf("Error: %v\n", err)
return
}
fmt.Printf("Query result: %+v\n", queryResult)
}recutils-mcp/
βββ go.mod # Go module definition
βββ main.go # Main entry point
βββ README.md # Project documentation (this file)
βββ Makefile # Build script
βββ build.sh # Build script
βββ .gitignore # Git ignore file
βββ recutils/
β βββ operations.go # recutils operations encapsulation
βββ server/
βββ mcp_server.go # MCP server implementation
βββ mcp_server_test.go # Test code
recutils database files must follow specific format:
%rec: Person
Name: John Doe
Age: 25
City: New York
Name: Jane Smith
Age: 30
Format requirements:
%rec:must be followed by a blank line- Field format:
field_name: value - Records must be separated by blank lines
- Important: Records must end with newline (fixed)
# Run all tests
go test ./... -v
# Run specific test
go test -run TestMCPServer -v
# Test coverage
go test ./... -cover
# Benchmark test
go test -bench=. ./...=== RUN TestMCPServer
--- PASS: TestMCPServer (0.04s)
β QueryRecords
β GetDatabaseInfo
β InsertRecord
β VerifyInsert
=== RUN TestMCPServerIntegration
--- PASS: TestMCPServerIntegration (0.05s)
β FullWorkflow
PASS
Check if recutils is installed:
recsel --versionEnsure database files have read/write permissions:
chmod 644 database.recUse recsel to verify file format:
recsel your_database.recContributions are welcome! Please read CONTRIBUTING.md for details.
MIT License
- v1.0.0 - Initial release
- Go language refactoring
- Full MCP protocol support
- Fixed database file format issues
- 2x performance improvement
Recommended for production use! π