谷歌地图MCP服务器

一个基于模型上下文协议(MCP)的FastMCP服务器,提供谷歌地图信息的工具接口。

  • by jonmmease
  • Python
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 jonmmease/jons-mcp-google-maps

使用说明

Jon的谷歌地图MCP服务器

用于谷歌地图信息的MCP服务器

通过模型上下文协议(MCP)公开工具的FastMCP服务器。

需求

  • Python 3.10+

安装

# Clone the repository
git clone <your-repo-url>
cd jons-mcp-google-maps

# Install with uv
uv pip install -e .

运行服务器

uv run jons-mcp-google-maps

添加到克劳德代码

# Register the MCP server with Claude Code
claude mcp add jons-mcp-google-maps -- uv run --project /path/to/jons-mcp-google-maps jons-mcp-google-maps

可用工具

工具 说明
hello_world 返回友好的问候语(示例工具)

发展

设置

# Install with dev dependencies
uv pip install -e ".[dev]"

运行测试

# Run all tests
uv run pytest

# Run with coverage
uv run pytest --cov=src

# Run a specific test
uv run pytest tests/test_example.py::test_hello_world_default

代码质量

# Type check
uv run mypy src/jons_mcp_google_maps

# Format code
uv run black src tests

# Lint code
uv run ruff check src tests

项目结构

jons-mcp-google-maps/
├── src/
│   ├── __init__.py
│   └── jons_mcp_google_maps/
│       ├── __init__.py          # Package exports
│       ├── constants.py         # Configuration constants
│       ├── exceptions.py        # Custom exceptions
│       ├── utils.py             # Utility functions
│       ├── server.py            # FastMCP server setup
│       └── tools/
│           ├── __init__.py      # Tool exports
│           └── example.py       # Example tool
├── tests/
│   ├── conftest.py              # Test fixtures
│   └── test_example.py          # Example tests
├── pyproject.toml               # Project configuration
├── CLAUDE.md                    # AI assistant guidance
└── README.md                    # This file

添加新工具

  1. 在中创建新文件 src/jons_mcp_google_maps/tools/ 或添加到现有文件
  2. 编写一个带有类型提示和docstring的异步函数:
    async def my_tool(param: str) -> str:
        """Brief description for the MCP tool listing.
    
        Args:
            param: What this parameter does.
    
        Returns:
            What the tool returns.
        """
        return f"Result: {param}"
    
  3. 出口自 src/jons_mcp_google_maps/tools/__init__.py
  4. 注册 server.py 和 mcp.tool(my_tool)

许可证

麻省理工学院