Skip to content

Guard MCP server against foreign or unopened Access instances - #92

Merged
josef-poetzl merged 1 commit into
devfrom
fix/mcp-own-access-instance
Nov 17, 2026
Merged

josef-poetzl merged 1 commit into
devfrom
fix/mcp-own-access-instance

Conversation

@josef-poetzl

Copy link
Copy Markdown
Member

Summary

  • AccessSession.StartAccess records the running Access processes before new Access.Application(). If COM hands out an instance that was already running (e.g. used by another Access automation), the server releases it without Quit/Kill and accunit_open fails with a clear message.
  • After OpenCurrentDatabase the server checks that a database is really open. This failed silently while another Access automation (another MCP server) was running: no error, but CurrentProject was "closed or doesn't exist", which ended in an unhandled COMException. The server now quits its own instance and reports the problem.
  • README: behavior section updated.

Tests

  • New unit tests for AccessInstanceOwnership; all MCP server tests pass (MSBuild, VSTest).
  • Manual: opening and closing a test database while another automated Access instance was running; the foreign instance stayed untouched.
  • The silent open failure itself could not be reproduced on demand, so the root cause is still unknown; both checks are safety nets.

Refuse an Access instance that was already running before the server
requested one and release it without quitting. Quit the own instance and
report an error when OpenCurrentDatabase returns without opening the
database, which was seen while another Access automation was running.
@josef-poetzl
josef-poetzl merged commit 9cfdb43 into dev Nov 17, 2026
1 check passed
@josef-poetzl
josef-poetzl deleted the fix/mcp-own-access-instance branch November 17, 2026 13:47
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.

1 participant