Skip to content

Latest commit

 

History

History

mcp-example

Weather MCP Demo with Encore

This is a simple Model Context Protocol (MCP) demo focused on weather functionality using Encore. The code is extremely typed, well-documented with JSDocs, follows SOLID principles, and incorporates Test-Driven Development (TDD).

Features

  • Weather service that provides current weather information for cities
  • MCP server implementation using the Model Context Protocol SDK
  • Type-safe API with Zod schema validation
  • Comprehensive test suite using Vitest

Install Encore

  • macOS: brew install encoredev/tap/encore
  • Linux: curl -L https://encore.dev/install.sh | bash
  • Windows: iwr https://encore.dev/install.ps1 | iex

Create app

Create a local app from this template:

encore app create --example=ts/mcp-example

## Running locally
```bash
encore run

While encore run is running, open http://localhost:9400/ to view Encore's local developer dashboard.

Testing

Running the test suite

encore test

Testing the MCP functionality

# Run the MCP client test script
./scripts/run-mcp-test.sh

MCP Tools

This demo implements the following MCP tools:

  • get-weather: Get the current weather for a specified city

Deployment

Deploy your application to a staging environment in Encore's free development cloud:

git add -A .
git commit -m 'Commit message'
git push encore

Then head over to the Cloud Dashboard to monitor your deployment and find your production URL.

From there you can also connect your own AWS or GCP account to use for deployment.

Resources

author: @leofmarciano