- MCP Server TypeScript Starter
MCP Server TypeScript Starter
Content
MCP Server TypeScript Starter
This is a Model Context Protocol (MCP) server implementation that provides location services. It demonstrates how to build an MCP server using TypeScript with real-world functionality for location lookups via coordinates or IP addresses.
Features
- TypeScript configuration
- Complete MCP server setup
- Location service implementation
- Coordinate-based location lookup
- IP-based location lookup (using IPInfo.io)
- Health check endpoint
- Type-safe development environment
- Integration with external APIs
Installation
npm install mylocation-mcp
Usage
- Create a
.envfile with your IPInfo.io API token:
IPINFO_TOKEN=your_ipinfo_token_here
- Import and use in your code:
import { McpServer } from 'mylocation-mcp';
Development
If you want to modify or contribute to the package:
# Clone the repository
git clone https://github.com/yhwancha/mylocation-mcp.git
cd mylocation-mcp
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
# Edit .env and add your IPInfo.io API token
# Build the project
npm run build
Project Structure
.
├── src/
│ └── index.ts # Main server implementation with location tools
├── build/ # Compiled JavaScript files
├── package.json # Project dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── .env.example # Environment variables template
└── README.md # Documentation
Implemented Tools
1. get-location-by-coordinates
server.tool(
"get-location-by-coordinates",
"Get location information from provided coordinates",
{
latitude: z.string().describe("Latitude coordinate (-90 to 90)"),
longitude: z.string().describe("Longitude coordinate (-180 to 180)")
},
async ({ latitude, longitude }) => {
// Implementation details...
}
);
2. get-location-by-ip
server.tool(
"get-location-by-ip",
"Get location information from IP address",
{
ipAddress: z.string().describe("IP address to lookup")
},
async ({ ipAddress }) => {
// Implementation details...
}
);
3. health
server.tool(
"health",
"Check the health status of the service",
{},
async () => {
// Implementation details...
}
);
MCP Server Configuration
To use this MCP server in your project, add the following configuration:
{
"mcpServers": {
"location-service": {
"command": "npx",
"args": [
"-y",
"mylocation-mcp-server"
],
"env": {
"IPINFO_TOKEN": <IPINFO_TOKEN>
}
}
}
}
Response Format
All tools return responses in this format:
{
"content": [
{
"type": "text",
"text": "JSON string containing the response data"
}
]
}
The response data follows this structure:
{
"status": "success|error",
"source": "user_provided|ip_based",
"data": {
// Location data when successful
},
"error": "Error message when failed"
}
Dependencies
@modelcontextprotocol/sdk: MCP server implementationzod: Schema validationaxios: HTTP client for IPInfo APIdotenv: Environment variable management- TypeScript development tools
License
MIT
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
WindsurfThe new purpose-built IDE to harness magic
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Serper MCP ServerA Serper MCP Server
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
CursorThe AI Code Editor
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Tavily Mcp
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题;
Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Playwright McpPlaywright MCP server
ChatWiseThe second fastest AI chatbot™
Amap Maps高德地图官方 MCP Server
DeepChatYour AI Partner on Desktop