swapi_mcp
swapi_mcp
관측 가능한 AI 에이전트를 구축하기 위한 작은 종단 간(end-to-end) 참조 프로젝트로, MCP 서버가 Star Wars API를 감싸고, 이를 구동하는 Claude 에이전트와 웹 채팅 UI를 포함합니다 — 모두 OpenTelemetry와 Grafana Cloud(분산 추적, RED 메트릭, 프론트엔드 RUM, AI/에이전트 관측성)로 계측되어 있습니다.
이 프로젝트의 목적은 하나의 실행 가능한 코드베이스에서 MCP 도구 경계, 에이전트의 도구 사용 루프, 그리고 브라우저 클릭에서 업스트림 HTTP 호출까지 내려갔다가 다시 돌아오는 전체 스택 추적이 어떻게 맞물리는지 보여주는 것입니다.
구성 요소
MCP(stdio)를 통해 서로 통신하는 두 부분으로 구성됩니다:
MCP 서버 (src/index.ts, src/tools/) — Star Wars API를 6개 리소스(people, planets, films, species, vehicles, starships)에 걸쳐 18개 도구로 감쌉니다: 리소스당 search_, get-all, get-by-id 도구입니다. 순수한 도구 제공자일 뿐이며 어떤 결정도 내리지 않습니다.
에이전트 (src/agent/) — 의사 결정자:
mcpClient.ts— 빌드된 서버를 stdio로 실행(spawn)하고 MCP 클라이언트로 연결합니다.agent.ts— 수동 도구 사용 루프: 질문과 서버의 도구를 Claude에 보내고, MCP를 통해 요청된 각 도구를 실행한 뒤 결과를 다시 피드백하고, 완료될 때까지 반복합니다.main.ts— CLI 진입점입니다.server.ts+public/index.html— HTTP 서버와 단일 페이지 채팅 UI입니다.
Related MCP server: SWAPI MCP Server
관측성
아래의 모든 기능은 선택 사항이며 환경 변수로 제어됩니다 — 에이전트는 이 중 어떤 것도 없이도 정상적으로 실행됩니다.
분산 추적 (OpenTelemetry → Tempo): 하나의 추적이
browser → POST /ask → agent.turn → llm.request / tool.call → tool.execute → swapi.fetch체인을 세 개의 서비스(swapi-web,swapi-agent,swapi-mcp-server)에 걸쳐 관통합니다. 추적 컨텍스트는 요청_meta를 통해 MCP 경계를 넘어 전파됩니다.RED 메트릭 (→ Mimir): 도구별 및 LLM 호출별 rate / errors / duration 히스토그램과 비용 산정용 토큰 사용량 카운터로,
model,error,error.type태그가 지정됩니다.프론트엔드 RUM (Grafana Faro): Web Vitals, JS 오류, 브라우저→백엔드 추적 전파.
AI / 에이전트 관측성 (
@grafana/agent-o11y): 정규화된 LLM 생성 및 도구 실행.데모 장애 주입 (
src/chaos.ts): 선택적으로 한 리소스가 시뮬레이션된 503을 반환하고 다른 리소스는 50% 느리게 실행되도록 하여, 대시보드에 실제 오류 및 지연 신호가 표시되게 합니다.
사전 요구 사항
Node.js 22+ (
--env-file사용)Yarn 4 (Corepack 경유)
Anthropic API 키 (에이전트용)
Grafana Cloud 계정 (선택 사항 — 관측성 기능에만 필요)
설정
yarn install
yarn buildMCP 서버 직접 사용하기 (예: Claude Desktop)
MCP 클라이언트를 빌드된 서버에 연결하세요:
{
"mcpServers": {
"swapi": { "command": "node", "args": ["/absolute/path/to/swapi_mcp/build/index.js"] }
}
}에이전트 실행
최소한 Anthropic 키를 포함한 .env 파일을 생성하세요(git-ignored):
ANTHROPIC_API_KEY=sk-ant-...그런 다음:
yarn dev # build + serve the web UI at http://localhost:8787
yarn ask "Who is Luke's homeworld?" # one-shot CLI환경 변수
변수 | 용도 |
| 에이전트에 필수입니다. |
| 모델 재정의(기본값 |
| 웹 서버 포트(기본값 |
| Grafana Cloud로 OTLP 추적 및 메트릭을 활성화합니다. |
| Grafana Faro 프론트엔드 RUM을 활성화합니다(컬렉터 URL은 설계상 공개입니다). |
| Grafana Agent Observability를 활성화합니다(토큰에는 |
| 데모 장애 주입(기본값 꺼짐). |
참고 사항
학습/데모용 프로젝트입니다. 데이터는 SWAPI의 정적 미러에서 가져온 것으로, SWAPI는 동작(actions)이 아닌 연관 관계(캐릭터가 영화에 "출연한다")를 모델링합니다 — 따라서 답변도 그에 맞게 표현됩니다.
라이선스
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables searching characters, planets, and films from the Star Wars universe via the SWAPI API.4121ISC
- AlicenseNot gradedqualityBmaintenanceEnables LLMs and clients to search for Star Wars characters, planets, and films by exposing SWAPI as MCP tools.1MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for querying the Star Wars universe via the SWAPI API, providing access to characters, films, starships, vehicles, species, and planets.ISC
- FlicenseBqualityBmaintenanceA Model Context Protocol server that exposes Star Wars API data as MCP tools. It enables users to list available categories and retrieve character information.3140
Related MCP Connectors
SWAPI MCP — wraps the Star Wars API (swapi.dev, free, no auth)
Star Wars API (SWAPI) as a remote MCP server: films, people, planets, species, starships, vehicles.
Rick and Morty MCP — wraps the Rick and Morty API (free, no auth)
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/jasonwarta/swapi_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server