api-mcp-server

Integrate a cloud-hosted MCP endpoint into a Bun/Elysia API.

Updated Oct 8, 2025
One-click install
npx skills add https://github.com/ichabodcole/project-docs-scaffold-template --skill api-mcp-server
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: api-mcp-server
Source: https://github.com/ichabodcole/project-docs-scaffold-template/tree/main/plugins/recipes/skills/api-mcp-server
Command: npx skills add https://github.com/ichabodcole/project-docs-scaffold-template --skill api-mcp-server

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Integrate a cloud-hosted MCP endpoint into a Bun/Elysia API to enable AI agents to securely access user data across tenants.

Core Features & Use Cases

  • Two-layer authentication (OAuth for user identity and agent keys for permissions) to securely gate agent access.
  • Prefix-based bcrypt key validation with per-session caching and database-backed sessions for horizontal scaling.
  • Per-request MCP server instance with permission enforcement and owner-scoped data access.
  • Multi-tenant isolation using owner_id in all data models and queries.

Quick Start

Configure your Bun/Elysia API to expose the /api/mcp route and authenticate an agent key to obtain a session for subsequent tool calls.

Frequently Asked Questions about api-mcp-server

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a cloud MCP server to a Bun or Elysia API?▼

To add a cloud MCP server to Bun or Elysia, expose an /api/mcp route and use the MCP SDK. This enables per-request MCP server instances with database-backed sessions and permission enforcement.

How does agent-key authentication work for MCP endpoints?▼

Agent-key authentication for MCP endpoints uses prefix-based bcrypt validation with per-session caching. It acts as a second authentication layer alongside OAuth to gate AI agent access and enforce permissions.

How do I achieve multi-tenant isolation for AI agents accessing user data?▼

Multi-tenant isolation is achieved by using an owner_id in all data models and queries. This ensures per-request MCP server instances provide owner-scoped data access across different tenants.

What do I need to set up before integrating an MCP endpoint into my API?▼

Before integrating an MCP endpoint, you need the MCP SDK, bcryptjs, an OAuth identity provider to validate users, and a PostgreSQL database configured with six specific tables for sessions.

Can I horizontally scale database-backed MCP sessions?▼

Yes, you can horizontally scale database-backed MCP sessions. The architecture uses PostgreSQL for session storage and per-session caching, allowing multiple instances to share session state.

Why use two-layer authentication for AI agent API access?▼

Two-layer authentication secures AI agent API access by using OAuth for user identity and agent keys for permissions. This separates user identity verification from specific agent authorization.