mcp-trellis
mcp-trellis
호스트 무관 MCP + OAuth 준비 완료 — 런타임과 IdP는 여러분이 준비하고, 커넥터 프로토콜은 라이브러리가 소유합니다.
웹 표준 Request → Response. mcp-trellis/node를 통해 Cloudflare Workers, Next.js App Router, Deno, Bun, Node HTTP에서 동일한 핸들러를 사용할 수 있습니다. 런타임 의존성이 전혀 없습니다.
mcp-trellis를 선택하는 이유
커넥터 스택 전체를 하나의 패키지로 — 데이터베이스나 벤더 가입 없이 MCP 핸들러 및 OAuth 2.1 인가 서버를 제공합니다. 로그인, 토큰 발행, 저장은 여러분이 관리하고, 프로토콜은 라이브러리가 소유합니다.
mcp-trellis | 공식 MCP SDK |
|
| Auth0 / Clerk / Authlete | |
MCP 핸들러 | ✅ | ✅ | ❌ | ❌ | ❌ |
OAuth 2.1 인가 서버 | ✅ | ❌ 직접 준비 | ✅ | ✅ | ✅ |
런타임 | 모든 웹 표준 | 모든 웹 표준 | Workers 전용 | Node | — |
데이터베이스 | 필요 없음 | — | KV (선택) | 필수 | — |
런타임 의존성 | 제로 | 여러 개 | 여러 개 | 여러 개 | — |
자체 호스팅 | ✅ | ✅ | ✅ | ✅ | ❌ SaaS |
명명된 커넥터 프로파일 (Claude / Gemini / Codex), 강제 적용 | ✅ | ❌ | ❌ | ❌ | ❌ |
이미 별도의 AS(인가 서버)를 보유하고 있다면 공식 SDK를 선호하세요. Cloudflare의 Workers 전용 구현을 원한다면 workers-oauth-provider를 선택하세요. 직접 운영하는 것보다 요금을 지불하겠다면 관리형 IdP를 선택하세요.
같은 문제 공간에서 이름이 알려진 대안들:
@mcpauth/auth/getmcpauth/mcp-auth— MCP용 OAuth 계열로, 일반적으로 DB 기반이거나 런타임/스택 요구사항이 다릅니다. mcp-trellis는 제로-의존성 옵션으로 MCP 핸들러와 OAuth 2.1 AS를 하나의 패키지에 담고 있습니다.fastmcp-oauth— FastMCP를 위한 OAuth 헬퍼입니다. mcp-trellis는 호스트 무관(Request/Response`)이며 특정 MCP 프레임워크에 묶이지 않습니다.
Related MCP server: Remote MCP Server on Cloudflare
요구 사항
Node ≥ 20 — Node 호스트용 (ESM에서 전역 WebCrypto)
또는 WebCrypto +
fetch를 갖춘 모든 런타임 (Workers, Deno, Bun)
설치
npm install mcp-trellis빠른 시작
한 번의 호출로 MCP 엔드포인트, OAuth 인가 서버, 두 개의 발견 문서를 모두 마운트합니다:
import { createMcpApp } from "mcp-trellis";
const app = createMcpApp({
serverInfo: { name: "demo", version: "1.0.0" },
clients: ["claude"],
tools: [
{
name: "echo",
description: "Echo text back",
inputSchema: {
type: "object",
properties: { text: { type: "string" } },
required: ["text"],
},
scope: "mcp",
handler: (_ctx, args) => String(args.text ?? ""),
},
],
auth: {
codeSecret: process.env.OAUTH_CODE_SECRET!,
resolveUser: async (req) => getSession(req),
loginUrl: (_req, next) => `/login?next=${encodeURIComponent(next)}`,
mintAccessToken: async ({ userId, scope, resource }) => ({
// Embed `resource` as the token audience (RFC 8707).
accessToken: await issueUserToken(userId, { aud: resource, scope }),
expiresIn: 3600,
}),
verifyToken: async (token) => {
const claims = await readUserToken(token);
if (!claims) return null;
return {
userId: claims.sub,
scopes: claims.scope.split(" "),
audience: claims.aud,
};
},
},
});
export default { fetch: (req: Request) => app.fetch(req) };토큰의 audience를 반환하면, 라이브러리는 어떤 도구가 실행되기 전에 다른 리소스에 대해 발급된 토큰을 거부합니다. 자세한 내용: docs/security.md.
실제 /authorize 흐름에는 승인 단계가 포함되어 있습니다. 해석된 세션이라도 곧바로 인증 코드와 함께 리다이렉트되지 않으며, 먼저 동의 화면(내장된 화면 또는 consent를 통해 추가한 화면)을 렌더링합니다. 처음 핸들로 통합해 보는 사람은 즉시 리다이렉트가 아니라 그 자리에 HTML 페이지가 나타나는 것을 기대해야 합니다 — 동의 참조.
initialize로 스모크 테스트하세요 (공개 — Bearer 불필요):
curl -s http://127.0.0.1:8787/mcp \
-H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18"}}'{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-06-18","capabilities":{"tools":{}},"serverInfo":{"name":"demo","version":"1.0.0"},"instructions":""}}클라이언트
클라이언트 | 등록 | 토큰 엔드포인트 인증 | 비고 |
| 동적(DCR), 공개 + PKCE |
| Claude Custom Connectors 콜백 허용 목록 |
| 사전 등록, 기밀 클라이언트 |
|
|
| MCP 인증 규격에 따른 OAuth 2.1, 공개 + PKCE |
| ChatGPT / Codex가 하나의 규약을 공유합니다 |
사전 등록 클라이언트, DCR 강제 적용, clientStore 연결 방법: docs/guide.md#clients.
아키텍처
createMcpApp는 MCP와 OAuth를 연결하고 라우팅을 합니다:
호스트 레시피, 포트, 도구, 멀티-테넌트 안내: docs/guide.md.
문서
문서 | 내용 |
아키텍처, 클라이언트, 레시피, 포트, 도구, 멀티-테넌트 | |
라우트, 메서드, 상태 코드, 옵션, 내보내기 | |
프로토콜 보장, 위험 멧델, 범위 밖 항목 | |
다음에 진행할 것 |
예시: examples/ — HTTP 서버, Worker, 멀티-테넌트, 저장소, 감사.
기여
PR은 언제나 환영합니다 — CONTRIBUTING.md를 참조하세요.
npm test
npm run build
npm run typecheckLicense
MIT
This server cannot be installed
Maintenance
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceEnables deploying a Model Context Protocol (MCP) server on Cloudflare Workers with built-in OAuth authentication. It allows local clients like Claude Desktop to securely connect to and use remote tools through an HTTP/SSE transport.
- FlicenseNot gradedqualityCmaintenanceEnables deploying and running a Model Context Protocol (MCP) server on Cloudflare Workers with built-in OAuth authentication. It allows users to host and access tools remotely via Server-Sent Events (SSE) transport from clients like Claude Desktop.
- AlicenseNot gradedqualityDmaintenanceA dual-runtime template for building Model Context Protocol servers compatible with Node.js and Cloudflare Workers. It features integrated OAuth, encrypted token storage, and multi-tenant session management to simplify the creation of secure tool, resource, and prompt interfaces.16138ISC
- AlicenseNot gradedqualityDmaintenanceEnables developers to build OAuth-protected MCP servers on Cloudflare Workers with pluggable authentication adapters, allowing user-specific access control and secure token exchange.1326MIT
Related MCP Connectors
Self-hosted federated MCP gateway: one OAuth 2.1 MCP server in front of N apps, user-level scopes.
Artifact store for AI agents. Hosted OAuth at mcp.artifacta.io/mcp; local stdio via npm/PyPI.
Self-hosted MCP gateway: turn any API, database or MCP server into AI connectors — no code.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/amir1824/mcp-trellis'
If you have feedback or need assistance with the MCP directory API, please join our Discord server