How to Use the NASA APOD — Astronomy Picture of the Day MCP in LangChain
Connect LangChain to the NASA APOD server and build agents that reason across 30 years of astronomy, one tool call at a time.
Works with every AI agent you already use
…and any MCP-compatible client
Connect NASA APOD — Astronomy Picture of the Day MCP to LangChain
Create your Vinkius account to connect NASA APOD — Astronomy Picture of the Day to LangChain and route execution through our secure gateway. The platform manages server hosting, runtime updates, and security layers. Configuration requires no manual server provisioning.
Chain APOD Tools for Complex Answers
Give your LangChain agent a goal, not just a command. It can use `get_random_apod` to find an interesting celestial event, extract the date from the result, and then feed that date into `get_apod_range` to pull all the imagery for that entire month. This isn't a script; it's your agent figuring out the next logical step. This is what composable chains are all about. The output of one tool call becomes the input for the next. With LangSmith, you can watch the whole process unfold, tracing every call to the NASA APOD tools, seeing the inputs, outputs, and latency for each link in the reasoning chain.
Build Autonomous Researchers with LangChain
You don't have to tell your agent exactly what to do. Just provide the NASA APOD tools from this MCP Server and a research question, like "Find images of nebulae from the early 2000s." The agent will then use the available tools to form a plan and execute it. It might start with a few calls to `get_random_apod` to see what kind of data it gets back, then switch to `get_apod_range` to systematically search through the archive. You're building a system that decides for itself how to best answer a question using the tools at hand.
Combine APOD with Other Data
Pulling data from the NASA APOD archive is just the start. Your LangChain agent can combine that information with any other source. For example, it could fetch today's image with `get_apod` and then cross-reference the astronomer's explanation with data from a completely different API or a local database. LangChain has hundreds of integrations, so you can build powerful, multi-source chains. The `MultiServerMCPClient` even lets you aggregate tools from several MCP servers, giving your agent a broad set of capabilities to work with in a single, coherent application.
Set up NASA APOD — Astronomy Picture of the Day MCP in LangChain
Prerequisites
- Python 3.10+ installed
-
langchain-mcp-adapters+langgraphpackages - Active Vinkius subscription with a valid endpoint token
- 1
Install dependencies
Run
pip install langchain-mcp-adapters langgraph langchain-openai. The MCP adapters package converts MCP tools into native LangChainBaseToolobjects. - 2
Connect via HTTP transport
Use
MultiServerMCPClientwith"transport": "http"pointing to your Vinkius endpoint. Replace[YOUR_TOKEN_HERE]with your token from cloud.vinkius.com. - 3
Create a ReAct agent
Pass the discovered tools to
create_react_agent()from LangGraph. The agent automatically routes NASA APOD — Astronomy Picture of the Day tool calls through the MCP protocol. - 4
Run with any LLM
Swap
ChatOpenAIforChatAnthropic,ChatGoogleGenerativeAI, or any LangChain-compatible model. The MCP tools work identically across all providers.
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI
async with MultiServerMCPClient({
"nasa-apod-astronomy-picture-of-the-day-mcp": {
"transport": "http",
"url": "https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp",
}
}) as client:
tools = client.get_tools()
agent = create_react_agent(
ChatOpenAI(model="gpt-4o"),
tools,
)
result = await agent.ainvoke({
"messages": "List recent NASA APOD — Astronomy Picture of the Day transactions"
})
print(result["messages"][-1].content) Independent Platform Disclaimer: Vinkius is an independent platform and is not affiliated with, endorsed by, sponsored by, verified by, or otherwise authorized by NASA. All third-party trademarks, logos, and brand names are the property of their respective owners. Their use on this website is strictly for informational purposes to identify service compatibility and interoperability.
Why Choose Vinkius
Vinkius connects your tools to AI with real-time monitoring and automatic cost savings — all from one dashboard.
Real-time monitoring
Live
visibility into every interaction
Connect your favorite tools to your AI and see exactly what's happening — every request, every response, in real time.
Built-in savings
60%
lower AI costs
Vinkius compresses data between your apps and your AI automatically. Lower bills every month — no configuration required.
Single dashboard
One
place for every integration
Every tool your AI connects to, managed from a single screen. One account, complete control.
Common questions about NASA APOD — Astronomy Picture of the Day MCP in LangChain
Use it with your favorite AI tools
Connect this server to Cursor, Claude, VS Code, and more.
Start using the NASA APOD — Astronomy Picture of the Day MCP today
We host it, we monitor it, we maintain it. You just paste one token.