版本0.4.0(Alpha)正在积极开发中,并将在不久后发布。我们欢迎贡献并邀请开发者加入我们的项目构建。
选择最适合您需求的安装方法:
要通过Smithery自动安装GeoServer MCP服务器到Claude Desktop:
npx -y @smithery/cli install @mahdin75/geoserver-mcp --client claude
Docker安装是运行GeoServer MCP服务器最快且最隔离的方式。它适用于:
docker pull mahdin75/geoserver-mcp
docker run -d mahdin75/geoserver-mcp
如果您使用的是Claude Desktop,请编辑claude_desktop_config.json
如果您使用的是Cursor,请创建.cursor/mcp.json
{
"mcpServers": {
"geoserver-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GEOSERVER_URL=http://localhost:8080/geoserver",
"-e",
"GEOSERVER_USER=admin",
"-e",
"GEOSERVER_PASSWORD=geoserver",
"-p",
"8080:8080",
"mahdin75/geoserver-mcp"
]
}
}
}
推荐大多数用户直接在其系统上运行服务器时使用pip安装。此方法适用于:
pip install uv
Linux/Mac:
uv venv --python=3.10
Windows PowerShell:
uv venv --python=3.10
uv pip install geoserver-mcp
Linux/Mac:
export GEOSERVER_URL="http://localhost:8080/geoserver"
export GEOSERVER_USER="admin"
export GEOSERVER_PASSWORD="geoserver"
Windows PowerShell:
$env:GEOSERVER_URL="http://localhost:8080/geoserver"
$env:GEOSERVER_USER="admin"
$env:GEOSERVER_PASSWORD="geoserver"
如果您打算使用Claude桌面,则不需要这一步。对于Cursor或其他自定义客户端,应运行以下代码。
Linux:
source .venv/bin/activate
geoserver-mcp
或者
source .venv/bin/activate
geoserver-mcp --url http://localhost:8080/geoserver --user admin --password geoserver --debug
Windows PowerShell:
.\.venv\Scripts\activate
geoserver-mcp
或者
.\.venv\Scripts\activate
geoserver-mcp --url http://localhost:8080/geoserver --user admin --password geoserver --debug
如果您使用的是Claude Desktop,请编辑claude_desktop_config.json
如果您使用的是Cursor,请创建.cursor/mcp.json
Windows:
{
"mcpServers": {
"geoserver-mcp": {
"command": "C:\\path\\to\\geoserver-mcp\\.venv\\Scripts\\geoserver-mcp",
"args": [
"--url",
"http://localhost:8080/geoserver",
"--user",
"admin",
"--password",
"geoserver"
]
}
}
}
Linux:
{
"mcpServers": {
"geoserver-mcp": {
"command": "/path/to/geoserver-mcp/.venv/bin/geoserver-mcp",
"args": [
"--url",
"http://localhost:8080/geoserver",
"--user",
"admin",
"--password",
"geoserver"
]
}
}
}
开发安装旨在供对项目做出贡献的开发者和需要修改代码库的用户使用。此方法适用于:
pip install uv
uv venv --python=3.10
uv pip install -e .
Linux/Mac:
export GEOSERVER_URL="http://localhost:8080/geoserver"
export GE_ SERVER_USER="admin"
export GEOSERVER_PASSWORD="geoserver"
Windows PowerShell:
$env:GEOSERVER_URL="http://localhost:8080/geoserver"
$env:GEOSERVER_USER="admin"
$env:GEOSERVER_PASSWORD="geoserver"
如果您打算使用Claude桌面,则不需要这一步。对于Cursor或其他自定义客户端,应运行以下代码。
Linux:
source .venv/bin/activate
geoserver-mcp
或者
source .venv/bin/activate
geoserver-mcp --url http://localhost:8080/geoserver --user admin --password geoserver --debug
Windows PowerShell:
.\.venv\Scripts\activate
geoserver-mcp
或者
.\.venv\Scripts\activate
geoserver-mcp --url http://localhost:8080/geoserver --user admin --password geoserver --debug
如果您使用的是Claude Desktop,请编辑claude_desktop_config.json
如果您使用的是Cursor,请创建.cursor/mcp.json
Windows:
{
"mcpServers": {
"geoserver-mcp": {
"command": "C:\\path\\to\\geoserver-mcp\\.venv\\Scripts\\geoserver-mcp",
"args": [
"--url",
"http://localhost:8080/geoserver",
"--user",
"admin",
"--password",
"geoserver"
]
}
}
}
Linux:
{
"mcpServers": {
"geoserver-mcp": {
"command": "/path/to/geoserver-mcp/.venv/bin/geoserver-mcp",
"args": [
"--url",
"http://localhost:8080/geoserver",
"--user",
"admin",
"--password",
"geoserver"
]
}
}
}
| 工具 | 描述 |
|---|---|
list_workspaces | 获取可用的工作区 |
create_workspace | 创建新的工作区 |
get_layer_info | 获取详细的图层元数据 |
list_layers | 列出工作区中的图层 |
create_layer | 创建新的图层 |
delete_resource | 删除资源 |
| 工具 | 描述 |
|---|---|
query_features | 对矢量数据执行CQL查询 |
update_features | 修改要素属性 |
delete_features | 根据条件删除要素 |
| 工具 | 描述 |
|---|---|
generate_map | 创建带有样式的地图图像 |
create_style | 定义新的SLD样式 |
apply_style | 将现有样式应用于图层 |
如果您计划开发自己的客户端以与GeoServer MCP服务器交互,可以在examples/client.py找到一个示例客户端实现。该示例展示了:
示例客户端是一个很好的起点,用于理解协议并实现您自己的客户端应用程序。
此外,这里是一个示例用法:
工具: list_workspaces
参数: {}
响应: ["default", "demo", "topp", "tiger", "sf"]
工具: get_layer_info
参数: {
"工作区": "topp",
"图层": "states"
}
工具: query_features
参数: {
"工作区": "topp",
"图层": "states",
"过滤器": "PERSONS > 10000000",
"属性": ["STATE_NAME", "PERSONS"]
}
工具: generate_map
参数: {
"图层": ["topp:states"],
"样式": ["population"],
"边界框": [-124.73, 24.96, -66.97, 49.37],
"宽度": 800,
"高度": 600,
"格式": "png"
}
我们欢迎贡献!以下是您可以帮助的方式:
git checkout -b feature/AmazingFeature)git commit -m '添加一些AmazingFeature')git push origin feature/AmazingFeature)请确保您的PR描述清楚地描述了问题和解决方案。如果适用,请包括相关的issue编号。
本项目根据MIT许可证授权 - 查看LICENSE文件了解详情。
如有疑问,请打开一个问题