v2.1.0: Per-Request User Context Support
Release v2.1.0: Per-Request User Context Support
π What's New
This release adds per-request user context support for multi-tenant MCP servers, enabling each request to execute with a specific user's permissions and context.
β¨ Features
Per-Request User Context (#3)
-
ConnectionManager.get(name, runAsUserEmail?)- Creates user-specific AppSheetClient instances on-the-fly
- Overrides global
runAsUserEmailfrom schema when provided - No caching - lightweight operation
-
SchemaManager.table(conn, table, runAsUserEmail?)- Creates user-specific DynamicTable instances on-the-fly
- Enables true multi-tenant MCP servers with per-request user context
- Perfect for authenticated MCP tool handlers
Enhanced Schema Configuration
- Added optional
runAsUserEmailfield toConnectionDefinition - Allows setting global default user at connection level in schema
Architecture Improvements
- Removed table client caching in SchemaManager
- On-the-fly DynamicTable creation for better per-request handling
- Simplified
initialize()method - only registers connections
π Bug Fixes
- Fixed package.json version from 0.2.0 to 2.1.0 (#4)
π Usage Example
```typescript
// MCP Server with per-request user context
const db = new SchemaManager(SchemaLoader.fromYaml('./schema.yaml'));
server.tool('list_worklogs', async (params, context) => {
// Extract authenticated user from MCP context
const userEmail = context.user?.email;
// Create user-specific table client on-the-fly
const table = db.table('worklog', 'worklogs', userEmail);
// All operations execute with user's AppSheet permissions
return await table.findAll();
});
```
π§ͺ Testing
- β 31 new tests (13 ConnectionManager + 18 SchemaManager)
- β Total test suite: 157 tests, all passing
- β Build successful
- β SemVer validated: MINOR (backward compatible)
π Documentation
- Updated CLAUDE.md with new features and usage patterns
- Added comprehensive CHANGELOG.md
- Added "Per-Request User Context" section with examples
π Migration
No migration required! This is a fully backward compatible MINOR release.
Existing code continues to work without changes:
```typescript
// Old code (still works)
const table = db.table('worklog', 'worklogs');
// New feature (optional)
const userTable = db.table('worklog', 'worklogs', '[email protected]');
```
π Commits in this Release
- feat(SOSO-248): add per-request user context support for multi-tenant MCP servers (e1af98d)
- chore: release v2.1.0 with per-request user context support (c5e3097)
- docs(SOSO-248): add integration concept for per-request user context support (a333bce)
π Links
- Full Changelog
- Documentation
- Issue #3: DynamicTable API missing per-request runAsUserEmail
- Issue #4: Package version correction
π¦ Installation
```bash
npm install @techdivision/[email protected]
```
π Credits
This release was developed with assistance from Claude Code.
Breaking Changes: None
SemVer Level: MINOR
Backward Compatible: Yes β