feat: add MCP server with OAuth 2.1 authentication#56
Conversation
Add a new `packages/mcp` package that exposes personal server data through
the Model Context Protocol, enabling integration with AI tools like Claude
and ChatGPT.
Resources: vana://files, vana://file/{scope}, vana://file/{scope}/metadata,
vana://grants, vana://schemas
Tools: list_files, get_file (with dot-path extraction), search_files
The MCP server is mounted at /mcp on the existing HTTP server using
Streamable HTTP transport (stateless, one transport per request). A stdio
entry point is also provided for Claude Desktop usage.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Codex ReviewFindings
Missing tests
If you want, I can propose an auth middleware placement and minimal test cases for MCP. |
Protect the /mcp endpoint with OAuth 2.1 (PKCE, RFC 7591 dynamic client registration). Identity verification delegates to Account Portal (account.vana.org) — user signs "vana-master-key-v1", server recovers wallet via EIP-191 and checks ownership before issuing tokens. New endpoints: /.well-known/oauth-authorization-server, /.well-known/oauth-protected-resource, /register, /authorize, /oauth/callback, /token. Co-Authored-By: Claude Opus 4.6 <[email protected]>
The tunnel (frpc → Cloudflare) terminates TLS before reaching the personal server, so `new URL(c.req.url).origin` returned `http://`. OAuth clients like Claude rejected the metadata because endpoints used HTTP while the server was accessed via HTTPS. Use the existing `serverOrigin` function (which returns the tunnel HTTPS URL once connected) for all OAuth discovery endpoints and the WWW-Authenticate header in the MCP route. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
Codex review raised 3 concerns, heres where we landed:
Minor things to follow up on separately:
|
## Summary - Update `@opendatalabs/personal-server-ts-core` and `server` from `0.0.1-canary.93673d7` to `0.0.1-canary.92ee4d6` - Add new `@opendatalabs/personal-server-ts-mcp` package - Add transitive deps (`hono`, `@modelcontextprotocol/sdk`) required by the MCP server This picks up the MCP server + OAuth 2.1 changes from [personal-server PR #56](vana-com/personal-server#56). ## Test plan - [ ] Binary builds successfully - [ ] Personal server starts and MCP endpoint responds at `/mcp` - [ ] OAuth flow works end-to-end with Claude AI 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Volod <[email protected]> Co-authored-by: Claude Opus 4.6 <[email protected]>
Summary
/mcpendpointaccount.vana.org) — user signs"vana-master-key-v1", server recovers wallet via EIP-191 and checks ownership before issuing tokensMCP capabilities
search_files(search across scopes),list_versions(version history)OAuth endpoints
/.well-known/oauth-authorization-server— discovery metadata/.well-known/oauth-protected-resource— resource metadataPOST /register— dynamic client registrationGET /authorize→ redirects to Account PortalGET /oauth/callback— receives wallet proof, issues auth codePOST /token— code exchange (PKCE) and refreshHow auth works
/mcp→ gets 401 withWWW-AuthenticatemasterKeySig/mcprequestsSecurity
"vana-master-key-v1"Test plan
npm run buildpassescurl POST /mcp→ 401 with WWW-AuthenticateGET /.well-known/oauth-authorization-server→ valid metadataDepends on: vana-com/vana-connect PR for Account Portal HTTPS redirect support
🤖 Generated with Claude Code