Skip to content

feat: implement local MCP server#179

Open
cjlawson02 wants to merge 2 commits into
betafrom
mcp
Open

feat: implement local MCP server#179
cjlawson02 wants to merge 2 commits into
betafrom
mcp

Conversation

@cjlawson02
Copy link
Copy Markdown
Collaborator

@cjlawson02 cjlawson02 commented Mar 17, 2026

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:

  • Adds the @polyratings/mcp-server package, including setup scripts, documentation, and backend client logic.
  • Enhances backend admin functionality with new endpoints and improved logic for bulk operations.
  • Updates dependency versions in all packages for consistency and maintainability.

New MCP Server Package

  • Introduced the @polyratings/mcp-server package with its own README.md, .gitignore, and package.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]
  • Implemented src/backendClient.ts in @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

  • Added a new backend admin endpoint getRatingsByAnonymousIdentifier to fetch ratings for a professor by anonymous identifier, and implemented the supporting function. [1] [2]
  • Improved the removeRatingsBulk mutation to only remove reports for actually deleted ratings, ensuring consistency between rating and report removal.

Documentation and Monorepo Metadata

  • Updated AGENTS.md to document the new MCP server package and its usage, including commands for development and build. [1] [2]

Dependency Version Standardization

  • Standardized internal dependency versions (@polyratings/backend, @polyratings/eslint-config) to use "*" across frontend, backend, and cron packages for easier local development and version management. [1] [2] [3] [4] [5]

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Mar 17, 2026

Deploying polyratings with  Cloudflare Pages  Cloudflare Pages

Latest commit: d1763dd
Status: ✅  Deploy successful!
Preview URL: https://602862f0.polyratings.pages.dev
Branch Preview URL: https://mcp.polyratings.pages.dev

View logs

@cjlawson02 cjlawson02 force-pushed the mcp branch 3 times, most recently from cd51222 to 5e6f901 Compare March 18, 2026 05:29
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Mar 18, 2026

View your CI Pipeline Execution ↗ for commit d1763dd

Command Status Duration Result
lerna run deploy:dev --stream ✅ Succeeded 8s View ↗
lerna run test --stream ✅ Succeeded 2s View ↗
lerna run build ✅ Succeeded 11s View ↗
lerna run lint --stream ✅ Succeeded 7s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-25 23:31:53 UTC

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-server with MCP tool registrations, backend tRPC client wrapper, docs, and an interactive token helper script.
  • Extended backend admin router with getRatingsByAnonymousIdentifier and 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.

Comment thread packages/mcp-server/src/index.ts Outdated
Comment thread packages/mcp-server/scripts/get-token.sh
Comment thread packages/mcp-server/src/index.ts Outdated
Comment thread packages/mcp-server/src/index.ts Outdated
Comment thread packages/mcp-server/src/backendClient.ts Outdated
Comment thread packages/mcp-server/src/backendClient.ts Outdated
Comment thread packages/mcp-server/scripts/get-token.sh
Comment thread packages/mcp-server/src/index.ts Outdated
Comment thread packages/mcp-server/src/index.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 41 out of 43 changed files in this pull request and generated 4 comments.

Comment on lines +185 to +196
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,
Comment on lines +20 to +25
department: z
.string()
.optional()
.describe("Filter by department code, e.g. 'CSC', 'MATH'"),
...pagination(200),
},
Comment on lines +135 to +138
inputSchema: {
professorId: pendingProfessorIdField,
...nameFields,
},
Comment on lines +169 to +172
inputSchema: {
professorId: pendingProfessorIdField,
department: departmentField,
},
cjlawson02 and others added 2 commits May 25, 2026 16:30
- 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 <cursoragent@cursor.com>
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.

2 participants