LearnNewsExamplesServices
Frontmatter
id7626
titleCache Viewer Permission on Server Startup
stateClosed
labels
enhancementai
assigneestobiu
createdAtOct 23, 2025, 5:06 PM
updatedAtOct 23, 2025, 5:19 PM
githubUrlhttps://github.com/neomjs/neo/issues/7626
authortobiu
commentsCount0
parentIssue7604
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtOct 23, 2025, 5:19 PM

Cache Viewer Permission on Server Startup

Closed v11.0.0 enhancementai
tobiu
tobiu commented on Oct 23, 2025, 5:06 PM

As part of the epic to automate MCP server startup and reduce agent protocol (#7604), we should proactively fetch and cache the user's permission level for the repository when the github-workflow server starts. Currently, an agent would need to explicitly call the get_viewer_permission tool, which is an unnecessary extra step.

By fetching this information on startup, we simplify the agent's workflow and make the permission data readily available to all internal services.

Proposed Solution

  1. Add a Cache Field: In ai/mcp/server/github-workflow/services/RepositoryService.mjs, add a new class field to the singleton, such as viewerPermission = null;, to hold the permission string.

  2. Fetch on Startup: In ai/mcp/server/github-workflow/mcp-stdio.mjs, modify the main() startup function. After the initial health check, call the RepositoryService.getViewerPermission() method once and store its result in the new viewerPermission field on the RepositoryService singleton.

  3. Refactor getViewerPermission Tool: Modify the getViewerPermission method in RepositoryService to be a simple, synchronous getter. Instead of making a GraphQL call, it should just return the value cached in the viewerPermission field. The actual GraphQL call will be moved to a new private method (e.g., #fetchViewerPermission) used only during startup.

Acceptance Criteria

  • When the github-workflow server starts, it makes one call to determine the viewer's permission level.
  • The permission level is stored on the RepositoryService singleton.
  • The get_viewer_permission tool reads from the cached value and does not make a new API call.
  • Other services can import RepositoryService and access the permission level directly (e.g., RepositoryService.viewerPermission).
tobiu assigned to @tobiu on Oct 23, 2025, 5:06 PM
tobiu added parent issue #7604 on Oct 23, 2025, 5:06 PM
tobiu added the enhancement label on Oct 23, 2025, 5:06 PM
tobiu added the ai label on Oct 23, 2025, 5:06 PM
tobiu referenced in commit 9f99f71 - "Cache Viewer Permission on Server Startup #7626" on Oct 23, 2025, 5:18 PM
tobiu closed this issue on Oct 23, 2025, 5:19 PM