Cover image
Try Now
2025-04-03

提供位置服务的模型上下文协议(MCP)服务器

3 years

Works with Finder

1

Github Watches

0

Github Forks

0

Github Stars

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

  1. Create a .env file with your IPInfo.io API token:
IPINFO_TOKEN=your_ipinfo_token_here
  1. 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 implementation
  • zod: Schema validation
  • axios: HTTP client for IPInfo API
  • dotenv: Environment variable management
  • TypeScript development tools

License

MIT

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • rahulc0dy
  • 测试您的MCP服务器。

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • 1Panel-dev
  • 🔥1Panel提供了直观的Web接口和MCP服务器,用于在Linux服务器上管理网站,文件,容器,数据库和LLMS。

    Reviews

    3 (1)
    Avatar
    user_2dq4NIMw
    2025-04-16

    I recently started using mylocation-mcp by yhwancha and it's truly impressive! The application's functionality of managing and tracking locations is efficient and user-friendly. The interface is clean and intuitive, making it easy for anyone to navigate. I highly recommend this tool for anyone in need of a reliable location management solution. Great work!