Add get_user MCP Tool and service

What does this MR do and why?

Adds a new read-only MCP server tool, get_user, following the existing GraphQL tool and service pattern.

The tool looks up a user by exactly one of username, id, or me: true for the current authenticated user. It returns the user's numeric ID, username, name, state, and web URL.

Agents need numeric user IDs to set assignees or reviewers in other MCP tools. The existing search tool is too heavyweight for this. The me: true option also lets an agent find its own user ID.

The tool runs with the calling user's permissions. If the user is unknown or not accessible, it returns a generic "not found or inaccessible" error.

Documentation will follow in a separate MR.

References

Screenshots or screen recordings

No UI changes.

How to set up and validate locally

  1. Restart rails: gdk restart rails-web

  2. Create a personal access token with api and mcp scopes.

  3. Call the tool over JSON-RPC:

    curl -k -X POST "$GDK_URL/api/v4/mcp" \
      -H "Authorization: Bearer $TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_user","arguments":{"me":true}}}'

    You can also use username or id instead of me.

  4. Or run the specs: bundle exec rspec spec/services/mcp/tools/users/

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Alex Filatov

Merge request reports

Loading
Loading