feat: implement local MCP server - #179
Conversation
Deploying polyratings with
|
| Latest commit: |
b54d710
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://016d7659.polyratings.pages.dev |
| Branch Preview URL: | https://mcp.polyratings.pages.dev |
cd51222 to
5e6f901
Compare
|
View your CI Pipeline Execution ↗ for commit b54d710
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Pull request overview
This PR adds a new @polyratings/mcp-server package to run a local MCP server (stdio transport) that exposes read-only public tools and authenticated admin moderation/inspection tools over the existing tRPC backend, alongside a small backend admin API expansion and monorepo dependency version standardization.
Changes:
- Added
@polyratings/mcp-serverwith MCP tool registrations, backend tRPC client wrapper, docs, and an interactive token helper script. - Extended backend admin router with
getRatingsByAnonymousIdentifierand refined bulk rating deletion/report cleanup behavior. - Standardized internal monorepo dependency versions (e.g.
@polyratings/backend,@polyratings/eslint-config) to"*"and updated repo docs/ignores accordingly.
Reviewed changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/mcp-server/tsconfig.json | TS config for the new MCP server package (strict, noEmit, backend path alias). |
| packages/mcp-server/src/index.ts | MCP server entrypoint registering public + admin tools over stdio. |
| packages/mcp-server/src/backendClient.ts | Typed tRPC proxy client + helper logic for listing professors/reports and admin actions. |
| packages/mcp-server/scripts/get-token.sh | Interactive helper to obtain an admin JWT via auth.login. |
| packages/mcp-server/package.json | New package metadata + dev/build scripts and dependencies. |
| packages/mcp-server/README.md | Setup/config/docs for running and integrating with Cursor MCP. |
| packages/mcp-server/.gitignore | Ignores dist/ for the new package. |
| packages/backend/src/routers/admin.ts | Adds getRatingsByAnonymousIdentifier admin endpoint + adjusts bulk deletion/report cleanup behavior. |
| packages/backend/package.json | Standardizes internal eslint-config dependency version to "*". |
| packages/frontend/package.json | Standardizes internal backend + eslint-config dependency versions to "*". |
| packages/cron/package.json | Standardizes internal backend + eslint-config dependency versions to "*". |
| AGENTS.md | Documents the new MCP server package and its dev/build commands. |
| .gitignore | Adds .cursor/mcp.json to ignored files. |
| package-lock.json | Lockfile updates for the new MCP server package and dependency graph changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| professorName: professor | ||
| ? `${String(professor.lastName ?? "")}, ${String(professor.firstName ?? "")}` | ||
| : null, | ||
| professorDepartment: professor ? (professor.department ?? null) : null, | ||
| rating: found?.rating.rating ?? null, | ||
| ratingCourse: found?.course ?? null, | ||
| ratingBy: found?.rating.anonymousIdentifier ?? null, | ||
| ratingOverall: found?.rating.overallRating ?? null, | ||
| ratingPresentsMaterialClearly: found?.rating.presentsMaterialClearly ?? null, | ||
| ratingRecognizesStudentDifficulties: | ||
| found?.rating.recognizesStudentDifficulties ?? null, | ||
| reports: report.reports, |
| department: z | ||
| .string() | ||
| .optional() | ||
| .describe("Filter by department code, e.g. 'CSC', 'MATH'"), | ||
| ...pagination(200), | ||
| }, |
| inputSchema: { | ||
| professorId: pendingProfessorIdField, | ||
| ...nameFields, | ||
| }, |
| inputSchema: { | ||
| professorId: pendingProfessorIdField, | ||
| department: departmentField, | ||
| }, |
4341146 to
d1763dd
Compare
- Add @polyratings/mcp-server with public read and admin moderation tools - Backend: bulk rating deletion, professor locks, report cleanup, public schema safety - Frontend: admin and professor page updates; align with getMany response shape - Workspace: agent skills, AGENTS.md, dependency alignment with tRPC 11.17 Co-authored-by: Cursor <[email protected]>
This pull request introduces a new package,
@polyratings/mcp-server, which provides a local MCP server for read-only public tools and admin moderation tools over the Polyratings backend. It also adds new backend admin endpoints, improves bulk rating deletion logic, and standardizes internal dependency versions across packages.Key highlights:
@polyratings/mcp-serverpackage, including setup scripts, documentation, and backend client logic.New MCP Server Package
@polyratings/mcp-serverpackage with its ownREADME.md,.gitignore, andpackage.json, providing a local server for public and admin tools over the backend, including a script for obtaining admin JWT tokens (get-token.sh). [1] [2] [3] [4]src/backendClient.tsin@polyratings/mcp-server, offering typed functions to interact with the backend, including listing professors, fetching ratings, handling reported ratings, and supporting admin moderation actions.Backend Admin Improvements
getRatingsByAnonymousIdentifierto fetch ratings for a professor by anonymous identifier, and implemented the supporting function. [1] [2]removeRatingsBulkmutation to only remove reports for actually deleted ratings, ensuring consistency between rating and report removal.Documentation and Monorepo Metadata
AGENTS.mdto document the new MCP server package and its usage, including commands for development and build. [1] [2]Dependency Version Standardization
@polyratings/backend,@polyratings/eslint-config) to use"*"acrossfrontend,backend, andcronpackages for easier local development and version management. [1] [2] [3] [4] [5]