mcp-foundry
An MCP server providing AI-powered weather tools via Google Generative AI, enabling real-time weather data retrieval through natural language queries.
README
š¤ļø mcp-foundry
An MCP (Model Context Protocol) server providing AI-powered weather tools via Google Generative AI.
Table of Contents
- Overview
- Features
- Tech Stack
- Project Structure
- Prerequisites
- Installation
- Configuration
- Usage / Quick Start
- Scripts
- Contributing
- License
Overview
mcp-foundry is a monorepo implementing the Model Context Protocol (MCP) architecture with a weather service backend. It consists of an MCP server that provides weather tools and an AI agent host that uses Google Generative AI (Gemini) to intelligently invoke those tools. The system demonstrates how LLMs can orchestrate tool calls through the MCP standard for structured, reliable tool integration.
Features
- š¦ļø Real-time weather data via OpenWeather API
- š¤ AI-powered tool orchestration with Gemini
- š” Model Context Protocol (MCP) implementation
- š Stdio-based server transport for inter-process communication
- šÆ Type-safe tool definitions with Zod schema validation
- š¦ Monorepo structure with separate server and host applications
Tech Stack
| Technology | Purpose | Version |
|---|---|---|
| TypeScript | Language | ^6.0.3 |
| Node.js | Runtime | >=18.0.0 |
@modelcontextprotocol/sdk |
MCP server/client implementation | ^1.29.0 |
@google/genai |
Google Generative AI SDK | ^2.2.0 |
dotenv |
Environment variable management | ^17.4.2 |
zod |
Runtime schema validation | ^3.25.76 |
Project Structure
mcp-foundry/
āāā apps/
ā āāā mcp-server/ # MCP server providing weather tools
ā ā āāā src/
ā ā ā āāā index.ts # Weather tool definitions and MCP server setup
ā ā āāā build/ # Compiled JavaScript
ā ā āāā tsconfig.json
ā ā
ā āāā mcp-host/ # AI agent host orchestrating tool calls
ā āāā src/
ā ā āāā agent.ts # Gemini AI agent loop
ā ā āāā client.ts # MCP client connecting to server
ā ā āāā mcp-client/ # Client transport layer
ā āāā build/ # Compiled JavaScript
ā āāā tsconfig.json
ā
āāā package.json # Workspace dependencies and scripts
āāā tsconfig.base.json # Base TypeScript configuration
āāā .env # Environment variables (local)
āāā .github/
ā āāā copilot-instructions.md # Copilot README generation rules
āāā README.md # This file
Prerequisites
- Node.js >=18.0.0
- npm >=9.0.0
- OpenWeather API Key
- Google Generative AI API Key
Installation
- Clone the repository:
git clone <repository-url>
cd mcp-foundry
- Install dependencies:
npm install
- Build the projects:
npm run build
Expected output:
# output
# compiles apps/mcp-server/src/**/*.ts ā apps/mcp-server/build/
# compiles apps/mcp-host/src/**/*.ts ā apps/mcp-host/build/
Configuration
Create a .env file in the repository root with the following variables:
| Variable | Description | Required | Example |
|---|---|---|---|
OPEN_WEATHER_API |
OpenWeather API key for weather data | ā | abc123def456 |
GEMINI_API_KEY |
Google Generative AI API key | ā | AIzaXxxx... |
.env example:
OPEN_WEATHER_API=your_openweather_api_key_here
GEMINI_API_KEY=your_gemini_api_key_here
ā ļø Never commit
.envto version control. Add it to.gitignore.
Usage / Quick Start
- Build the projects:
npm run build
- Start the agent:
npm start
- Invoke the agent with a natural language query:
node apps/mcp-host/build/agent.js "What's the weather in New York?"
Expected output:
# output
Connected to MCP server
[Gemini response with weather information for New York]
Scripts
| Script | Command | Description |
|---|---|---|
build |
npm run build:server && npm run build:host |
Compile both MCP server and host |
build:server |
tsc -p apps/mcp-server |
Compile MCP server TypeScript to JavaScript |
build:host |
tsc -p apps/mcp-host |
Compile agent host TypeScript to JavaScript |
start |
node apps/mcp-host/build/agent.js |
Run the AI agent |
dev |
npm run build && npm start |
Build and run in one command |
Contributing
Contributions are welcome! This project is open to community input and improvements.
Getting Started:
- Fork the repository
- Create a feature branch:
git checkout -b feat/your-feature(orfix/,docs/,chore/as needed) - Make your changes and commit:
git commit -m "description of changes" - Push to your fork:
git push origin your-branch-name - Open a pull request with a description of your changes
Guidelines (non-strict):
- Keep commits logically organized and descriptive
- Add tests if you're adding new functionality
- Update documentation if your changes affect the API or usage
- Be respectful and collaborative in discussions
All contribution levels are welcome ā from typo fixes to new features!
License
Distributed under the MIT License. See LICENSE for more information.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.