Manage MCP tokens per user - #179
Conversation
Co-authored-by: ecarreras <294235+ecarreras@users.noreply.github.com>
|
@giscebot revisa aquesta pull-request |
giscebot
left a comment
There was a problem hiding this comment.
There is one blocking migration issue:
JobQueue executes schema.sql before _ensure_columns(). On an existing database whose mcp_tokens table predates this PR, CREATE INDEX IF NOT EXISTS idx_mcp_tokens_user ON mcp_tokens(user_login, ...) therefore runs while user_login does not exist and startup fails with sqlite3.OperationalError: no such column: user_login. The later column migration is never reached.
I reproduced this by creating the previous seven-column mcp_tokens table and then constructing JobQueue(db) at this PR's head (7db9123). Please move creation of this index after the column migration (or otherwise ensure the columns exist first), and add an upgrade regression test that starts from the old table shape. Fresh-database behavior is not affected.
Co-authored-by: giscebot <286264155+giscebot@users.noreply.github.com>
|
Fixed the requested migration blocker in
Verification:
|
giscebot
left a comment
There was a problem hiding this comment.
The migration blocker from my previous review is resolved in ff4a3a6.
I verified that the new owner index is now created only after JobQueue._ensure_columns() adds user_login and created_by, and that the regression test constructs the previous seven-column mcp_tokens schema before initializing JobQueue. I also reviewed the ownership boundaries across the API and token helpers: regular users list/revoke only their own tokens, cross-user creation is rejected, admins retain global management, login values are normalized, and list responses still omit token secrets.
CI is green for Python 3.11, Python 3.12, and the dashboard suite/build. I could not rerun the focused tests locally because this dedicated checkout has no virtual environment and the system Python does not have pytest installed.
No remaining blocking findings.
Closes #178.
Summary
user_loginandcreated_byownership metadata to MCP token records, with SQLite upgrade handling for existing databases.Tests
. .venv/bin/activate && pytest -qnpm test -- --run src/main.test.tsxnpm run buildScreenshots