Skip to content

Feature Request: MCP Tools for Configuration Management (Operate flAPI via MCP) #11

@jrosskopf

Description

@jrosskopf

📋 Summary

Enable AI agents to manage and operate flAPI configurations through MCP tools. While flAPI already supports creating MCP tools on top of data, this feature adds MCP tools to operate flAPI itself - allowing AI agents to introspect, create, modify, and manage API endpoints, templates, caches, and project configurations.

🎯 Motivation

Currently, flAPI management is done through:

  • The REST-based Config Service API (/api/v1/_config/*)
  • The flapii CLI
  • The VS Code Extension

AI agents (e.g., Claude, Cursor, Windsurf) that work with flAPI projects would greatly benefit from being able to:

  • Discover and introspect existing endpoints
  • Create new API endpoints declaratively
  • Test and validate SQL templates
  • Manage cache refreshes and retention
  • Query database schemas for intelligent suggestions

This turns flAPI into a first-class citizen in AI-assisted development workflows, enabling agents to not just consumeflAPI-created tools, but also create and manage them.

🔧 Proposed MCP Tools

The following MCP tools should wrap the existing Config Service handlers (reusing the logic from config_service.cpp):

Project & Configuration Discovery

MCP Tool | Description | Maps to Config Service -- | -- | -- flapi_get_project_config | Get current project configuration | GET /api/v1/_config/project flapi_get_environment_variables | List available environment variables | GET /api/v1/_config/environment-variables flapi_get_filesystem_structure | Get template directory tree with YAML type detection | GET /api/v1/_config/filesystem flapi_get_schema | Introspect database schema (tables, columns, types) | GET /api/v1/_config/schema flapi_refresh_schema | Refresh database schema cache | POST /api/v1/_config/schema/refresh

📐 Implementation Approach

  1. Reuse Existing Handler Logic: The MCP tools should delegate to the existing ConfigService handlers (FilesystemHandler, SchemaHandler, EndpointConfigHandler, TemplateHandler, CacheConfigHandler, etc.) rather than duplicating logic.

  2. Align with CLI Commands: Tool naming and behavior should mirror flapii CLI commands where applicable for consistency.

  3. Extend Existing MCP Infrastructure: Build on the current MCP server implementation that already handles mcp-tool and mcp-resource definitions.

  4. Authentication: Respect the existing Config Service token authentication (X-Config-Token / Authorization: Bearer).

  5. Tool Discovery: These tools should be automatically registered when the MCP server starts, similar to how declarative MCP tools from YAML configs are registered.

💡 Example Usage

An AI agent could use these tools to:

Agent: "Create a new API endpoint for querying orders by customer ID"
  1. flapi_get_schema() → Understand available tables/columns
  2. flapi_list_endpoints() → Check existing patterns
  3. flapi_create_endpoint() → Create new endpoint YAML
  4. flapi_update_template() → Write the SQL template
  5. flapi_test_template() → Validate with sample parameters
  6. flapi_reload_endpoint() → Hot-reload without restart

🔗 Related

  • Existing Config Service: src/config_service.cpp
  • MCP Server Implementation: src/mcp_server.cpp
  • CLI: cli/ directory
  • VS Code Extension: Uses Config Service REST API

✅ Acceptance Criteria

  • All Config Service operations are exposed as MCP tools
  • Tools follow the same input/output schemas as the REST API
  • Tools are auto-registered on MCP server startup
  • Authentication is enforced consistently
  • Documentation updated with new MCP tool definitions
  • Integration tests for MCP tool operations

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions