Skip to main content
Glama
EmaCuvillier

cosmos-mcp

by EmaCuvillier

cosmos-mcp

Servidor MCP (Model Context Protocol) en TypeScript que expone APIs públicas de la NASA para Cursor. Incluye tools, un resource, un prompt MCP y una skill propia (briefing-espacial), con respuestas visuales y demo reproducible.

Demo

Pedile a Cursor Armame un briefing espacial de hoy y la skill combina la imagen astronómica del día con los asteroides cercanos.

Related MCP server: NASA-MCP

Por qué

En vez de copiar/pegar URLs de api.nasa.gov, el agente puede pedir en español cosas como “mostrame la foto astronómica de hoy” o “armame un briefing espacial” y resolverlo con tools tipadas, validadas y con manejo de errores.

Vista general

Cosmos MCP: arquitectura, capacidades y briefing visual

Esta lámina resume el recorrido completo y puede usarse directamente en la presentación. El diagrama siguiente se mantiene como versión técnica y editable.

Arquitectura

flowchart LR
  User[Usuario] -->|lenguaje natural| Cursor[Cursor Agent]
  Skill[briefing-espacial] -.-> Cursor
  Cursor -->|stdio JSON-RPC| MCP[cosmos-mcp]
  MCP --> Tools[Tools]
  MCP --> Resource[Resource APOD]
  MCP --> Prompt[Prompt briefing]
  Tools --> NASA[api.nasa.gov]
  Resource --> NASA
  MCP -->|Markdown + datos estructurados| Cursor

Detalle: docs/architecture-diagram.md.

Capacidades MCP

Tools

  • apod_por_fecha: Astronomy Picture of the Day (imagen o video).

  • fotos_marte: fotos de Curiosity, Opportunity, Spirit o Perseverance.

  • asteroides_cercanos: NEOs en un rango de hasta 7 días, ordenados por cercanía.

  • imagen_tierra: imágenes EPIC de la Tierra desde DSCOVR.

Todas están anotadas como operaciones de solo lectura y devuelven:

  • Markdown visual: imágenes, links, tablas y contexto listos para renderizar.

  • structuredContent: los mismos datos en estructura estable para el agente, tests u otros clientes.

Resource

cosmos://apod/today publica la APOD actual como text/markdown. Demuestra que MCP también puede ofrecer contenido direccionable, no solo ejecutar tools.

Prompt

briefing-del-dia publica una plantilla MCP reutilizable que guía al agente para combinar APOD + NeoWs, aplicar el disclaimer correcto y producir un boletín en español.

Requisitos

  • Node.js 20+

  • (Opcional) API key gratis en api.nasa.gov. Sin key se usa DEMO_KEY (límites más bajos).

Instalación

cd mcp-Boost   # o la ruta de este repo
npm install
cp .env.example .env   # editá NASA_API_KEY si tenés una

Scripts útiles:

npm run dev      # server MCP por stdio (tsx)
npm run build && npm start
npm test
npm run lint

Conectar a Cursor

  1. Abrí Cursor Settings → MCP (o editá tu mcp.json).

  2. Agregá el server (reemplazá la ruta absoluta):

{
  "mcpServers": {
    "cosmos-mcp": {
      "command": "npx",
      "args": ["tsx", "/ABS/PATH/mcp-Boost/src/server.ts"],
      "env": {
        "NASA_API_KEY": "DEMO_KEY"
      }
    }
  }
}

Alternativa con build:

{
  "mcpServers": {
    "cosmos-mcp": {
      "command": "node",
      "args": ["/ABS/PATH/mcp-Boost/dist/server.js"],
      "env": {
        "NASA_API_KEY": "DEMO_KEY"
      }
    }
  }
}
  1. Reiniciá el MCP / Cursor y verificá que aparezcan 4 tools, 1 resource y 1 prompt.

La variable definida en mcp.json tiene prioridad sobre .env. Reemplazá DEMO_KEY por tu key o ejecutá el comando con el directorio del proyecto como working directory para que dotenv lea .env.

Probar con MCP Inspector

npx @modelcontextprotocol/inspector npx tsx src/server.ts

Desde la UI del Inspector podés listar tools y llamarlas sin abrir el chat.

El Inspector permite mostrar en clase las tres primitives sin depender de que el agente decida invocarlas: tools/list, resources/list y prompts/list.

Skill: briefing-espacial

Skill de proyecto en .cursor/skills/briefing-espacial/SKILL.md.

Al abrir este repo en Cursor, el agente puede usarla cuando pidas un briefing o resumen espacial: combina apod_por_fecha + asteroides_cercanos y responde en español rioplatense, tono divulgativo.

Demo — prompts para la clase

  1. ¿Cuál es la imagen astronómica del día (APOD)?

  2. Mostrame 5 fotos recientes del rover Perseverance.

  3. ¿Hay asteroides cercanos a la Tierra entre hoy y dentro de 3 días?

  4. Quiero ver la Tierra desde el espacio (EPIC) del 2024-06-01.

  5. Armame un briefing espacial de hoy. ← ejercita la skill

Guion visual recomendado (3 minutos)

  1. Mostrar el diagrama y explicar que Cursor es el cliente MCP, no la fuente de datos.

  2. Abrir MCP Inspector y listar las 4 tools, el resource y el prompt.

  3. Ejecutar apod_por_fecha: señalar input Zod, annotations de solo lectura, imagen Markdown y structuredContent.

  4. En Cursor, pedir Armame un briefing espacial de hoy para mostrar cómo la skill orquesta dos tools.

  5. Cerrar con el canvas visual del proyecto y el flujo completo.

sequenceDiagram
  participant U as Usuario
  participant C as Cursor
  participant M as Cosmos MCP
  participant N as NASA API
  U->>C: "Armame un briefing espacial"
  C->>M: apod_por_fecha
  M->>N: GET /planetary/apod
  N-->>M: APOD
  M-->>C: Markdown + structuredContent
  C->>M: asteroides_cercanos
  M->>N: GET /neo/rest/v1/feed
  N-->>M: NEOs
  M-->>C: Markdown + structuredContent
  C-->>U: Briefing visual y contextualizado

Qué contar técnicamente

  • MCP desacopla al agente de la implementación de NASA.

  • Zod valida argumentos antes de llamar a una API externa.

  • Annotations informan al host que las tools son de solo lectura.

  • Resources y prompts muestran que MCP es más amplio que function calling.

  • La skill orquesta herramientas y aporta criterios editoriales sin duplicar acceso a datos.

Tests

Los unit tests mockean fetch (no pegan a la API real):

npm test

Estructura

src/
  server.ts           # entrypoint MCP (stdio)
  nasaClient.ts       # HTTP + rate limit / errores
  types.ts
  tools/              # apod, mars, neo, epic
tests/
.cursor/skills/briefing-espacial/
docs/

Notas

  • Los logs del server van a stderr para no romper el transporte stdio.

  • "potencialmente peligroso" en NeoWs es una categoría técnica de la NASA, no una alerta de impacto.

  • Para una entrega pública, agregá al README una captura del Inspector y otra del briefing renderizado, sin exponer la API key.

Available Tools

4 tools
apod_por_fechaImagen astronómica del díaA
Read-onlyIdempotent

Trae la Astronomy Picture of the Day (APOD) de la NASA para una fecha. Si no pasás fecha, usa hoy. Úsala cuando el usuario pida la imagen astronómica del día, APOD o una foto del cosmos de cierta fecha.

ParametersJSON Schema
NameRequiredDescriptionDefault
fechaNoFecha en formato YYYY-MM-DD. Si no se pasa, usa la fecha de hoy.

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint, so the safety profile is covered. The description adds a meaningful behavioral detail beyond annotations: the default behavior of using today's date when no date is provided, which is not inferable from schema alone.

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 short sentences, front-loaded with the core action and resource, and includes usage guidance without redundancy. Every sentence earns its place, and there is 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?

For a simple read-only tool with one optional parameter and good annotations, the description covers purpose, date parameter, and use case. It doesn't detail the return payload, but the tool is simple and self-explanatory; a return format is not critical for selection.

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?

Schema coverage is 100%, with the parameter already documented with format and default. The description reinforces the date parameter and default behavior, but adds little beyond what the schema already provides. Baseline 3 is appropriate because the schema carries the semantic load.

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 it fetches NASA's Astronomy Picture of the Day for a specific date, using a specific verb ('Trae') and resource. It distinguishes itself from sibling tools by naming APOD/photo of the cosmos for a date, which is distinct from Mars photos, asteroids, or Earth images.

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?

Explicit usage guidance is provided: 'Úsala cuando el usuario pida la imagen astronómica del día, APOD o una foto del cosmos de cierta fecha.' It gives clear context for when to use the tool, though it doesn't explicitly contrast with sibling tools or state when not to use it.

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

asteroides_cercanosAsteroides cercanos a la TierraA
Read-onlyIdempotent

Lista asteroides cercanos a la Tierra (NeoWs) en un rango de fechas de hasta 7 días. Ordena por cercanía. Úsala para acercamientos, NEOs o si hay algún asteroide relevante.

ParametersJSON Schema
NameRequiredDescriptionDefault
fecha_finYesFin del rango (YYYY-MM-DD). Máximo 7 días desde fecha_inicio.
fecha_inicioYesInicio del rango (YYYY-MM-DD).

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, and non-destructive behavior. The description adds value by stating the date range limit ('hasta 7 días') and the sorting behavior ('Ordena por cercanía'), which are not captured in annotations or schema. No contradiction with 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?

Two sentences with no wasted words. The description front-loads the action and resource, then adds constraints and usage context efficiently.

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?

For a simple two-parameter read-only list tool with good annotations and full schema coverage, the description covers purpose, constraints, and usage context. It lacks return-format details (e.g., fields, units), but the task is simple and no output schema is present, so only a slight gap.

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?

Schema coverage is 100%: both fecha_inicio and fecha_fin are described with patterns and the 7-day constraint. The description reinforces the 7-day limit but adds no additional parameter meaning beyond the schema, so baseline 3 applies.

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 lists near-Earth asteroids (NeoWs) for a date range, with a specific verb ('Lista') and resource. It distinguishes itself from sibling tools by focusing on asteroids, approaches, and NEOs, which is immediately apparent.

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 explicitly says to use it for 'acercamientos, NEOs o si hay algún asteroide relevante', providing clear when-to-use context. It doesn't explicitly mention when not to use it or name alternatives, but the sibling tools are topically distinct enough that exclusions are implied.

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

fotos_marteFotos de rovers en MarteA
Read-onlyIdempotent

Trae fotos de los rovers de Marte (Curiosity, Opportunity, Spirit, Perseverance). Podés filtrar por sol, fecha terrestre o cámara. Si no pasás sol/fecha, devuelve las más recientes. Úsala cuando pidan fotos de Marte o de un rover.

ParametersJSON Schema
NameRequiredDescriptionDefault
solNoDía marciano (sol). Opcional.
roverYesRover de Marte: curiosity, opportunity, spirit o perseverance.
camaraNoCámara del rover (ej. NAVCAM, MAST, FHAZ). Opcional.
fecha_terrestreNoFecha terrestre YYYY-MM-DD. Opcional.

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, and non-destructive nature, lowering the bar. The description adds valuable behavioral context: if no sol/date is provided, it returns the most recent photos. This goes beyond schema and annotations, though it does not detail rate limits or response format.

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 three sentences, front-loaded with the main purpose, followed by filtering options and a usage tip. Every sentence contributes valuable information without redundancy or filler.

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?

For a simple read-only photo-fetching tool, the description covers essential aspects: purpose, filters, default behavior, and when to use it. Although there is no output schema, the description's mention of 'fotos' implies the return type. Minor gaps like response format details are acceptable given the tool's simplicity.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3. The description adds meaning by explaining that sol and fecha_terrestre are filters and that omitting them returns the most recent photos. This clarifies the interaction between parameters beyond the schema definitions.

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's purpose: fetching Mars rover photos from Curiosity, Opportunity, Spirit, and Perseverance. It specifies the resource (Mars rovers) and distinguishes it from sibling tools (APOD, asteroids, Earth images) by focusing on Mars rover photos.

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 provides explicit usage guidance: 'Úsala cuando pidan fotos de Marte o de un rover.' It clearly indicates when to use the tool, though it does not explicitly mention when not to use it or list alternatives. However, the sibling tools are clearly distinct in function, so this is sufficient.

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

imagen_tierraLa Tierra desde DSCOVRA
Read-onlyIdempotent

Trae imágenes de la Tierra completa vistas desde el satélite DSCOVR (EPIC) para una fecha. Si no pasás fecha, usa las más recientes disponibles. Úsala cuando pidan ver la Tierra desde el espacio o fotos EPIC.

ParametersJSON Schema
NameRequiredDescriptionDefault
fechaNoFecha YYYY-MM-DD. Si no se pasa, usa la fecha más reciente disponible (o hoy).

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, so the safety profile is covered. The description adds valuable behavioral context: if no date is provided, it uses the most recent available images. This default behavior is not in the annotations and is useful for the agent.

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: the first states the core function and the second gives default behavior and usage context. Every word earns its place, with no redundancy or fluff.

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

Completeness5/5

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

For a tool with one optional parameter, no output schema, and strong annotations, the description is sufficient. It covers what the tool returns (images), the default date behavior, and when to choose it over siblings, leaving no critical gaps.

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 schema covers the single parameter 'fecha' fully with pattern and description, including the default behavior. The description duplicates this information without adding new semantics, so the baseline of 3 applies.

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 uses a specific verb 'Trae' (brings) and clearly identifies the resource: full images of Earth from the DSCOVR (EPIC) satellite. It also distinguishes itself from sibling tools by stating the usage context 'cuando pidan ver la Tierra desde el espacio o fotos EPIC,' which separates it from Mars photos, APOD, and asteroid tools.

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?

It provides an explicit when-to-use instruction: 'Úsala cuando pidan ver la Tierra desde el espacio o fotos EPIC.' This gives clear contextual guidance, though it does not explicitly mention when not to use it or name alternatives, so it stops short of a 5.

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. 4 tool updatesv1.0.0
    • First observedapod_por_fecha
    • First observedasteroides_cercanos
    • First observedfotos_marte
    • First observedimagen_tierra

TDQS

A4.4/5.0

Scored across 4 tools

Disambiguation5/5

Each tool targets a distinctly different NASA resource: APOD, Mars rover photos, near-Earth asteroids, and Earth imagery. There is no overlap in purpose or data source, making selection unambiguous.

Naming Consistency5/5

All tool names follow the same pattern: lowercase, underscore-separated, noun_phrase (apod_por_fecha, fotos_marte, asteroides_cercanos, imagen_tierra). Although not verb_noun, the naming is highly consistent and predictable.

Tool Count4/5

Four tools is slightly on the small side for a 'cosmos' server, but each tool covers a major astronomy data source. The count feels reasonable for a focused NASA data provider, though a few more tools could enrich the set.

Completeness4/5

The server covers four key read-only astronomy features (APOD, Mars photos, asteroids, Earth imagery). It lacks other common NASA APIs (e.g., exoplanet data, solar activity), but the included tools provide a coherent and functional surface for common space-related queries.

Maintenance

ActivityStale
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    B
    maintenance
    A Model Context Protocol server that provides a standardized interface for AI models to interact with NASA's vast array of data sources including APOD, Mars Rover photos, satellite imagery, and space weather data.
    23
    53 npm
    92
    ISC
  • A
    license
    B
    quality
    C
    maintenance
    An MCP server that enables LLMs to query data from various NASA APIs, allowing access to astronomical data, space weather information, Earth imagery, and exoplanet information directly from compatible AI clients.
    21
    6
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Multi-Agent Conversation Protocol server for accessing NASA's Astronomy Picture of the Day (APOD) API, allowing users to retrieve space imagery and related information through natural language interactions.
    -
  • A
    license
    A
    quality
    C
    maintenance
    MCP server providing AI agents with access to NASA and space/astronomy data including APOD, Mars rover photos, near-Earth asteroids, exoplanets, Earth imagery, natural events, and space weather.
    11
    MIT