fix(mcp-server): retrieve collection id to send the right activity log#1559
Open
Scra3 wants to merge 35 commits into
Open
fix(mcp-server): retrieve collection id to send the right activity log#1559Scra3 wants to merge 35 commits into
Scra3 wants to merge 35 commits into
Conversation
* feat(mcp-server): add enabledTools allowlist option Add enabledTools option as an alternative to disabledTools. enabledTools is an allowlist: only listed tools are exposed. New tools released in future versions will NOT be automatically enabled, making it the recommended option for read-only setups. - enabledTools takes priority over disabledTools if both are set - describeCollection is always forced on - Startup logs show which tools are enabled and disabled - Support FOREST_MCP_ENABLED_TOOLS env var for standalone mode - Updated README with both approaches documented Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * feat(mcp-server)!: replace disabledTools with enabledTools only BREAKING CHANGE: `disabledTools` option has been removed. Use `enabledTools` instead. This is an allowlist: only listed tools are exposed. New tools in future releases will NOT be auto-enabled. - Remove disabledTools from ForestMCPServerOptions - Remove FOREST_MCP_DISABLED_TOOLS env var - Rename parse-disabled-tools.ts to parse-tool-list.ts - Simplify resolveEnabledTools (no more blocklist path) - Update agent mountAiMcpServer to only accept enabledTools Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * test(mcp-server): fix enabledTools tests and add empty array edge case - Fix port conflicts using getAvailablePort() - Replace no-op logging test with empty enabledTools edge case test - Verify enabledTools: [] only exposes describeCollection Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * feat(mcp-server): add warning and discovery logs for enabledTools - Warn when describeCollection is missing from enabledTools (auto-added) - Log available tools not enabled for discoverability on new releases Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(mcp-server): validate enabledTools names and fix test port conflicts - Warn about unknown tool names in enabledTools (typo protection) - Fix test port conflicts by using buildExpressApp + listen instead of run() Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * chore(example): revert mountAiMcpServer to default (no options) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs(mcp-server): clarify read-only is an example of enabledTools usage Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> --------- Co-authored-by: alban bertolini <[email protected]> Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
* fix(datasource-mongo): fix flaky create integration test - Await connection.dropDatabase() instead of fire-and-forget - Add explicit Movie.createCollection() before saving data The test was flaky because introspection could run before the collection existed, resulting in "Collection 'movies' not found". * fix(datasource-mongo): fix same flaky pattern in SSH integration test
## @forestadmin/datasource-mongo [1.6.9](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/[email protected]...@forestadmin/[email protected]) (2026-04-14) ### Bug Fixes * **datasource-mongo:** fix flaky create integration test ([#1550](#1550)) ([ef90e90](ef90e90))
# @forestadmin/mcp-server [2.0.0](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/[email protected]...@forestadmin/[email protected]) (2026-04-14) ### Features * **mcp-server:** add enabledTools allowlist option ([#1547](#1547)) ([fc5127a](fc5127a)) ### BREAKING CHANGES * **mcp-server:** `disabledTools` option has been removed. Use `enabledTools` instead. This is an allowlist: only listed tools are exposed. New tools in future releases will NOT be auto-enabled. - Remove disabledTools from ForestMCPServerOptions - Remove FOREST_MCP_DISABLED_TOOLS env var - Rename parse-disabled-tools.ts to parse-tool-list.ts - Simplify resolveEnabledTools (no more blocklist path) - Update agent mountAiMcpServer to only accept enabledTools Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * test(mcp-server): fix enabledTools tests and add empty array edge case - Fix port conflicts using getAvailablePort() - Replace no-op logging test with empty enabledTools edge case test - Verify enabledTools: [] only exposes describeCollection Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * feat(mcp-server): add warning and discovery logs for enabledTools - Warn when describeCollection is missing from enabledTools (auto-added) - Log available tools not enabled for discoverability on new releases Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(mcp-server): validate enabledTools names and fix test port conflicts - Warn about unknown tool names in enabledTools (typo protection) - Fix test port conflicts by using buildExpressApp + listen instead of run() Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * chore(example): revert mountAiMcpServer to default (no options) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs(mcp-server): clarify read-only is an example of enabledTools usage Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
# @forestadmin/agent [2.0.0](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/[email protected]...@forestadmin/[email protected]) (2026-04-14) ### Features * **mcp-server:** add enabledTools allowlist option ([#1547](#1547)) ([fc5127a](fc5127a)) ### BREAKING CHANGES * **mcp-server:** `disabledTools` option has been removed. Use `enabledTools` instead. This is an allowlist: only listed tools are exposed. New tools in future releases will NOT be auto-enabled. - Remove disabledTools from ForestMCPServerOptions - Remove FOREST_MCP_DISABLED_TOOLS env var - Rename parse-disabled-tools.ts to parse-tool-list.ts - Simplify resolveEnabledTools (no more blocklist path) - Update agent mountAiMcpServer to only accept enabledTools Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * test(mcp-server): fix enabledTools tests and add empty array edge case - Fix port conflicts using getAvailablePort() - Replace no-op logging test with empty enabledTools edge case test - Verify enabledTools: [] only exposes describeCollection Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * feat(mcp-server): add warning and discovery logs for enabledTools - Warn when describeCollection is missing from enabledTools (auto-added) - Log available tools not enabled for discoverability on new releases Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(mcp-server): validate enabledTools names and fix test port conflicts - Warn about unknown tool names in enabledTools (typo protection) - Fix test port conflicts by using buildExpressApp + listen instead of run() Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * chore(example): revert mountAiMcpServer to default (no options) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs(mcp-server): clarify read-only is an example of enabledTools usage Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> ### Dependencies * **@forestadmin/mcp-server:** upgraded to 2.0.0
## @forestadmin/agent-testing [1.1.8](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/[email protected]...@forestadmin/[email protected]) (2026-04-14) ### Dependencies * **@forestadmin/agent:** upgraded to 2.0.0
## @forestadmin/forest-cloud [1.12.109](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/[email protected]...@forestadmin/[email protected]) (2026-04-14) ### Dependencies * **@forestadmin/agent:** upgraded to 2.0.0 * **@forestadmin/datasource-mongo:** upgraded to 1.6.9
## @forestadmin/datasource-customizer [1.69.3](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/[email protected]...@forestadmin/[email protected]) (2026-04-15) ### Bug Fixes * **vulnerability:** use magic-bytes instead of FileType ([#1554](#1554)) ([4f9c004](4f9c004))
## @forestadmin/datasource-dummy [1.1.69](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/[email protected]...@forestadmin/[email protected]) (2026-04-15) ### Dependencies * **@forestadmin/datasource-customizer:** upgraded to 1.69.3
## @forestadmin/plugin-aws-s3 [1.5.13](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/[email protected]...@forestadmin/[email protected]) (2026-04-15) ### Dependencies * **@forestadmin/datasource-customizer:** upgraded to 1.69.3
## @forestadmin/plugin-export-advanced [1.1.43](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/[email protected]...@forestadmin/[email protected]) (2026-04-15) ### Dependencies * **@forestadmin/datasource-customizer:** upgraded to 1.69.3
## @forestadmin/plugin-flattener [1.4.27](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/[email protected]...@forestadmin/[email protected]) (2026-04-15) ### Dependencies * **@forestadmin/datasource-customizer:** upgraded to 1.69.3
## @forestadmin/datasource-replica [1.8.8](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/[email protected]...@forestadmin/[email protected]) (2026-04-15) ### Dependencies * **@forestadmin/datasource-customizer:** upgraded to 1.69.3
## @forestadmin/agent [2.0.1](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/[email protected]...@forestadmin/[email protected]) (2026-04-15) ### Dependencies * **@forestadmin/datasource-customizer:** upgraded to 1.69.3
## @forestadmin/agent-testing [1.1.9](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/[email protected]...@forestadmin/[email protected]) (2026-04-15) ### Dependencies * **@forestadmin/datasource-customizer:** upgraded to 1.69.3 * **@forestadmin/agent:** upgraded to 2.0.1
## @forestadmin/forest-cloud [1.12.110](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/[email protected]...@forestadmin/[email protected]) (2026-04-15) ### Dependencies * **@forestadmin/agent:** upgraded to 2.0.1 * **@forestadmin/datasource-customizer:** upgraded to 1.69.3
|
Coverage Impact ⬇️ Merging this pull request will decrease total coverage on Modified Files with Diff Coverage (5)
🤖 Increase coverage with AI coding...🚦 See full report on Qlty Cloud » 🛟 Help
|
The MCP server sends collection names (e.g. "Address") instead of collection IDs because it doesn't have access to internal IDs. The server-side endpoint resolves the name to an ID before storing. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…ion-name endpoint Falls back to the default /api/activity-logs-requests endpoint if the /by-collection-name endpoint returns 404 (server not yet updated). Prevents MCP operations from being blocked during deployment. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…lazy cache Replace the /by-collection-name endpoint approach with a lazy cache that resolves collection names to IDs via GET /api/renderings/:id/collections/:name/id. The cache lives for the lifetime of the process. Falls back to sending the name if the server endpoint is not available. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…nId + add tests - Only catch NotFoundError (server not updated), propagate all other errors - Add tests for: resolution, cache hit, 404 fallback, error propagation Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
… to mcp-server - Add getCollectionId to ForestHttpApi and ForestAdminServerInterface (HTTP call stays in forestadmin-client for cloud mockability) - Add getCollectionId to ForestServerClient interface in mcp-server - Cache collectionName→collectionId resolution in activity-logs-creator - Revert forestadmin-client/activity-logs to original state (no cache) - Only catch NotFoundError for fallback (server not updated) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
ForestServerClientImpl stays at 2 params. getCollectionId is now on ActivityLogsService (which already has forestServerUrl), delegating to ForestHttpApi. No need to pass forestServerUrl to the constructor. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
… routes) - Route moved to /liana/renderings/:id/collections/:name/id - Uses forest-secret-key header (envSecret) instead of bearer token - No ensureAuthenticated middleware needed - Consistent with getSchema, getIpWhitelistRules, etc. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…tionId Align with SchemaService pattern: declare envSecret in ActivityLogsOptions type (it was already passed at runtime), use toHttpOptions() helper. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Consistent with createActivityLog and updateActivityLogStatus. Remove optional guards. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Required since getCollectionId is now mandatory in ActivityLogsServiceInterface. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…face Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
a290a8f to
a9a1ba9
Compare
… tests - Guard in ActivityLogsService.getCollectionId for implementations that don't provide the method - Tests for: successful resolution, null fallback, NotFoundError fallback, error propagation Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…tionId Cover both paths: successful delegation to interface and fallback when getCollectionId is not implemented. Brings coverage to 100%. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Cover the cache hit path in resolveCollectionId and the error logging path in markActivityLogAsSucceeded. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
/api/activity-logs-requests/by-collection-nameinstead of/api/activity-logs-requestsresolveCollectionNameoption toActivityLogsServiceandcreatePathtoActivityLogHttpOptionsContext: The MCP server sends collection names (e.g.
"Address") because it doesn't have access to internal collection IDs. This caused the collection field to appear blank in the Activity Logs UI.Depends on: ForestAdmin/forestadmin-server#8163 (new server endpoint)
Test plan
🤖 Generated with Claude Code
Note
Fix MCP server activity logs to send collection ID instead of collection name
getCollectionId(renderingId, collectionName)toActivityLogsServiceandForestHttpApi, fetching the collection ID from/liana/renderings/{renderingId}/collections/{name}/id.createPendingActivityLogin the MCP server to resolve the collection name to its ID before sending the activity log, falling back to the name when the ID cannot be resolved.nullonNotFoundErrorand propagates other errors.Macroscope summarized db1d81f.