# Existing tables (laravel-rust-mcp-oauth)

> If another implementation of the same MCP resource already issues tokens, share its tables to keep assistants connected while you move over.

- Package: laravel-rust-mcp-oauth (Laravel for Rust, alpha), crates: `laravel-rust-mcp-oauth`
- Maintenance: active; Latest release: 0.1.0 (2026-12-05); Framework: laravel-rust 0.2.x; MSRV: Rust 1.99 or later; Licence: MIT
- Links: [Repository](https://github.com/bowerbird-si/laravel-rust-mcp-oauth), [crates.io](https://crates.io/crates/laravel-rust-mcp-oauth/0.1.0), [docs.rs](https://docs.rs/laravel-rust-mcp-oauth/0.1.0), [Changelog](https://oss.bowerbird.si/mcp-oauth/docs/changelog/), [Contributing](https://github.com/bowerbird-si/laravel-rust-mcp-oauth/blob/8b1d066397c9f1a1cf02d444a910a1c65585c159/CONTRIBUTING.md), [Security policy](https://github.com/bowerbird-si/laravel-rust-mcp-oauth/blob/8b1d066397c9f1a1cf02d444a910a1c65585c159/SECURITY.md)
- Based on: [Laravel MCP](https://github.com/laravel/mcp): The public flow of Mcp::oauthRoutes(): discovery, client registration, an approval screen in your app and bearer tokens for the MCP server.; [Laravel Passport](https://github.com/laravel/passport): The authorization server Laravel MCP builds on. This crate needs no Passport, supports Client ID Metadata Documents and uses opaque, hashed tokens instead of JWTs.; [MCP authorization specification](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization): The sign-in flow MCP clients expect, with Client ID Metadata Documents preferred over dynamic registration.
- Community package, not affiliated with Laravel.
- HTML version: https://oss.bowerbird.si/mcp-oauth/docs/existing-tables/
- Source: https://github.com/bowerbird-si/laravel-rust-mcp-oauth/blob/8b1d066397c9f1a1cf02d444a910a1c65585c159/docs/existing-tables.md

If another implementation of the same MCP resource already issues tokens, share its tables to keep assistants connected while you move over.

## The tables

With the default prefix `mcp_`:

| Table | Holds |
| --- | --- |
| `mcp_oauth_clients` | Every client: its ID, how it registered (`cimd` or `dcr`), name, callbacks, family, when its document was fetched |
| `mcp_grants` | A person's permission for an app and scope set, with last use and revocation timestamps |
| `mcp_authorization_requests` | Pending approvals |
| `mcp_authorization_codes` | Codes, as SHA-256 digests, with their callback, challenge, resource and scopes |
| `mcp_tokens` | Access and refresh tokens, as SHA-256 digests, with their expiry, rotation and revocation |

The exact columns are in the crate's `database/migrations/`. They stay stable within a minor version.

## Sharing them

One set of tables serves exactly one MCP resource. Applications with different resources must use
different `table_prefix` values. Sharing tables is for two implementations of the same resource.

Point the crate at the tables and let the other implementation keep owning the schema.

```shellscript
MCP_OAUTH_MIGRATIONS=false
MCP_OAUTH_SCHEDULE_PRUNE=false
MCP_OAUTH_TABLE_PREFIX=mcp_
MCP_OAUTH_TOKEN_PREFIX=acme_
MCP_OAUTH_CLIENT_ID_PREFIX=acme_c_
MCP_OAUTH_SCOPES=acme
```

```rust
McpOAuthServiceProvider::<model::Users<User>>::new()
    .with_integer_user_ids() // when the grants table's user column is an integer
```

Then both directions work:

- tokens the other application issued verify and refresh here;
- tokens this crate issues are stored the same way: hex digests, `replaced_by_id`, `rotated_at` and `revoked_at`. So the other application can verify them too, and you can switch back.

The other application must follow the same rules for the rows to mean the same thing: SHA-256 hex digests of the full token, refresh rotation with the same grace window, and a revoked grant ending all its tokens.

Shared grants use their stored analytics family. When issuing grants in either application, derive that label from a known CIMD client ID or the selected known callback, and use `other` when neither is available.

String account IDs and public client IDs must compare byte for byte, including trailing spaces.
The bundled migrations use `utf8mb4_0900_bin` on MySQL and `utf8mb4_nopad_bin` on MariaDB.
If you own the tables, use equivalent collations. Use `mariadb://` to select the MariaDB dialect.

The metadata store uses `metadata_fetched_at` as a cache version. Use the same timestamp precision
as the database connection. A row with an empty callback list represents an invalidated document.

## Moving over

1. Run both against the same tables, with this crate's migrations and schedule off.
2. Move the discovery documents and OAuth endpoints, then the MCP route.
3. Once nothing uses the old application, turn the schedule on here and let this crate own the migrations.
