This MCP server provides a feature-rich tool for querying NASA data, supporting various NASA API services and natural language queries for astronomical information, Mars rover photos, Earth satellite imagery, near-Earth objects data, and space weather information.
Open Cursor IDE and type the following command in the command palette:
/mcp install @cursor/nasa-mcp
NASA_API_KEY
environment variable or pass it as a parameter when using the serviceYou can make natural language queries directly in Cursor:
# Get today's astronomy picture
今天的天文图
# Get Mars rover photos
火星 好奇号 2024年3月18日
# Get Earth satellite imagery
地球 39.9042,116.4074
# Get near-Earth object data
近地小行星 2024年3月18日
# Get space weather information
太空天气 今天
Integrate with your Node.js applications:
const client = require('@smithery/client');
async function main() {
// Get Mars photos
const marsPhotos = await client.call('@cursor/nasa-mcp', '火星 好奇号 今天');
// Get near-Earth object data
const neoData = await client.call('@cursor/nasa-mcp', '近地小行星 今天');
console.log(marsPhotos);
console.log(neoData);
}
main();
Use environment variables or direct parameters:
# Using API key from environment variable
echo "火星 好奇号 今天" | NASA_API_KEY=your_api_key node nasa-mcp.js
# Using custom API key
echo "地球 39.9042,116.4074" | node nasa-mcp.js --api_key=your-api-key
{
"标题": "图片标题",
"日期": "2024-03-19",
"说明": "详细解释",
"图片链接": "图片URL",
"媒体类型": "image",
"版权": "版权信息"
}
{
"火星车": "curiosity",
"日期": "2024-03-19",
"照片数量": 5,
"照片列表": [
{
"id": 1234567,
"拍摄时间": "2024-03-19",
"相机": "NAVCAM",
"图片链接": "https://..."
}
]
}
{
"日期": "2024-03-19",
"小行星数量": 5,
"小行星列表": [
{
"名称": "小行星名称",
"直径": {
"最小": 100,
"最大": 200
},
"是否危险": "否",
"最近距离": "1000000 公里",
"相对速度": "50000 公里/小时"
}
]
}
{
"日期": "2024-03-19",
"太阳耀斑": [
{
"开始时间": "2024-03-19T10:00:00Z",
"结束时间": "2024-03-19T11:00:00Z",
"等级": "M2.5",
"位置": "N30W60"
}
],
"日冕物质抛射": [
{
"时间": "2024-03-19T12:00:00Z",
"速度": "800 km/s",
"类型": "CME"
}
]
}
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "nasa-mcp" '{"command":"npx","args":["-y","@cursor/nasa-mcp"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"nasa-mcp": {
"command": "npx",
"args": [
"-y",
"@cursor/nasa-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"nasa-mcp": {
"command": "npx",
"args": [
"-y",
"@cursor/nasa-mcp"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect