https://wikidocs.net/book/19664
claude mcp add --transport stdio github -- npx @modelcontextprotocol/server-github
!image.png
# Basic HTTP connection
claude mcp add --transport http notion https://mcp.notion.com/mcp
# HTTP with authentication header
claude mcp add --transport http secure-api https://api.example.com/mcp \
--header "Authorization: Bearer your-token"# Local Node.js server
claude mcp add --transport stdio myserver -- npx @myorg/mcp-server
# With environment variables
claude mcp add --transport stdio myserver --env KEY=value -- npx server--scope 플래그를 사용하여 MCP 구성이 저장되는 위치를 지정할 수 있다,# Local 범위 (기본값) - 현재 프로젝트, 현재 사용자 전용
claude mcp add --transport http github https://api.github.com/mcp
# 명시적으로 local scope 지정
claude mcp add --transport http stripe --scope local https://mcp.stripe.com
# User 범위 - 모든 프로젝트에서 사용 가능
claude mcp add --transport http hubspot --scope user https://mcp.hubspot.com/anthropic
# Project 범위 - .mcp.json에 저장, 팀과 공유 가능
claude mcp add --transport http paypal --scope project https://mcp.paypal.com/mcp첫 번째 MCP 서버 추가 CLI를 사용한다.
bash claude mcp add --transport stdio github -- npx @modelcontextprotocol/server-github
또는 프로젝트 루트에 .msp.json 파일을 생성한다.
json { "mcpServers": { "github": { "command": "npx", "args": ["@modelcontextprotocol/server-github"], "env": { "GITHUB_TOKEN": "${GITHUB_TOKEN}" } } } }
환경 변수 설정
bash export GITHUB_TOKEN="your_github_personal_access_token”
연결 테스트
bash claude /mcp
MCP 도구 사용
bash /mcp__github__list_prs /mcp__github__create_issue "Title" "Description”
npm install -g @modelcontextprotocol/server-github
npm install -g @modelcontextprotocol/server-database
npm install -g @modelcontextprotocol/server-filesystem
npm install -g @modelcontextprotocol/server-slack
!image.png
# Add HTTP-based server
claude mcp add --transport http github https://api.github.com/mcp
# Add local stdio server
claude mcp add --transport stdio database -- npx @company/db-server
# List all MCP servers
claude mcp list
# Get details on specific server
claude mcp get github
# Remove an MCP server
claude mcp remove github
# Reset project-specific approval choices
claude mcp reset-project-choices
# Import from Claude Desktop
claude mcp add-from-claude-desktop
| 범위 | 위치 | 설명 | 공유 대상 | 승인 필요 |
|---|---|---|---|---|
| Local (기본값) | ~/.claude.json (프로젝트 경로 아래) | 현재 사용자, 현재 프로젝트 전용 (이전 버전에서는 project로 불림) | 본인만 | 아니오 |
| Project | .mcp.json | git 저장소에 체크인됨 | 팀원 | 예 (최초 사용 시) |
| User | ~/.claude.json | 모든 프로젝트에서 사용 가능 (이전 버전에서는 global로 불림) | 본인만 | 아니오 |
.mcp.json에 저장할 수 있다.{
"mcpServers": {
"github": {
"type": "http",
"url": "https://api.github.com/mcp"
}
}
}
# Connect to an OAuth-enabled MCP server (interactive flow)
claude mcp add --transport http my-service https://my-service.example.com/mcp
# Pre-configure OAuth credentials for non-interactive setup
claude mcp add --transport http my-service https://my-service.example.com/mcp \
--client-id "your-client-id" \
--client-secret "your-client-secret" \
--callback-port 8080
| 기능 | 설명 |
|---|---|
| Interactive OAuth | /mcp를 사용하여 브라우저 기반 OAuth 흐름을 트리거합니다 |
| Pre-configured OAuth clients | Notion, Stripe 등 일반적인 서비스를 위한 내장 OAuth 클라이언트 (v2.1.30+) |
| Pre-configured credentials | 자동화된 설정을 위한 --client-id, --client-secret, --callback-port 플래그 |
| Token storage | 토큰은 시스템 키체인에 안전하게 저장됩니다 |
| Step-up auth | 권한이 필요한 작업에 대한 단계적 인증을 지원합니다 |
| Discovery caching | 빠른 재연결을 위해 OAuth 디스커버리 메타데이터가 캐시됩니다 |
| Metadata override | 기본 OAuth 메타데이터 디스커버리를 재정의하기 위한 .mcp.json의 oauth.authServerMetadataUrl |
./well-known/oauth-authorization-server)에서 오류를 반환하지만 작동하는 OIDC 엔드포인트를 제공하는 경우, Claude Code에 특정 URL에서 OAuth 메타데이터를 가져오도록 지시할 수 있다.oauth 객체에서 authServerMetadataURL을 설정한다. URL은 반드시 https://를 사용해야 한다:{
"mcpServers": {
"my-server": {
"type": "http",
"url": "https://mcp.example.com/mcp",
"oauth": {
"authServerMetadataUrl": "https://auth.example.com/.well-known/openid-configuration"
}
}
}
}
--callback-port를 명시한다:claude mcp add --transport http my-service https://my-service.example.com/mcp \
--callback-port 8080
claude mcp add --transport http my-service https://my-service.example.com/mcp \
--client-id "your-client-id" \
--client-secret "your-client-secret" \
--callback-port 8080
${VAR}로 참조하는 표준 패턴을 정리한다.# ~/.bashrc or ~/.zshrc
export GITHUB_TOKEN="ghp_xxxxxxxxxxxxx"
export DATABASE_URL="postgresql://user:pass@localhost/mydb"
export SLACK_TOKEN="xoxb-xxxxxxxxxxxxx"
{
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
}
@server-name:protocol://resource/path 형식으로 MCP 리소스를 인라인 컨텍스트로 끌어오는 방법을 기술한다.@ 멘션 구문을 사용하여 프롬프트에서 MCP 리소스를 직접 참조할 수 있다.@server-name:protocol://resource/path
@database:postgres://mydb/users
| 설정 | 값 | 설명 |
|---|---|---|
ENABLE_TOOL_SEARCH | auto (기본값) | 도구 설명이 컨텍스트의 10%를 초과하면 자동 활성화 |
ENABLE_TOOL_SEARCH | auto:<N> | 커스텀 임계값 N개 도구에서 자동 활성화 |
ENABLE_TOOL_SEARCH | true | 도구 수에 관계없이 항상 활성화 |
ENABLE_TOOL_SEARCH | false | 비활성화; 모든 도구 설명이 전체로 전송됨 |
ENABLE_TOOL_SEARCH이다:auto는 기본 적응형 동작 유지auto:<N>은 임계값을 조정true는 항상 활성화false는 비활성화하고 모든 도구 설명을 그대로 보냄autotruefalse| 제한 | 임계값 | 동작 |
|---|---|---|
| 경고 | 10,000 토큰 | 출력이 크다는 경고가 표시됩니다 |
| 기본 최대값 | 25,000 토큰 | 이 한도를 초과하면 출력이 잘립니다 |
| 디스크 저장 | 50,000 문자 | 50K 문자를 초과하는 도구 결과는 디스크에 저장됩니다 |
MAX_MCP_OUTPUT_TOKENS 환경 변수를 통해 구성할 수 있다.# Increase the max output to 50,000 tokens
export MAX_MCP_OUTPUT_TOKENS=50000
MAX_MCP_OUTPUT_TOKENS라는 global cap이 먼저 노출된다.MAX_MCP_OUTPUT_TOKENS 사용list_changed 알림을 지원한다.도구 정의가 컨텍스트 윈도우를 과부하함
대부분의 MCP 클라이언트는 모든 도구 정의를 사전에 로드한다. 수천 개의 도구에 연결되면, 모델은 사용자의 요청을 읽기도 전에 수십만 토큰을 처리해야 한다.
중간 결과가 추가 토큰을 소비함
모든 중간 도구 결과가 모델의 컨텍스트를 통과한다.
!image.png
!image.png
servers/
├── google-drive/
│ ├── getDocument.ts
│ └── index.ts
├── salesforce/
│ ├── updateRecord.ts
│ └── index.ts
└── ...
// ./servers/google-drive/getDocument.ts
import { callMCPTool } from "../../../client.js";
interface GetDocumentInput {
documentId: string;
}
interface GetDocumentResponse {
content: string;
}
export async function getDocument(
input: GetDocumentInput
): Promise<GetDocumentResponse> {
return callMCPTool<GetDocumentResponse>(
'google_drive__get_document', input
);
}
import * as gdrive from './servers/google-drive';
import * as salesforce from './servers/salesforce';
// Data flows directly between tools — never through the model
const transcript = (
await gdrive.getDocument({ documentId: 'abc123' })
).content;
await salesforce.updateRecord({
objectType: 'SalesMeeting',
recordId: '00Q5f000001abcXYZ',
data: { Notes: transcript }
});
| 이점 | 설명 |
|---|---|
| Progressive Disclosure | Agent가 모든 도구를 사전에 로드하는 대신, 필요한 도구 정의만 파일시스템을 탐색하여 로드합니다 |
| Context-Efficient Results | 모델에 반환되기 전에 실행 환경에서 데이터가 필터링/변환됩니다 |
| Powerful Control Flow | 루프, 조건문, 오류 처리가 모델을 거치지 않고 코드에서 실행됩니다 |
| Privacy Preservation | 중간 데이터(PII, 민감한 레코드)가 실행 환경에 머물며 모델 컨텍스트에 들어가지 않습니다 |
| State Persistence | Agent가 중간 결과를 파일로 저장하고 재사용 가능한 skill 함수를 구축할 수 있습니다 |
| 기능 | 설명 |
|---|---|
| Zero-config discovery | Cursor, Claude, Codex 또는 로컬 설정에서 MCP 서버를 자동 검색합니다 |
| Typed tool clients | mcporter emit-ts가 .d.ts 인터페이스와 바로 실행 가능한 래퍼를 생성합니다 |
| Composable API | createServerProxy()가 .text(), .json(), .markdown() 헬퍼와 함께 camelCase 메서드로 도구를 노출합니다 |
| CLI generation | mcporter generate-cli가 MCP 서버를 --include-tools / --exclude-tools 필터링이 있는 독립형 CLI로 변환합니다 |
| Parameter hiding | 선택적 매개변수가 기본적으로 숨겨져 스키마 장황함을 줄입니다 |
npx mcporter list # No install required — discover servers instantly
pnpm add mcporter # Add to a project
brew install steipete/tap/mcporter # macOS via Homebrew
import { createRuntime, createServerProxy } from "mcporter";
const runtime = await createRuntime();
const gdrive = createServerProxy(runtime, "google-drive");
const salesforce = createServerProxy(runtime, "salesforce");
// Data flows between tools without passing through the model context
const doc = await gdrive.getDocument({ documentId: "abc123" });
await salesforce.updateRecord({
objectType: "SalesMeeting",
recordId: "00Q5f000001abcXYZ",
data: { Notes: doc.text() }
});
# Call a specific tool directly
npx mcporter call linear.create_comment issueId:ENG-123 body:'Looks good!'
# List available servers and tools
npx mcporter list
Elicitation 및 ElicitationResult hook 이벤트를 통해 elicitation 요청에 프로그래밍 방식으로 자동 응답하거나, 사용자 응답을 서버로 보내기 전에 가로채서 수정할 수 있다./mcp__<server>__<prompt>
.mcp.json —plugin 루트 디렉토리에 .mcp.json 파일 배치plugin.json 내 인라인 —plugin 매니페스트 내에서 직접 MCP 서버 정의${CLAUDE_PLUGIN_ROOT} 변수를 사용한다:{
"mcpServers": {
"plugin-tools": {
"command": "node",
"args": ["${CLAUDE_PLUGIN_ROOT}/dist/mcp-server.js"],
"env": {
"CONFIG_PATH": "${CLAUDE_PLUGIN_ROOT}/config.json"
}
}
}
}
mcpServers: 키를 사용하여 agent frontmatter 내에서 인라인으로 정의할 수 있으며, 전체 프로젝트가 아닌 특정 subagent로 범위를 제한한다.---
mcpServers:
my-tool:
type: http
url: https://my-tool.example.com/mcp
---
You are an agent with access to my-tool for specialized operations.
claude mcp serve)# Start Claude Code as an MCP server on stdio
claude mcp serve
claude mcp add --transport stdio claude-agent -- claude mcp serve
!image.png
| MCP 서버 | 용도 | 주요 도구 | 인증 | 실시간 |
|---|---|---|---|---|
| Filesystem | 파일 작업 | read, write, delete | OS 권한 | 예 |
| GitHub | 저장소 관리 | list_prs, create_issue, push | OAuth | 예 |
| Slack | 팀 커뮤니케이션 | send_message, list_channels | 토큰 | 예 |
| Database | SQL 쿼리 | query, insert, update | 자격 증명 | 예 |
| Google Docs | 문서 접근 | read, write, share | OAuth | 예 |
| Asana | 프로젝트 관리 | create_task, update_status | API 키 | 예 |
| Stripe | 결제 데이터 | list_charges, create_invoice | API 키 | 예 |
| Memory | 영구 메모리 | store, retrieve, delete | 로컬 | 아니오 |
${VAR}/${VAR:-default} 환경변수 확장 같은 공통 문법도 기술한다.{
"mcpServers": {
"github": {
"command": "npx",
"args": ["@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
}
}
}
list_prs - 저장소의 모든 PR 나열get_pr - diff를 포함한 PR 세부 정보 가져오기create_pr- 새 PR 생성update_pr - PR 설명/제목 업데이트merge_pr - PR을 메인 브랜치에 병합review_pr - 리뷰 코멘트 추가/mcp__github__get_pr 456
# Returns:
Title: Add dark mode support
Author: @alice
Description: Implements dark theme using CSS variables
Status: OPEN
Reviewers: @bob, @charlielist_issues - 모든 이슈 나열get_issue - 이슈 세부 정보 가져오기create_issue - 새 이슈 생성close_issue - 이슈 닫기add_comment - 이슈에 코멘트 추가get_repo_info - 저장소 세부 정보list_files - 파일 트리 구조get_file_content - 파일 내용 읽기search_code - 코드베이스 전체 검색list_commits - 커밋 히스토리get_commit - 특정 커밋 세부 정보create_commit - 새 커밋 생성export GITHUB_TOKEN="your_github_token"
# Or use the CLI to add directly:
claude mcp add --transport stdio github -- npx @modelcontextprotocol/server-github${VAR} 및 ${VAR:-default} 구문은 다음 필드에서 작동한다: command, args, env, url, headers.{
"mcpServers": {
"api-server": {
"type": "http",
"url": "${API_BASE_URL:-https://api.example.com}/mcp",
"headers": {
"Authorization": "Bearer ${API_KEY}",
"X-Custom-Header": "${CUSTOM_HEADER:-default-value}"
}
},
"local-server": {
"command": "${MCP_BIN_PATH:-npx}",
"args": ["${MCP_PACKAGE:-@company/mcp-server}"],
"env": {
"DB_URL": "${DATABASE_URL:-postgresql://localhost/dev}"
}
}
}
}
${VAR} - 환경 변수 사용, 설정되지 않으면 오류 - ${VAR:-default} - 환경 변수 사용, 설정되지 않으면 기본값으로 대체{
"mcpServers": {
"database": {
"command": "npx",
"args": ["@modelcontextprotocol/server-database"],
"env": {
"DATABASE_URL": "postgresql://user:pass@localhost/mydb"
}
}
}
}
User: Fetch all users with more than 10 orders
Claude: I'll query your database to find that information.
# Using MCP database tool:
SELECT u.*, COUNT(o.id) as order_count
FROM users u
LEFT JOIN orders o ON u.id = o.user_id
GROUP BY u.id
HAVING COUNT(o.id) > 10
ORDER BY order_count DESC;
# Results:
- Alice: 15 orders
- Bob: 12 orders
- Charlie: 11 orders
export DATABASE_URL="postgresql://user:pass@localhost/mydb"
# Or use the CLI to add directly:
claude mcp add --transport stdio database -- npx @modelcontextprotocol/server-database
# Daily Report Workflow using Multiple MCPs
## Setup
1. GitHub MCP - fetch PR metrics
2. Database MCP - query sales data
3. Slack MCP - post report
4. Filesystem MCP - save report
## Workflow
### Step 1: Fetch GitHub Data
/mcp__github__list_prs completed:true last:7days
Output:
- Total PRs: 42
- Average merge time: 2.3 hours
- Review turnaround: 1.1 hours
### Step 2: Query Database
SELECT COUNT(*) as sales, SUM(amount) as revenue
FROM orders
WHERE created_at > NOW() - INTERVAL '1 day'
Output:
- Sales: 247
- Revenue: $12,450
### Step 3: Generate Report
Combine data into HTML report
### Step 4: Save to Filesystem
Write report.html to /reports/
### Step 5: Post to Slack
Send summary to #daily-reports channel
Final Output:
Report generated and posted
47 PRs merged this week
$12,450 in daily sales
export GITHUB_TOKEN="your_github_token"
export DATABASE_URL="postgresql://user:pass@localhost/mydb"
export SLACK_TOKEN="your_slack_token"
# Add each MCP server via the CLI or configure them in .mcp.json
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["@modelcontextprotocol/server-filesystem", "/home/user/projects"]
}
}
}
| 작업 | 명령 | 용도 |
|---|---|---|
| List files | ls ~/projects | 디렉토리 내용 표시 |
| Read file | cat src/main.ts | 파일 내용 읽기 |
| Write file | create docs/api.md | 새 파일 생성 |
| Edit file | edit src/app.ts | 파일 수정 |
| Search | grep "async function" | 파일에서 검색 |
| Delete | rm old-file.js | 파일 삭제 |
# Use the CLI to add directly:
claude mcp add --transport stdio filesystem -- npx @modelcontextprotocol/server-filesystem /home/user/projects
| 영역 | 대표 도구 | 용도 |
|---|---|---|
| 책 관리 | list_books, create_book, get_book, get_book_toc | 내 책 목록·생성·구조 조회 |
| 페이지 관리 | create_page, get_page, update_page, upload_page_image | 페이지 단위 작성·수정·이미지 업로드 |
| 블로그 관리 | list_blogs, create_blog, update_blog, upload_blog_image 외 | 위키독스 블로그 자동 발행 |
claude mcp add --transport http wikidocs https://wikidocs.net/mcp \
--header "Authorization: Token <발급받은 토큰>"
get_book을 부르면 응답이 매우 커진다. 위키독스 가이드는 다음 흐름을 권한다:get_book_toc로 구조부터 파악get_page로 조회update_page는 부분 수정 방식이므로 변경할 필드만 보낸다.!image.png
managed-mcp.json 구성 파일을 통해 MCP 서버 정책을 적용할 수 있다./Library/Application Support/ClaudeCode/managed-mcp.json~/.config/ClaudeCode/managed-mcp.json%APPDATA%\ClaudeCode\managed-mcp.jsonallowedMcpServers -- 허용된 서버의 화이트리스트deniedMcpServers -- 금지된 서버의 블랙리스트allowedMcpServers와 deniedMcpServers가 모두 서버와 매칭될 경우, 거부 규칙이 우선한다.{
"allowedMcpServers": [
{
"serverName": "github",
"serverUrl": "https://api.github.com/mcp"
},
{
"serverName": "company-internal",
"serverCommand": "company-mcp-server"
}
],
"deniedMcpServers": [
{
"serverName": "untrusted-*"
},
{
"serverUrl": "http://*"
}
]
}
.mcp.json을 git에 유지하되 시크릿에는 환경 변수 사용# Verify MCP server is installed
npm list -g @modelcontextprotocol/server-github
# Install if missing
npm install -g @modelcontextprotocol/server-github
# Verify environment variable is set
echo $GITHUB_TOKEN
# Re-export if needed
export GITHUB_TOKEN="your_token"
# Verify token has correct permissions
# Check GitHub token scopes at: https://github.com/settings/tokens
ping api.github.com~/.claude/logs/