• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
dthyresson

dthyresson

mcp-test

Let's make an easy MCP server using Val Town to use in Cursor
Public
Like
mcp-test
Home
Code
12
lib
server
tools
.vtignore
README.md
data.ts
deno.json
getCoordinates.ts
getNearbyPlaces.ts
H
main.ts
mcpInstance.ts
mcpServer.ts
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
7/4/2025
Viewing readonly version of main branch: v35
View latest version
README.md

Map Info MCP Server

A Model Context Protocol (MCP) server that provides basic map and location information services.

Features

  • Get Coordinates: Retrieve latitude and longitude for named locations
  • Get Nearby Places: Find points of interest near a specified location

Available Locations

Currently supports the following locations:

  • Eiffel Tower (Paris)
  • Central Park (New York)
  • Statue of Liberty (New York)

API Endpoints

MCP Endpoints

  • GET / - Health check endpoint
  • GET /mcp - MCP service status
  • GET /mcp/manifest - MCP function manifest
  • POST /mcp/execute - Execute MCP functions

Documentation Endpoints

  • GET /openapi.yaml - OpenAPI specification
  • GET /.well-known/ai-plugin.json - AI plugin manifest

MCP Functions

get_coordinates

Get the coordinates for a named location.

Parameters:

  • place (string, required): The name of the location

Example Request:

{ "name": "get_coordinates", "input": { "place": "eiffel tower" } }

Example Response:

{ "output": { "lat": 48.8584, "lng": 2.2945 } }

get_nearby_places

Return a list of nearby places of interest.

Parameters:

  • place (string, required): The place to find nearby locations from

Example Request:

{ "name": "get_nearby_places", "input": { "place": "central park" } }

Example Response:

{ "output": [ { "name": "The Met", "lat": 40.7794, "lng": -73.9632 }, { "name": "American Museum of Natural History", "lat": 40.7813, "lng": -73.9735 } ] }

Usage

This MCP server can be integrated with MCP-compatible clients to provide location-based information services.

Error Handling

  • Returns 404 for unknown locations
  • Returns 400 for invalid function names or malformed requests
  • All responses include appropriate HTTP status codes and error messages

Implementation Structure

This MCP server is organized for modularity and easy extensibility:

  • main.ts: Entry point. Exports the MCP server's fetch handler.
  • mcpInstance.ts: Instantiates the MCP server, registers all tools, and exports the fetch handler.
  • mcpServer.ts: Defines the MCPServer class and types for tool registration and routing.
  • data.ts: Contains the data for places and nearby locations.
  • getCoordinates.ts: Implements the handler for the get_coordinates tool.
  • getNearbyPlaces.ts: Implements the handler for the get_nearby_places tool.

Each tool handler is implemented in its own file for clarity and separation of concerns.

How to Add a New Tool

  1. Create the Tool Handler

    • Add a new file (e.g., myNewTool.ts).
    • Export a function that matches the handler signature:
      Create val
      export function myNewTool(args: { param1: string; }): string | Promise<string> { // Your logic here return "result"; }
  2. Register the Tool

    • In mcpInstance.ts, import your handler:
      Create val
      import { myNewTool } from "./myNewTool.ts";
    • Register the tool with the server:
      Create val
      mcpServer.registerTool({ name: "my_new_tool", description: "Describe what your tool does", inputSchema: { type: "object", properties: { param1: { type: "string", description: "Description of param1" }, }, required: ["param1"], }, handler: myNewTool, });
  3. (Optional) Add Data

    • If your tool needs new data, add it to data.ts and import as needed.
  4. Test

    • Restart the server and call your new tool via the MCP protocol.

For questions or contributions, see the code comments or open an issue.

FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.