Skip to main content
Glama
afshinator

mcp-server-pexels

by afshinator

mcp-server-pexels

Pexels 스톡 사진 및 동영상 검색을 위한 MCP 서버입니다. LLM에 최적화되어 있습니다.

Pexels는 무료 스톡 사진과 동영상을 제공합니다.

기능

  • 사진 검색 — 필터(검색어, 방향, 크기, 색상, 로케일)를 사용하여 사진 검색

  • 동영상 검색 — 동영상 검색, 1920x1080에 가장 가까운 HD .mp4 자동 선택

  • 상세 정보 가져오기 — ID를 통해 사진/동영상의 전체 메타데이터 검색

  • 지능형 캐싱 — 검색 시 10분 TTL, ID 조회 시 60분 TTL 적용

  • 오류 처리 — 유용한 메시지와 함께 정상적인 실패 처리 (MCP 모범 사례 준수)

  • 출처 표기 — 모든 결과에 사진작가 크레딧 필수 포함

Related MCP server: Pexels MCP Server

사전 요구 사항

빠른 시작 (2분)

1. API 키 발급

pexels.com/api에서 가입하세요. 무료이며 신용카드가 필요하지 않습니다.

2. 서버 빌드

npm install && npm run build

3. Claude Desktop에 추가

~/Library/Application Support/Claude/claude_desktop_config.json (Mac) 또는 %APPDATA%\Claude\claude_desktop_config.json (Windows) 파일을 열고 다음을 추가하세요:

{
  "mcpServers": {
    "pexels": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-server-pexels/build/index.js"],
      "env": {
        "PEXELS_API_KEY": "YOUR_PEXELS_API_KEY"
      }
    }
  }
}

Windows 참고: node.exe의 전체 경로를 사용하거나 Node를 PATH에 추가하세요. Windows에서도 경로에 슬래시(/)를 사용할 수 있습니다.

4. Claude Desktop 재시작

이제 pexels_search_photos, pexels_search_videos, pexels_get_details를 서버에서 사용할 수 있습니다.

구성

.mcp.json 또는 claude_desktop_config.json에 추가하세요:

{
  "mcpServers": {
    "pexels": {
      "command": "node",
      "args": ["/absolute/path/to/build/index.js"],
      "env": {
        "PEXELS_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

환경 변수

환경 변수에 PEXELS_API_KEY를 설정하세요. 로컬 개발을 위해 .env 파일을 생성하세요:

PEXELS_API_KEY=your_pexels_api_key

개발

npm run dev      # watch mode
npm run inspector # MCP Inspector
npm test          # run tests

도구

도구

설명

pexels_search_photos

검색어로 사진 검색

pexels_search_videos

동영상 검색

pexels_get_details

ID와 유형으로 상세 정보 가져오기

아키텍처

  • src/index.ts — 진입점, MCP 서버 설정

  • src/tools/ — 도구 구현

  • src/shared/ — 캐시, API 클라이언트, 오류, 타입, 동영상 선택기

  • src/utils/ — Zod 유효성 검사 스키마

엔지니어링 결정

결정

근거

캐시 우선 아키텍처

Pexels API는 시간당 200회 요청을 허용합니다. 캐싱(검색 시 10분 TTL, ID 조회 시 60분 TTL)은 할당량을 보존하고, 캐시 적중 시 지연 시간을 5ms 미만으로 줄이며, 에이전트가 동일한 컨텍스트를 자주 재요청하는 프로덕션 AI 시스템에서 중요한 API 비용 인식을 보여줍니다.

호출 시 즉시 실패(Fail-fast)

MCP 서버는 자식 프로세스로 생성되므로 시작 시점에 실패해서는 안 됩니다. 서버는 시작 시 경고를 표시하지만, 첫 번째 도구 호출 시 구조화된 isError: true와 함께 정상적으로 실패 처리합니다.

Zod 유효성 검사 스키마

MCP v2 SDK는 z.object() 래퍼를 요구합니다. API에 도달하기 전에 잘못된 입력을 포착합니다.

미디어용 resource_link

원격 이미지와 동영상은 적절한 mimeType을 가진 MCP resource_link 콘텐츠 블록으로 제공됩니다. 텍스트 블록의 마크다운 이미지 링크는 resource_link를 렌더링하지 않는 클라이언트를 위한 대체 수단으로 유지됩니다.

순수 동영상 선택

동영상 선택 로직은 video-selector.ts로 분리되어 도구 핸들러와 독립적으로 테스트 가능합니다.

하드코딩된 출처 표기

Pexels 서비스 약관에 따라 필수입니다. 모든 텍스트 응답에 포함됩니다.

호환성

StdioClientTransport를 통해 @modelcontextprotocol/sdk v1.29+와 테스트되었습니다. 통합 테스트 스위트는 빌드된 서버를 생성하고 모든 도구 호출을 SDK의 CallToolResultSchema 및 ContentBlockSchema에 대해 검증합니다.

모든 성공적인 응답의 마지막 콘텐츠 요소에는 타입이 지정된 데이터(id, kind, creatorName, dimensions, URLs)를 포함하는 구조화된 JSON 블록이 추가됩니다. 다운스트림 클라이언트와 에이전트 프레임워크는 마크다운 텍스트를 정규식으로 파싱하는 대신 이 블록을 직접 파싱할 수 있습니다. |

향후 개선 사항

  • 도구 실행 텔레메트리 — 캐시 적중/미적중, 쿼리 실행 시간, 오류율에 대한 구조화된 로깅을 추가합니다. 이는 프로덕션 환경에서 AI 에이전트의 문제 해결을 지원하고 관측 가능성 모범 사례를 보여줍니다. |

  • 메트릭 엔드포인트 — 모니터링을 위해 카운터(처리된 요청, 캐시 적중률, 남은 API 할당량)를 노출합니다. |

  • 사용자 지정 TTL 구성 — 사용자가 환경 변수를 통해 캐시 TTL을 조정할 수 있도록 합니다. |

커뮤니티 기여

  • 환영합니다! 🌟

라이선스

비공식 커뮤니티 프로젝트입니다. Pexels와 관련이 없습니다.

Available Tools

3 tools
pexels_get_detailsGet Pexels DetailsA
Read-onlyIdempotent

Get detailed information about a specific photo or video by ID.

ParametersJSON Schema
NameRequiredDescriptionDefault
idYes
typeYes
force_refreshNo

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate read-only, non-destructive, and idempotent behavior. The description adds that it returns 'detailed information' but does not disclose any additional behavioral traits like rate limits or required permissions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no wasted words. It efficiently conveys the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with three parameters and no output schema, the description is minimally adequate. It fails to hint at the output format or behavior of the optional 'force_refresh' parameter, leaving some gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description should compensate. It only mentions 'by ID', leaving parameters like 'type' and 'force_refresh' unexplained. While the enum for type provides some guidance, the description adds minimal value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the verb 'Get', resource 'detailed information about a specific photo or video', and method 'by ID'. It effectively distinguishes from sibling search tools (pexels_search_photos, pexels_search_videos) which query by keywords.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when a specific ID is known, contrasting with search tools. However, it does not explicitly state when not to use it or mention alternative tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

pexels_search_photosSearch Pexels PhotosA
Read-onlyIdempotent

Search for stock photos by query with optional filters for orientation, size, color, and locale. Returns 3-5 results with mandatory photographer attribution.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes
orientationNo
sizeNo
colorNo
localeNo
per_pageNo
force_refreshNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
idYes
kindYes
creatorNameYes
creatorUrlYes
pageUrlYes
previewUrlYes
mediaUrlYes
mediaMimeTypeYes
dimensionsYes
avgColorYes
altYes

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate read-only, non-destructive, and idempotent behavior. The description adds valuable behavioral details: returns 3-5 results and requires photographer attribution, which goes beyond annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, extremely concise, with no filler. Every word adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the presence of an output schema and annotations, the description covers core functionality well. It lacks mention of per_page and force_refresh, but is otherwise sufficient for a search tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions four optional filters (orientation, size, color, locale), adding semantic context that they are filters. However, it omits per_page and force_refresh, and schema coverage is 0%. The added value is marginal.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Search for stock photos by query with optional filters', specifying verb and resource. It distinguishes from siblings (pexels_get_details for individual photos, pexels_search_videos for videos) by focusing on photo search.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

While the purpose is clear, the description does not provide explicit guidance on when to use this tool versus its siblings or alternatives. Usage is implied but not contrasted.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

pexels_search_videosSearch Pexels VideosA
Read-onlyIdempotent

Search for stock videos by query with optional filters. Returns HD-quality .mp4 links with mandatory attribution.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes
orientationNo
sizeNo
localeNo
per_pageNo
force_refreshNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
idYes
kindYes
creatorNameYes
creatorUrlYes
pageUrlYes
previewUrlYes
mediaUrlYes
mediaMimeTypeYes
dimensionsYes
durationSecondsYes

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already signal read-only, non-destructive, idempotent behavior. The description adds value by disclosing that results are HD-quality .mp4 links with mandatory attribution, which are not implied by annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that front-loads the action and key details. Every word earns its place with no fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The output schema exists, covering return values. The description adds helpful context on output format and attribution. Missing aspects like pagination and enum specifics are minor given overall clarity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description provides no individual parameter explanations. It only mentions 'optional filters' generically, failing to compensate for the missing schema descriptions of the 6 parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool searches for stock videos by query with optional filters. It mentions HD-quality .mp4 links and mandatory attribution, which distinguishes it from sibling tools like pexels_search_photos (photos) and pexels_get_details (details).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for video searches via 'stock videos' and optional filters, but does not explicitly state when to use this tool over siblings. However, the tool name and context signals make the distinction clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updates
    • Changedpexels_search_photos1 field changed
      • changedOutput schema / (root)
        Previous value: -nullNew value: +{
        +  "$schema": "http://json-schema.org/draft-07/schema#",
        +  "additionalProperties": false,
        +  "properties": {
        +    "alt": {
        +      "type": "string"
        +    },
        +    "avgColor": {
        +      "type": "string"
        +    },
        +    "creatorName": {
        +      "type": "string"
        +    },
        +    "creatorUrl": {
        +      "type": "string"
        +    },
        +    "dimensions": {
        +      "additionalProperties": false,
        +      "properties": {
        +        "height": {
        +          "type": "number"
        +        },
        +        "width": {
        +          "type": "number"
        +        }
        +      },
        +      "required": [
        +        "width",
        +        "height"
        +      ],
        +      "type": "object"
        +    },
        +    "id": {
        +      "type": "number"
        +    },
        +    "kind": {
        +      "const": "photo",
        +      "type": "string"
        +    },
        +    "mediaMimeType": {
        +      "const": "image/jpeg",
        +      "type": "string"
        +    },
        +    "mediaUrl": {
        +      "type": "string"
        +    },
        +    "pageUrl": {
        +      "type": "string"
        +    },
        +    "previewUrl": {
        +      "type": "string"
        +    }
        +  },
        +  "required": [
        +    "id",
        +    "kind",
        +    "creatorName",
        +    "creatorUrl",
        +    "pageUrl",
        +    "previewUrl",
        +    "mediaUrl",
        +    "mediaMimeType",
        +    "dimensions",
        +    "avgColor",
        +    "alt"
        +  ],
        +  "type": "object"
        +}
    • Changedpexels_search_videos1 field changed
      • changedOutput schema / (root)
        Previous value: -nullNew value: +{
        +  "$schema": "http://json-schema.org/draft-07/schema#",
        +  "additionalProperties": false,
        +  "properties": {
        +    "creatorName": {
        +      "type": "string"
        +    },
        +    "creatorUrl": {
        +      "type": "string"
        +    },
        +    "dimensions": {
        +      "additionalProperties": false,
        +      "properties": {
        +        "height": {
        +          "type": "number"
        +        },
        +        "width": {
        +          "type": "number"
        +        }
        +      },
        +      "required": [
        +        "width",
        +        "height"
        +      ],
        +      "type": "object"
        +    },
        +    "durationSeconds": {
        +      "type": "number"
        +    },
        +    "id": {
        +      "type": "number"
        +    },
        +    "kind": {
        +      "const": "video",
        +      "type": "string"
        +    },
        +    "mediaMimeType": {
        +      "type": "string"
        +    },
        +    "mediaUrl": {
        +      "type": "string"
        +    },
        +    "pageUrl": {
        +      "type": "string"
        +    },
        +    "previewUrl": {
        +      "type": "string"
        +    }
        +  },
        +  "required": [
        +    "id",
        +    "kind",
        +    "creatorName",
        +    "creatorUrl",
        +    "pageUrl",
        +    "previewUrl",
        +    "mediaUrl",
        +    "mediaMimeType",
        +    "dimensions",
        +    "durationSeconds"
        +  ],
        +  "type": "object"
        +}
  2. 3 tool updatesv1.0.0
    • First observedpexels_get_details
    • First observedpexels_search_photos
    • First observedpexels_search_videos

TDQS

A4.1/5.0

Scored across 3 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: searching photos, searching videos, and getting details by ID. No overlap or ambiguity.

Naming Consistency5/5

All tools follow a consistent 'pexels_verb_noun' pattern using snake_case, making it predictable for an agent to infer functionality.

Tool Count4/5

Three tools is minimal but appropriate for a focused image/video search service. It covers the core workflow without unnecessary bloat.

Completeness4/5

The set covers search and retrieval of photos and videos, but lacks features like curated collections or trending content, which are minor omissions.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers