Skip to content

feat: add metadata_ttl MCP config parameter#327

Open
rshoemaker wants to merge 2 commits intomainfrom
feat/PLAT-534/mcp-metadata-ttl
Open

feat: add metadata_ttl MCP config parameter#327
rshoemaker wants to merge 2 commits intomainfrom
feat/PLAT-534/mcp-metadata-ttl

Conversation

@rshoemaker
Copy link
Copy Markdown
Contributor

@rshoemaker rshoemaker commented Apr 3, 2026

Summary

  • Add metadata_ttl to the MCP service config known keys, typed struct, and parsing pipeline
  • Pass the parameter through to the MCP container YAML config
  • Update docs with the new field under "Connection Pool and Caching"

Test plan

  • make test passes
  • Create MCP service with "metadata_ttl": "10m" — config.yaml should contain metadata_ttl: 10m
  • Create MCP service without metadata_ttl — field should be absent from config.yaml (MCP server defaults to 5m)
  • Create MCP service with "metadata_ttl": 300 (wrong type) — should return validation error

PLAT-534

Allow users to configure how long the MCP server caches database
metadata. The parameter is an optional string (e.g. "5m", "1h")
passed through to the MCP container config. When omitted, the MCP
server defaults to 5 minutes.
@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Apr 3, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 329e63fa-8807-4cb8-b6f8-cebdb30a7b44

📥 Commits

Reviewing files that changed from the base of the PR and between 991825c and f2a24b1.

📒 Files selected for processing (1)
  • server/internal/orchestrator/swarm/mcp_config_test.go

📝 Walkthrough

Walkthrough

Added an optional metadata_ttl configuration field across MCP docs, config parsing, tests, and YAML generation; renamed a docs section to include caching and documented the default "5m" and TTL formats.

Changes

Cohort / File(s) Summary
Documentation
docs/services/mcp.md
Renamed "Connection Pool" to "Connection Pool and Caching". Documented metadata_ttl with default "5m" and example TTL formats; expanded table to include pool_max_conns default and metadata_ttl.
Config parsing & tests
server/internal/database/mcp_service_config.go, server/internal/database/mcp_service_config_test.go
Added MetadataTTL *string to MCPServiceConfig. Updated ParseMCPServiceConfig to accept metadata_ttl. Extended tests to cover valid string, omission, and invalid-type error cases.
Orchestrator YAML generation & tests
server/internal/orchestrator/swarm/mcp_config.go, server/internal/orchestrator/swarm/mcp_config_test.go
Added MetadataTTL field to emitted mcpDatabaseConfig. GenerateMCPConfig now propagates the value when set. Tests verify YAML contains the field when provided and omits it when unset.

Poem

🐇 I tuck TTLs in a cozy log, five minutes snug and neat,
I hop from docs to parser pads, to YAML's tidy sheet,
A tiny cached heartbeat hums, metadata stays light,
Hooray — the MCP now naps well through day and quiet night.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a new metadata_ttl configuration parameter to MCP config, which aligns with all the code changes across documentation and multiple service files.
Description check ✅ Passed The PR description includes all required template sections: Summary (explaining the core changes), Test plan (detailing manual and automated testing), and issue link (PLAT-534). While lacking explicit 'Changes' section and checklist, the content covers all essential information needed for review.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/PLAT-534/mcp-metadata-ttl

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@server/internal/orchestrator/swarm/mcp_config_test.go`:
- Around line 248-265: The test TestGenerateMCPConfig_MetadataTTL_Omitted should
assert omission from the raw YAML rather than just the unmarshaled zero value:
after calling GenerateMCPConfig(params) inspect the returned data bytes/string
for the absence of the literal key "metadata_ttl:" (or ensure it is not present
under the first database entry) before or in addition to using parseYAML; update
the test to fail if the raw YAML contains "metadata_ttl:" so you catch
regressions in omitempty behavior for GenerateMCPConfig and the struct field
used for MetadataTTL.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b397221e-fb7a-42b6-9f2d-f43f610eec2b

📥 Commits

Reviewing files that changed from the base of the PR and between 63c54b8 and 991825c.

📒 Files selected for processing (5)
  • docs/services/mcp.md
  • server/internal/database/mcp_service_config.go
  • server/internal/database/mcp_service_config_test.go
  • server/internal/orchestrator/swarm/mcp_config.go
  • server/internal/orchestrator/swarm/mcp_config_test.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants