Complete reference for all 20 MCP configuration management tools in flAPI. These tools enable AI agents to programmatically manage REST API endpoints, SQL templates, and cache configurations at runtime.
The Configuration Service exposes 20 MCP tools organized into 4 functional categories:
- Discovery Tools (5): Read-only introspection of project configuration
- Template Tools (4): SQL template management and testing
- Endpoint Tools (6): CRUD operations for REST endpoints
- Cache Tools (4): Cache status and management operations
All tools use JSON-RPC 2.0 protocol with MCP error codes for standardized error handling.
flapi_*) are only available when the server is started with the --config-service flag. Without this flag, only declarative MCP tools from YAML configurations are accessible.
To enable config MCP tools:
./flapi --config-service
./flapi --config-service --config-service-token "your-token" # With authenticationWhen --config-service is NOT enabled:
- Config tools (
flapi_get_*,flapi_create_*, etc.) will return "Tool not found" errors - Only endpoint-based MCP tools from your YAML configurations are available
- REST configuration API (
/api/v1/_config/*) is also disabled
Error Codes: See MCP Reference § Appendix B for complete MCP error reference.
Authentication: See Configuration Reference § 7 for all authentication schemes and setup.
Read-only tools for introspecting project configuration and database schema.
Get project metadata and configuration information.
Authentication: Not required
Parameters: None
Response (Success):
{
"project_name": "my-api-project",
"project_description": "REST API for customer data",
"base_path": "/home/user/projects/my-api",
"version": "1.0.0"
}Error Response:
{
"error": "Configuration service unavailable"
}Get whitelisted environment variables available to templates.
Authentication: Not required
Parameters: None
Response (Success):
{
"variables": [
{
"name": "DB_HOST",
"value": "localhost"
},
{
"name": "DB_PORT",
"value": "5432"
}
]
}Get directory structure of template and configuration files.
Authentication: Not required
Parameters: None
Response (Success):
{
"base_path": "/home/user/projects/my-api",
"template_path": "/home/user/projects/my-api/sqls",
"tree": [
{
"name": "customers.sql",
"type": "file",
"size": 1024
},
{
"name": "orders.sql",
"type": "file",
"size": 2048
}
]
}Get database schema information for all configured connections.
Authentication: Not required
Parameters: None
Response (Success):
{
"tables": [
{
"name": "customers",
"schema": "public",
"columns": [
{
"name": "id",
"type": "INTEGER",
"nullable": false
},
{
"name": "name",
"type": "VARCHAR",
"nullable": false
}
]
}
]
}Refresh database schema cache by querying all connections.
Authentication: Not required
Parameters: None
Response (Success):
{
"status": "schema_refreshed",
"timestamp": "1704067200",
"message": "Database schema cache has been refreshed"
}Tools for managing and testing SQL templates with Mustache syntax.
Retrieve the SQL template content for an endpoint.
Authentication: Not required
Parameters:
endpoint(string, required): Endpoint identifier or filename (e.g., "customers")
Response (Success):
{
"endpoint": "customers",
"content": "SELECT * FROM customers\nWHERE 1=1\n{{#params.id}}\n AND id = {{{ params.id }}}\n{{/params.id}}",
"message": "Template retrieved"
}Error Response (Endpoint not found):
{
"error": "Endpoint not found",
"endpoint": "customers",
"hint": "Use flapi_list_endpoints to see available endpoints or flapi_create_endpoint to create new one"
}Update the SQL template content for an endpoint (requires authentication).
Authentication: Required
Parameters:
endpoint(string, required): Endpoint identifiercontent(string, required): New template SQL content with Mustache syntax
Response (Success):
{
"endpoint": "customers",
"message": "Template updated successfully",
"content_length": 256
}Error Response (Endpoint not found):
{
"error": "Endpoint not found",
"endpoint": "customers",
"hint": "Use flapi_list_endpoints to see available endpoints"
}Test Mustache template expansion with sample parameters.
Authentication: Not required
Parameters:
endpoint(string, required): Endpoint identifierparams(object, optional): Sample parameters for template expansion
Response (Success):
{
"endpoint": "customers",
"expanded_sql": "SELECT * FROM customers\nWHERE 1=1\n AND id = 123",
"status": "Template expanded successfully"
}Validate template syntax and Mustache syntax.
Authentication: Not required
Parameters:
endpoint(string, required): Endpoint identifier
Response (Success):
{
"endpoint": "customers",
"valid": true,
"message": "Template syntax is valid"
}Error Response (Invalid syntax):
{
"error": "Template syntax error",
"endpoint": "customers",
"reason": "Unclosed Mustache block at line 3"
}CRUD operations for REST endpoint configuration (path, method, template, cache).
List all configured REST and MCP endpoints.
Authentication: Not required
Parameters: None
Response (Success):
{
"count": 2,
"endpoints": [
{
"name": "GetCustomers",
"path": "customers",
"method": "GET",
"type": "rest"
},
{
"name": "ListOrders",
"path": "orders",
"method": "GET",
"type": "rest"
}
]
}Get complete configuration for a specific endpoint.
Authentication: Not required
Parameters:
path(string, required): Endpoint path
Response (Success):
{
"name": "GetCustomers",
"path": "customers",
"method": "GET",
"template_source": "customers.sql",
"connections": ["db-primary"],
"auth_required": false,
"cache_enabled": true
}Error Response (Endpoint not found):
{
"error": "Endpoint not found",
"path": "customers",
"hint": "Use flapi_list_endpoints to see available endpoints"
}Create a new REST endpoint (requires authentication).
Authentication: Required
Parameters:
path(string, required): Endpoint URL path (e.g., "customers")method(string, optional): HTTP method - GET, POST, PUT, DELETE (defaults to GET)template_source(string, optional): SQL template filename
Response (Success):
{
"status": "success",
"path": "customers",
"method": "GET",
"template_source": "customers.sql",
"message": "Endpoint created successfully"
}Error Response (Endpoint exists):
{
"error": "Endpoint already exists",
"path": "customers",
"hint": "Use flapi_update_endpoint to modify existing endpoint, or delete it first with flapi_delete_endpoint"
}Modify an existing endpoint configuration (requires authentication).
Authentication: Required
Parameters:
path(string, required): Endpoint path to updatemethod(string, optional): New HTTP methodtemplate_source(string, optional): New template filename
Response (Success):
{
"status": "success",
"path": "customers",
"message": "Endpoint updated successfully",
"previous_method": "GET",
"new_method": "POST",
"previous_template": "customers.sql",
"new_template": "customers_create.sql"
}Remove an endpoint from configuration (requires authentication).
Authentication: Required
Parameters:
path(string, required): Endpoint path to delete
Response (Success):
{
"status": "success",
"path": "customers",
"message": "Endpoint deleted successfully",
"deleted_method": "GET",
"deleted_template": "customers.sql"
}Hot-reload endpoint configuration from disk without restarting server (requires authentication).
Authentication: Required
Parameters:
path(string, required): Endpoint path to reload
Response (Success):
{
"status": "success",
"path": "customers",
"message": "Endpoint configuration reloaded from disk",
"original_method": "GET",
"original_template": "customers.sql"
}Error Response (Load fails):
{
"error": "Failed to reload endpoint configuration from disk",
"path": "customers",
"hint": "Verify that endpoint YAML file exists and is valid"
}Monitor and manage DuckLake cache for endpoints.
Get cache status and configuration for an endpoint.
Authentication: Not required
Parameters:
path(string, required): Endpoint path
Response (Success):
{
"status": "success",
"path": "customers",
"cache_enabled": true,
"cache_table": "customers_cache",
"cache_schema": "cache_v1"
}Error Response (Cache not enabled):
{
"error": "Cache not enabled for this endpoint",
"path": "customers",
"method": "GET",
"hint": "Enable cache in endpoint YAML configuration and reload endpoint"
}Trigger manual cache refresh for an endpoint (requires authentication).
Authentication: Required
Parameters:
path(string, required): Endpoint path
Response (Success):
{
"path": "customers",
"status": "Cache refresh triggered",
"cache_table": "customers_cache",
"timestamp": "1704067200",
"message": "Cache refresh has been scheduled"
}Get audit log of cache operations and refresh history.
Authentication: Not required
Parameters:
path(string, required): Endpoint path
Response (Success):
{
"path": "customers",
"cache_table": "customers_cache",
"audit_log": [
{
"timestamp": "1704067200",
"event": "cache_refreshed",
"status": "success"
},
{
"timestamp": "1704063600",
"event": "cache_status_checked",
"status": "success"
}
],
"message": "Cache audit log retrieved successfully"
}Trigger garbage collection to clean up old cache snapshots (requires authentication).
Authentication: Required
Parameters:
path(string, optional): Endpoint path for targeted GC (if omitted, runs globally)
Response (Success - Endpoint-specific):
{
"status": "Garbage collection triggered",
"path": "customers",
"timestamp": "1704067200",
"message": "Cache garbage collection for endpoint scheduled"
}Response (Success - Global):
{
"status": "Garbage collection triggered",
"scope": "all_caches",
"timestamp": "1704067200",
"message": "Global cache garbage collection has been scheduled"
}All errors include:
error: Description of what failedpath/method/template: Resource detailsreason: Underlying exception (if applicable)hint: Actionable guidance for resolution
Request:
{
"jsonrpc": "2.0",
"method": "call_tool",
"params": {
"name": "flapi_get_endpoint",
"arguments": {
"path": "nonexistent"
}
}
}Response (Error):
{
"jsonrpc": "2.0",
"error": {
"code": -32603,
"message": "{\"error\":\"Endpoint not found\",\"path\":\"nonexistent\",\"hint\":\"Use flapi_list_endpoints to see available endpoints\"}"
}
}Configuration tools do not have built-in rate limiting but respect server-level rate limits.
- Read operations (list, get, read) are safe for concurrent access
- Write operations (create, update, delete, reload) lock the endpoint configuration
- Cache operations are atomic with respect to the cache table
- Multiple concurrent writes to the same endpoint may see conflicts
-
Always list endpoints first: Use
flapi_list_endpointsto verify endpoint exists before operating on it -
Validate templates before updating: Use
flapi_test_templateto validate syntax beforeflapi_update_template -
Check cache status before refresh: Use
flapi_get_cache_statusto verify cache is enabled before refreshing -
Handle structured errors: Parse error responses for
hintfield to guide users -
Authenticate with correct scheme: Use
Bearerfor JWT tokens,Basicfor credentials,Tokenfor API keys -
Reload after configuration changes: Use
flapi_reload_endpointto apply changes without server restart
- Call
flapi_list_endpointsto see existing endpoints - Call
flapi_create_endpointwith path, method, template_source - Call
flapi_get_endpointto verify creation - Call
flapi_test_templateto validate template
- Call
flapi_get_endpointto see current config - Call
flapi_update_endpointwith new values - Call
flapi_reload_endpointto apply changes - Verify with
flapi_get_endpoint
- Call
flapi_get_cache_statusto check if cache is enabled - Call
flapi_refresh_cacheto manually refresh if needed - Call
flapi_get_cache_auditto review refresh history - Call
flapi_run_cache_gcperiodically to clean up snapshots
These tools implement MCP Configuration Service v1.0 for flAPI.
For integration guidance, see MCP Configuration Integration Guide.
- Configuration Reference - Complete configuration file format and options
- MCP Reference - MCP protocol details and error codes
- MCP Configuration Integration Guide - Integration architecture and flows
- Config Service API Reference - REST API and CLI client
- Reference Documentation Map - Navigation guide for all reference docs