Skip to content

Add configurable maxExchanges property for MCP tools#2935

Merged
predic8 merged 2 commits intomasterfrom
mcp-exchange-config
May 5, 2026
Merged

Add configurable maxExchanges property for MCP tools#2935
predic8 merged 2 commits intomasterfrom
mcp-exchange-config

Conversation

@christiangoerdes
Copy link
Copy Markdown
Collaborator

@christiangoerdes christiangoerdes commented May 5, 2026

Summary by CodeRabbit

  • New Features
    • The MCP server's maximum exchange limit is now configurable through settings, replacing the hardcoded default of 100. Administrators can customize this value to optimize memory usage and query performance based on deployment requirements.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7a6ae7cb-a2ef-40a2-be4c-3b26283f59aa

📥 Commits

Reviewing files that changed from the base of the PR and between baabb97 and 5fe032b.

📒 Files selected for processing (1)
  • core/src/main/java/com/predic8/membrane/core/interceptor/mcp/MembraneMCPServer.java

📝 Walkthrough

Walkthrough

The MembraneMCPServer class now makes the getExchanges tool limit configurable via an instance field maxExchanges (default 100) instead of a compile-time constant. The tool schema is generated dynamically from this field, and a setter validates the value while rebuilding the tool registry to keep schemas in sync.

Changes

Configurable Exchange Limit

Layer / File(s) Summary
Configuration Field
core/src/main/java/com/predic8/membrane/core/interceptor/mcp/MembraneMCPServer.java (lines 4–59)
Instance field maxExchanges replaces fixed MAX_EXCHANGES constant; toolRegistry changed from final to mutable. Import added for MCAttribute annotation.
Schema Generation
core/src/main/java/com/predic8/membrane/core/interceptor/mcp/MembraneMCPServer.java (lines 258–285)
New method getExchangesSchema() dynamically builds the tool schema using the current maxExchanges value instead of a static schema.
Configurable Accessor
core/src/main/java/com/predic8/membrane/core/interceptor/mcp/MembraneMCPServer.java (lines 258–285)
Added public getter getMaxExchanges() and @MCAttribute-annotated setter setMaxExchanges(int) that validates >= 1, updates the field, and rebuilds toolRegistry.
Tool Registration & Usage
core/src/main/java/com/predic8/membrane/core/interceptor/mcp/MembraneMCPServer.java (lines 204–209, 238–256)
Tool registration now calls getExchangesSchema() instead of static schema. The getExchanges method validates the optional limit parameter against maxExchanges instead of removed constant.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A limit once fixed in stone,
Now dances free, a field of its own!
Schema rebuilt with each twist and turn,
Configurability's the lesson we learn. ✨

✨ 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 mcp-exchange-config

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@predic8 predic8 merged commit 549e827 into master May 5, 2026
2 checks passed
@predic8 predic8 deleted the mcp-exchange-config branch May 5, 2026 08:52
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