MCP Framework MCP server
자동 도구 검색 및 내장 스키마 검증 기능을 갖춘 Model Context Protocol server 구축용 TypeScript 프레임워크입니다.
다른 이름 QuantGeekDev/mcp-framework
- 스타
- 931
- Tools
- 3
- 다운로드, 30일
- —
- 최신 버전
- —
- 마지막 커밋
- 2026년 4월 16일
- 라이선스
- MIT
MCP Framework MCP란?
MCP Framework은(는) MCP server입니다. 자동 도구 검색 및 내장 스키마 검증 기능을 갖춘 Model Context Protocol server 구축용 TypeScript 프레임워크입니다. 3개 도구를 제공합니다. 예: search_docs, get_page, list_sections.
프로젝트 README에서 생성된 요약
MCP Framework MCP server 정보
이 프레임워크를 사용하면 TypeScript로 Model Context Protocol server를 더욱 효율적으로 구축할 수 있습니다. 디렉토리 기반의 자동 검색 기능을 통해 개발자가 도구, 리소스, 프롬프트를 생성할 수 있는 구조화된 아키텍처를 제공합니다. 공식 MCP SDK를 활용하므로 타입 안정성을 보장하며, 커스텀 AI 통합을 구축하는 개발자의 작업 과정을 간소화합니다.
개발자는 stdio, SSE, HTTP Stream 등 다양한 전송 방식을 사용하여 server를 배포할 수 있습니다. 프레임워크에는 프로젝트 관리를 위한 CLI가 포함되어 있어, 간단한 명령어로 새로운 server를 생성하거나 도구를 추가하고 프롬프트를 생성할 수 있습니다. 또한 SSE 엔드포인트를 위한 내장 인증 기능을 갖추고 있어 OAuth 2.1, JWT, API key를 통해 원격 연결을 안전하게 보호할 수 있습니다.
주요 특징 중 하나는 Zod 스키마를 사용하는 통합 검증 시스템입니다. 프레임워크는 도구 스키마의 모든 필드에 설명이 포함되도록 강제하여, 문서화가 미비한 도구가 운영 환경에 배포되는 것을 방지합니다. 이 검증은 빌드 과정, 독립형 명령어, 또는 server 시작 시 런타임 중에 수행됩니다.
활용 사례
- 1새로운 MCP 프로젝트 스캐폴딩개발자가 CLI를 사용하여 새로운 server 환경을 빠르게 초기화할 수 있습니다.
- 2스키마 문서화 강제검증 체크를 실행하여 모든 도구 입력값이 AI 클라이언트를 위해 적절히 설명되었는지 확인합니다.
- 3암호화폐 팁 서비스 구축AI 어시스턴트가 지갑을 확인하고 암호화폐 팁을 준비할 수 있는 특화된 서비스를 구축합니다.
- 4HTTP 전송을 통한 배포특정 포트 및 CORS 설정을 사용하여 HTTP로 통신하는 server를 설정합니다.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
MCP Framework MCP 설치 방법
형식 확인: 2026년 11월 10일Cursor에 추가Goose에 추가Claude Code에 MCP Framework MCP 설치
$ claude mcp add mcp-framework -- npx -y mcp-frameworkCursor에 MCP Framework MCP 설치
~/.cursor/mcp.json
{
"mcpServers": {
"mcp-framework": {
"command": "npx",
"args": [
"-y",
"mcp-framework"
]
}
}
}VS Code에 MCP Framework MCP 설치
.vscode/mcp.json
{
"servers": {
"mcp-framework": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"mcp-framework"
]
}
}
}VS Code CLI에 MCP Framework MCP 설치
$ code --add-mcp '{"name":"mcp-framework","type":"stdio","command":"npx","args":["-y","mcp-framework"]}'Claude Desktop에 MCP Framework MCP 설치
claude_desktop_config.json
{
"mcpServers": {
"mcp-framework": {
"command": "npx",
"args": [
"-y",
"mcp-framework"
]
}
}
}Codex에 MCP Framework MCP 설치
$ codex mcp add mcp-framework -- npx -y mcp-frameworkCodex config.toml에 MCP Framework MCP 설치
~/.codex/config.toml
[mcp_servers.mcp-framework] command = "npx" args = ["-y", "mcp-framework"]
Gemini CLI에 MCP Framework MCP 설치
$ gemini mcp add -s user mcp-framework npx -- -y mcp-frameworkGemini settings.json에 MCP Framework MCP 설치
~/.gemini/settings.json
{
"mcpServers": {
"mcp-framework": {
"command": "npx",
"args": [
"-y",
"mcp-framework"
]
}
}
}MCP Framework MCP 도구 3
README에서 감지됨search_docsget_pagelist_sections
| search_docs | — | |
| get_page | — | |
| list_sections | — |
구성
MCP_DEBUG_CONSOLEMCP_ENABLE_FILE_LOGGINGMCP_SKIP_TOOL_VALIDATIONNODE_ENVOAUTH_AUDIENCEOAUTH_AUTHORIZATION_SERVEROAUTH_CLIENT_IDOAUTH_CLIENT_SECRETOAUTH_INTROSPECTION_ENDPOINTOAUTH_ISSUEROAUTH_JWKS_URIOAUTH_RESOURCE
| 이름 | 설명 | 유형 |
|---|---|---|
| MCP_DEBUG_CONSOLE | — | |
| MCP_ENABLE_FILE_LOGGING | — | |
| MCP_SKIP_TOOL_VALIDATION | — | |
| NODE_ENV | — | |
| OAUTH_AUDIENCE | — | |
| OAUTH_AUTHORIZATION_SERVER | — | |
| OAUTH_CLIENT_ID | — | |
| OAUTH_CLIENT_SECRET | — | |
| OAUTH_INTROSPECTION_ENDPOINT | — | |
| OAUTH_ISSUER | — | |
| OAUTH_JWKS_URI | — | |
| OAUTH_RESOURCE | — |
자동 검사
2026년 11월 13일에 실행됨전체 보고서 →아직 인증되지 않았습니다. 서버는 80점 이상의 점수, 심각한 결함 없음, 그리고 검사에 충분한 데이터를 갖추어야 합니다. 검사 방식 · 점수를 높이기 위해 수정할 항목
- 소스 저장소 연결 및 접근 가능quantgeekdev/mcp-framework is public and reachablegithub.com/quantgeekdev/mcp-framework ↗통과
- 패키지가 이 저장소를 소스로 명시mcp-framework names quantgeekdev/mcp-framework as sourcenpmjs.com/package/mcp-framework ↗통과
- 빌드 출처(Sigstore 증명)No build attestation published for this release검사되지 않음
- 오픈 소스 라이선스 (OSI)MITspdx.org/licenses/MIT.html ↗통과
- 최근 1년 내 커밋 또는 릴리스Last commit or release 2026-04-16github.com/quantgeekdev/mcp-framework ↗통과
- OpenSSF Scorecard검사되지 않음
- 패키지 이름이 인기 패키지와 유사하지 않음No popular package one edit away from mcp-framework통과
- 패키지 및 해당 종속성에 중요한 보안 권고 없음검사되지 않음
- 모델에 대한 숨겨진 지침 없음3 tool descriptions and the README read; no override phrases, credential paths or hidden characters통과
- 파괴적인 도구에 라벨 표시됨No tool named like delete, drop or exec통과
- 원격 엔드포인트가 MCP 핸드셰이크에 응답검사되지 않음
README
GitHub에서 보기MCP Framework
MCP-Framework is a framework for building Model Context Protocol (MCP) servers elegantly in TypeScript.
MCP-Framework gives you architecture out of the box, with automatic directory-based discovery for tools, resources, and prompts. Use our powerful MCP abstractions to define tools, resources, or prompts in an elegant way. Our cli makes getting started with your own MCP server a breeze
Features
- 🛠️ Automatic discovery and loading of tools, resources, and prompts
- Multiple transport support (stdio, SSE, HTTP Stream)
- TypeScript-first development with full type safety
- Built on the official MCP SDK
- Easy-to-use base classes for tools, prompts, and resources
- Out of the box authentication for SSE endpoints (OAuth 2.1, JWT, API Key)
Projects Built with MCP Framework
The following projects and services are built using MCP Framework:
A crypto tipping service that enables AI assistants to help users send cryptocurrency tips to content creators directly from their chat interface. The MCP service allows for:
- Checking wallet types for users
- Preparing cryptocurrency tips for users/agents to complete Setup instructions for various clients (Cursor, Sage, Claude Desktop) are available in their MCP Server documentation.
Support our work
Read the full docs here
Creating a repository with mcp-framework
Using the CLI (Recommended)
# Install the framework globally
npm install -g mcp-framework
# Create a new MCP server project
mcp create my-mcp-server
# Navigate to your project
cd my-mcp-server
# Your server is ready to use!
CLI Usage
The framework provides a powerful CLI for managing your MCP server projects:
Project Creation
# Create a new project
mcp create <your project name here>
# Create a new project with the new EXPERIMENTAL HTTP transport
Heads up: This will set cors allowed origin to "*", modify it in the index if you wish
mcp create <your project name here> --http --port 1337 --cors
Options:
--http: Use HTTP transport instead of default stdio
--port : Specify HTTP port (default: 8080)
--cors: Enable CORS with wildcard (*) access
Adding a Tool
# Add a new tool
mcp add tool price-fetcher
Building and Validation
The framework provides comprehensive validation to ensure your tools are properly documented and functional:
# Build with automatic validation (recommended)
npm run build
# Build with custom validation settings
MCP_SKIP_TOOL_VALIDATION=false npm run build # Force validation (default)
MCP_SKIP_TOOL_VALIDATION=true npm run build # Skip validation (not recommended)
Validating Tools
# Validate all tools have proper descriptions (for Zod schemas)
mcp validate
This command checks that all tools using Zod schemas have descriptions for every field. The validation runs automatically during build, but you can also run it standalone:
- ✅ During build:
npm run buildautomatically validates tools - ✅ Standalone:
mcp validatefor manual validation - ✅ Development: Use
defineSchema()helper for immediate feedback - ✅ Runtime: Server validates tools on startup
Example validation error:
❌ Tool validation failed:
❌ PriceFetcher.js: Missing descriptions for fields in price_fetcher: symbol, currency.
All fields must have descriptions when using Zod object schemas.
Use .describe() on each field, e.g., z.string().describe("Field description")
Integrating validation into CI/CD:
{
"scripts": {
"build": "tsc && mcp-build",
"test": "jest && mcp validate",
"prepack": "npm run build && mcp validate"
}
}
Adding a Prompt
# Add a new prompt
mcp add prompt price-analysis
Adding a Resource
# Add a new resource
mcp add resource market-data
Development Workflow
-
Create your project:
mcp create my-mcp-server cd my-mcp-server -
Add tools:
mcp add tool data-fetcher mcp add tool data-processor mcp add tool report-generator -
Define your tool schemas with automatic validation:
// tools/DataFetcher.ts import { MCPTool, MCPInput as AddToolInput } from "mcp-framework";
import { z } from "zod";
const AddToolSchema = z.object({ a: z.number().describe("First number to add"), b: z.number().describe("Second number to add"), });
class AddTool extends MCPTool { name = "add"; description = "Add tool description"; schema = AddToolSchema;
async execute(input: AddToolInput) {
const result = input.a + input.b;
return Result: ${result};
}
}
export default AddTool;
4. **Build with automatic validation:**
```bash
npm run build # Automatically validates schemas and compiles
-
Optional: Run standalone validation:
mcp validate # Check all tools independently -
Test your server:
node dist/index.js # Server validates tools on startup -
Add to MCP Client (see Claude Desktop example below)
Pro Tips:
- Use
defineSchema()during development for immediate feedback - Build process automatically catches missing descriptions
- Server startup validates all tools before accepting connections
- Use TypeScript's autocomplete with
MCPInput<this>for better DX
Using with Claude Desktop
Local Development
Add this configuration to your Claude Desktop config file:
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"${projectName}": {
"command": "node",
"args":["/absolute/path/to/${projectName}/dist/index.js"]
}
}
}
After Publishing
Add this configuration to your Claude Desktop config file:
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"${projectName}": {
"command": "npx",
"args": ["${projectName}"]
}
}
}
Building and Testing
- Make changes to your tools
- Run
npm run buildto compile - The server will automatically load your tools on startup
Environment Variables
The framework supports the following environment variables for configuration:
| Variable | Description | Default |
|---|---|---|
| MCP_ENABLE_FILE_LOGGING | Enable logging to files (true/false) | false |
| MCP_LOG_DIRECTORY | Directory where log files will be stored | logs |
| MCP_DEBUG_CONSOLE | Display debug level messages in console (true/false) | false |
Example usage:
# Enable file logging
MCP_ENABLE_FILE_LOGGING=true node dist/index.js
# Specify a custom log directory
MCP_ENABLE_FILE_LOGGING=true MCP_LOG_DIRECTORY=my-logs node dist/index.js
# Enable debug messages in console
MCP_DEBUG_CONSOLE=true node dist/index.js
Quick Start
Defining Tools
MCP Framework uses Zod schemas for defining tool inputs, providing type safety, validation, and automatic documentation:
import { MCPTool, MCPInput } from "mcp-framework";
import { z } from "zod";
const AddToolSchema = z.object({
a: z.number().describe("First number to add"),
b: z.number().describe("Second number to add"),
});
class AddTool extends MCPTool {
name = "add";
description = "Add tool description";
schema = AddToolSchema;
async execute(input: MCPInput<this>) {
const result = input.a + input.b;
return `Result: ${result}`;
}
}
export default AddTool;
Key Benefits:
- ✅ Single source of truth - Define types and validation in one place
- ✅ Automatic type inference - TypeScript types are inferred from your schema
- ✅ Rich validation - Leverage Zod's powerful validation features
- ✅ Required descriptions - Framework enforces documentation
- ✅ Better IDE support - Full autocomplete and type checking
- ✅ Cleaner code - No duplicate type definitions
Advanced Zod Schema Features
The framework supports all Zod features:
import { MCPTool, MCPInput } from "mcp-framework";
import { z } from "zod";
const AdvancedSchema = z.object({
// String constraints and formats
email: z.string().email().describe("User email address"),
name: z.string().min(2).max(50).describe("User name"),
website: z.string().url().optional().describe("Optional website URL"),
// Number constraints
age: z.number().int().positive().max(120).describe("User age"),
rating: z.number().min(1).max(5).describe("Rating from 1 to 5"),
// Arrays and objects
tags: z.array(z.string()).describe("List of tags"),
metadata: z.object({
priority: z.enum(['low', 'medium', 'high']).describe("Task priority"),
dueDate: z.string().optional().describe("Due date in ISO format")
}).describe("Additional metadata"),
// Default values
status: z.string().default('pending').describe("Current status"),
// Unions and enums
category: z.union([
z.literal('personal'),
z.literal('work'),
z.literal('other')
]).describe("Category type")
});
class AdvancedTool extends MCPTool {
name = "advanced_tool";
description = "Tool demonstrating advanced Zod features";
schema = AdvancedSchema;
async execute(input: MCPInput<this>) {
// TypeScript automatically knows all the types!
const { email, name, website, age, rating, tags, metadata, status, category } = input;
console.log(input.name.toUpperCase()); // ✅ TypeScript knows this is valid
console.log(input.age.toFixed(2)); // ✅ Number methods available
console.log(input.tags.length); // ✅ Array methods available
console.log(input.website?.includes("https")); // ✅ Optional handling
return `Processed user: ${name}`;
}
}
Automatic Type Inference
The MCPInput<this> type automatically infers the correct input type from your schema, eliminating the need for manual type definitions:
class MyTool extends MCPTool {
schema = z.object({
name: z.string().describe("User name"),
age: z.number().optional().describe("User age"),
tags: z.array(z.string()).describe("User tags")
});
async execute(input: MCPInput<this>) {
// TypeScript automatically knows:
// input.name is string
// input.age is number | undefined
// input.tags is string[]
console.log(input.name.toUpperCase()); // ✅ TypeScript knows this is valid
console.log(input.age?.toFixed(2)); // ✅ Handles optional correctly
console.log(input.tags.length); // ✅ Array methods available
}
}
No more duplicate interfaces or generic type parameters needed!
Schema Validation & Descriptions
All schema fields must have descriptions. This ensures your tools are well-documented and provides better user experience in MCP clients.
The framework validates descriptions at multiple levels:
1. Build-time Validation (Recommended)
npm run build # Automatically validates during compilation
2. Development-time Validation
Use the defineSchema helper for immediate feedback:
import { defineSchema } from "mcp-framework";
// This will throw an error immediately if descriptions are missing
const MySchema = defineSchema({
name: z.string(), // ❌ Error: Missing description
age: z.number().describe("User age") // ✅ Good
});
3. Standalone Validation
mcp validate # Check all tools for proper descriptions
4. Runtime Validation
The server automatically validates tools on startup.
To skip validation (not recommended):
# Skip during build
MCP_SKIP_TOOL_VALIDATION=true npm run build
# Skip during development
NODE_ENV=production npm run dev
Setting up the Server
import { MCPServer } from "mcp-framework";
const server = new MCPServer();
// OR (mutually exclusive!) with SSE transport
const server = new MCPServer({
transport: {
type: "sse",
options: {
port: 8080 // Optional (default: 8080)
}
}
});
// Start the server
await server.start();
Transport Configuration
stdio Transport (Default)
The stdio transport is used by default if no transport configuration is provided:
const server = new MCPServer();
// or explicitly:
const server = new MCPServer({
transport: { type: "stdio" }
});
SSE Transport
To use Server-Sent Events (SSE) transport:
const server = new MCPServer({
transport: {
type: "sse",
options: {
port: 8080, // Optional (default: 8080)
endpoint: "/sse", // Optional (default: "/sse")
messageEndpoint: "/messages", // Optional (default: "/messages")
cors: {
allowOrigin: "*", // Optional (default: "*")
allowMethods: "GET, POST, OPTIONS", // Optional (default: "GET, POST, OPTIONS")
allowHeaders: "Content-Type, Authorization, x-api-key", // Optional (default: "Content-Type, Authorization, x-api-key")
exposeHeaders: "Content-Type, Authorization, x-api-key", // Optional (default: "Content-Type, Authorization, x-api-key")
maxAge: "86400" // Optional (default: "86400")
}
}
}
});
HTTP Stream Transport
To use HTTP Stream transport:
const server = new MCPServer({
transport: {
type: "http-stream",
options: {
port: 8080, // Optional (default: 8080)
endpoint: "/mcp", // Optional (default: "/mcp")
responseMode: "batch", // Optional (default: "batch"), can be "batch" or "stream"
batchTimeout: 30000, // Optional (default: 30000ms) - timeout for batch responses
maxMessageSize: "4mb", // Optional (default: "4mb") - maximum message size
// Session configuration
session: {
enabled: true, // Optional (default: true)
headerName: "Mcp-Session-Id", // Optional (default: "Mcp-Session-Id")
allowClientTermination: true, // Optional (default: true)
},
// Stream resumability (for missed messages)
resumability: {
enabled: false, // Optional (default: false)
historyDuration: 300000, // Optional (default: 300000ms = 5min) - how long to keep message history
},
// CORS configuration
cors: {
allowOrigin: "*" // Other CORS options use defaults
}
}
}
});
Response Modes
The HTTP Stream transport supports two response modes:
-
Batch Mode (Default): Responses are collected and sent as a single JSON-RPC response. This is suitable for typical request-response patterns and is more efficient for most use cases.
-
Stream Mode: All responses are sent over a persistent SSE connection opened for each request. This is ideal for long-running operations or when the server needs to send multiple messages in response to a single request.
You can configure the response mode based on your specific needs:
// For batch mode (default):
const server = new MCPServer({
transport: {
type: "http-stream",
options: {
responseMode: "batch"
}
}
});
// For stream mode:
const server = new MCPServer({
transport: {
type: "http-stream",
options: {
responseMode: "stream"
}
}
});
HTTP Stream Transport Features
- Session Management: Automatic session tracking and management
- Stream Resumability: Optional support for resuming streams after connection loss
- Batch Processing: Support for JSON-RPC batch requests/responses
- Comprehensive Error Handling: Detailed error responses with JSON-RPC error codes
Authentication
MCP Framework provides optional authentication for SSE endpoints. You can choose between JWT, API Key, OAuth 2.1 authentication, or implement your own custom authentication provider.
JWT Authentication
import { MCPServer, JWTAuthProvider } from "mcp-framework";
import { Algorithm } from "jsonwebtoken";
const server = new MCPServer({
transport: {
type: "sse",
options: {
auth: {
provider: new JWTAuthProvider({
secret: process.env.JWT_SECRET,
algorithms: ["HS256" as Algorithm], // Optional (default: ["HS256"])
headerName: "Authorization" // Optional (default: "Authorization")
}),
endpoints: {
sse: true, // Protect SSE endpoint (default: false)
messages: true // Protect message endpoint (default: true)
}
}
}
}
});
Clients must include a valid JWT token in the Authorization header:
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...
API Key Authentication
import { MCPServer, APIKeyAuthProvider } from "mcp-framework";
const server = new MCPServer({
transport: {
type: "sse",
options: {
auth: {
provider: new APIKeyAuthProvider({
keys: [process.env.API_KEY],
headerName: "X-API-Key" // Optional (default: "X-API-Key")
})
}
}
}
});
Clients must include a valid API key in the X-API-Key header:
X-API-Key: your-api-key
OAuth 2.1 Authentication
MCP Framework supports OAuth 2.1 authentication per the MCP specification (2025-06-18), including Protected Resource Metadata (RFC 9728) and proper token validation with JWKS support.
OAuth authentication works with both SSE and HTTP Stream transports and supports two validation strategies:
JWT Validation (Recommended for Performance)
JWT validation fetches public keys from your authorization server's JWKS endpoint and validates tokens locally. This is the fastest option as it doesn't require a round-trip to the auth server for each request.
import { MCPServer, OAuthAuthProvider } from "mcp-framework";
const server = new MCPServer({
transport: {
type: "http-stream",
options: {
port: 8080,
auth: {
provider: new OAuthAuthProvider({
authorizationServers: [
process.env.OAUTH_AUTHORIZATION_SERVER
],
resource: process.env.OAUTH_RESOURCE,
validation: {
type: 'jwt',
jwksUri: process.env.OAUTH_JWKS_URI,
audience: process.env.OAUTH_AUDIENCE,
issuer: process.env.OAUTH_ISSUER,
algorithms: ['RS256', 'ES256'] // Optional (default: ['RS256', 'ES256'])
}
}),
endpoints: {
initialize: true, // Protect session initialization
messages: true // Protect MCP messages
}
}
}
}
});
Environment Variables:
OAUTH_AUTHORIZATION_SERVER=https://auth.example.com
OAUTH_RESOURCE=https://mcp.example.com
OAUTH_JWKS_URI=https://auth.example.com/.well-known/jwks.json
OAUTH_AUDIENCE=https://mcp.example.com
OAUTH_ISSUER=https://auth.example.com
Token Introspection (Recommended for Centralized Control)
Token introspection validates tokens by calling your authorization server's introspection endpoint. This provides centralized control and is useful when you need real-time token revocation.
import { MCPServer, OAuthAuthProvider } from "mcp-framework";
const server = new MCPServer({
transport: {
type: "sse",
options: {
auth: {
provider: new OAuthAuthProvider({
authorizationServers: [
process.env.OAUTH_AUTHORIZATION_SERVER
],
resource: process.env.OAUTH_RESOURCE,
validation: {
type: 'introspection',
audience: process.env.OAUTH_AUDIENCE,
issuer: process.env.OAUTH_ISSUER,
introspection: {
endpoint: process.env.OAUTH_INTROSPECTION_ENDPOINT,
clientId: process.env.OAUTH_CLIENT_ID,
clientSecret: process.env.OAUTH_CLIENT_SECRET
}
}
})
}
}
}
});
Environment Variables:
OAUTH_AUTHORIZATION_SERVER=https://auth.example.com
OAUTH_RESOURCE=https://mcp.example.com
OAUTH_AUDIENCE=https://mcp.example.com
OAUTH_ISSUER=https://auth.example.com
OAUTH_INTROSPECTION_ENDPOINT=https://auth.example.com/oauth/introspect
OAUTH_CLIENT_ID=mcp-server
OAUTH_CLIENT_SECRET=your-client-secret
OAuth Features
- RFC 9728 Compliance: Automatic Protected Resource Metadata endpoint at
/.well-known/oauth-protected-resource - RFC 6750 WWW-Authenticate Headers: Proper OAuth error responses with challenge headers
- JWKS Key Caching: Public keys cached for 15 minutes (configurable)
- Token Introspection Caching: Introspection results cached for 5 minutes (configurable)
- Security: Tokens in query strings are automatically rejected
- Claims Extraction: Access token claims in your tool handlers via
AuthResult
Popular OAuth Providers
The OAuth provider works with any RFC-compliant OAuth 2.1 authorization server:
- Auth0: Use your Auth0 tenant's JWKS URI and issuer
- Okta: Use your Okta authorization server configuration
- AWS Cognito: Use your Cognito user pool's JWKS endpoint
- Azure AD / Entra ID: Use Microsoft Entra ID endpoints
- Custom: Any OAuth 2.1 compliant authorization server
For detailed setup guides with specific providers, see the OAuth Setup Guide.
Client Usage
Clients must include a valid OAuth access token in the Authorization header:
# Make a request with OAuth token
curl -X POST http://localhost:8080/mcp \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIs..." \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "tools/list", "id": 1}'
# Discover OAuth configuration
curl http://localhost:8080/.well-known/oauth-protected-resource
Security Best Practices
- Always use HTTPS in production - OAuth tokens should never be transmitted over unencrypted connections
- Validate audience claims - Prevents token reuse across different services
- Use short-lived tokens - Reduces risk if tokens are compromised
- Enable token introspection caching - Reduces load on authorization server while maintaining security
- Monitor token errors - Track failed authentication attempts for security insights
Custom Authentication
You can implement your own authentication provider by implementing the AuthProvider interface:
import { AuthProvider, AuthResult } from "mcp-framework";
import { IncomingMessage } from "node:http";
class CustomAuthProvider implements AuthProvider {
async authenticate(req: IncomingMessage): Promise<boolean | AuthResult> {
// Implement your custom authentication logic
return true;
}
getAuthError() {
return {
status: 401,
message: "Authentication failed"
};
}
}
Documentation MCP Servers (@mcpframework/docs)
Spin up an MCP documentation server from any Fumadocs site or any site with llms.txt — AI agents get tools to search, browse, and retrieve your docs.
Quick Start (CLI)
# Scaffold a new docs MCP server project
npx create-docs-mcp my-api-docs
cd my-api-docs
# Configure your docs site URL
cp .env.example .env
# Edit .env → set DOCS_BASE_URL=https://docs.myapi.com
# Build and run
npm run build
npm start
MCP Framework MCP 질문
MCP Framework MCP를 Claude Code에 추가하려면 어떻게 하나요?
터미널에서 claude mcp add mcp-framework -- npx -y mcp-framework를 실행합니다. 모든 프로젝트에서 사용할 수 있게 하려면 --scope user를 추가합니다.
MCP Framework MCP를 Cursor에 추가하려면 어떻게 하나요?
~/.cursor/mcp.json를 열고 mcpServers 아래에 서버를 추가합니다. 위 설치 섹션에 표시된 Cursor 구성을 사용합니다.
MCP Framework MCP는 어떤 도구를 제공하나요?
3개 도구를 제공합니다. 예: search_docs, get_page, list_sections.
새로운 MCP server 프로젝트를 어떻게 시작하나요?
npm install -g mcp-framework를 실행하여 프레임워크 CLI를 설치한 후, mcp create <your project name> 명령어를 실행하면 됩니다.
어떤 전송 프로토콜을 지원하나요?
stdio, SSE, HTTP Stream을 포함한 다양한 전송 방식을 지원합니다.
프레임워크가 도구 스키마를 검증하나요?
네, 빌드 과정 중 자동 검증을 제공하며, mcp validate 명령어를 통해 모든 필드에 설명(description)이 포함되어 있는지 별도로 검증할 수 있습니다.
stdio 대신 HTTP를 사용할 수 있나요?
네, create 명령어 사용 시 --http 플래그를 추가하면 실험적 기능인 HTTP 전송 방식을 사용하는 프로젝트를 생성할 수 있습니다.