Repository navigation
Store hosted keys and sessions in Supabase for Render #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ae3526c
test(transport): stop remote-mode flag leaking into later tests
pramodbn27 31caa08
refactor(auth): raise backend-neutral KeyConflictError for key conflicts
pramodbn27 1b020d9
feat(storage): add PostgreSQL/Supabase key, session and signup stores
pramodbn27 4f55ae0
feat(http): select Supabase storage via DEEP_AGENTIC_CORE_MCP_DATABAS…
pramodbn27 f4a8f11
deploy(render): store keys and sessions in Supabase instead of Key Value
pramodbn27 e10d533
fix(http): size the PostgreSQL pool for concurrency and close it on s…
pramodbn27 c51e9c5
docs(hosting): document PostgreSQL as the shared storage alternative …
pramodbn27 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| -- Storage for the hosted MCP service (keys, sessions, signup limits). | ||
| -- The private "mcp" schema is not exposed through the Supabase Data API. | ||
| -- Keys are stored only as SHA-256 digests; payloads are per-user tool state. | ||
| CREATE SCHEMA IF NOT EXISTS mcp; | ||
| REVOKE ALL ON SCHEMA mcp FROM PUBLIC; | ||
|
|
||
| CREATE TABLE IF NOT EXISTS mcp.users ( | ||
| user_id text PRIMARY KEY CHECK (length(user_id) BETWEEN 1 AND 128), | ||
| display_name text NOT NULL, | ||
| status text NOT NULL CHECK (status IN ('active', 'revoked')), | ||
| key_hash text NOT NULL UNIQUE, | ||
| created_at timestamptz NOT NULL DEFAULT now() | ||
| ); | ||
|
|
||
| CREATE TABLE IF NOT EXISTS mcp.sessions ( | ||
| owner_hash text PRIMARY KEY, | ||
| payload text NOT NULL, | ||
| expires_at timestamptz NOT NULL | ||
| ); | ||
| CREATE INDEX IF NOT EXISTS sessions_expires_at ON mcp.sessions (expires_at); | ||
|
|
||
| CREATE TABLE IF NOT EXISTS mcp.signup_counters ( | ||
| bucket text PRIMARY KEY, | ||
| count integer NOT NULL, | ||
| expires_at timestamptz NOT NULL | ||
| ); | ||
|
|
||
| -- Defense in depth: only mcp_service has a policy; Data API roles see no rows. | ||
| ALTER TABLE mcp.users ENABLE ROW LEVEL SECURITY; | ||
| ALTER TABLE mcp.sessions ENABLE ROW LEVEL SECURITY; | ||
| ALTER TABLE mcp.signup_counters ENABLE ROW LEVEL SECURITY; | ||
|
|
||
| -- Least-privilege login used by the service. Set its password separately: | ||
| -- ALTER ROLE mcp_service WITH PASSWORD '<generated secret>'; | ||
| DO $$ | ||
| BEGIN | ||
| IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'mcp_service') THEN | ||
| CREATE ROLE mcp_service LOGIN; | ||
| END IF; | ||
| END | ||
| $$; | ||
| GRANT USAGE ON SCHEMA mcp TO mcp_service; | ||
| GRANT SELECT, INSERT, UPDATE ON mcp.users TO mcp_service; | ||
| GRANT SELECT, INSERT, UPDATE, DELETE ON mcp.sessions, mcp.signup_counters TO mcp_service; | ||
| DROP POLICY IF EXISTS service_access ON mcp.users; | ||
| DROP POLICY IF EXISTS service_access ON mcp.sessions; | ||
| DROP POLICY IF EXISTS service_access ON mcp.signup_counters; | ||
| CREATE POLICY service_access ON mcp.users TO mcp_service USING (true) WITH CHECK (true); | ||
| CREATE POLICY service_access ON mcp.sessions TO mcp_service USING (true) WITH CHECK (true); | ||
| CREATE POLICY service_access ON mcp.signup_counters TO mcp_service USING (true) WITH CHECK (true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in c51e9c5: the table now lists DEEP_AGENTIC_CORE_MCP_DATABASE_URL, marks Redis and the database as alternatives, and the intro and expiry text cover both backends.