Skip to content

v2.1.0: Per-Request User Context Support

Choose a tag to compare

@github-actions github-actions released this 24 Nov 18:28

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 runAsUserEmail from 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 runAsUserEmail field to ConnectionDefinition
  • 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

πŸ“¦ 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 βœ