LinkToolAddin/host/McpServerList.cs

119 lines
3.4 KiB
C#

using System.Collections.Generic;
using LinkToolAddin.host.mcp;
namespace LinkToolAddin.host;
public class McpServerList
{
private Dictionary<string,McpServer> servers = new Dictionary<string, McpServer>();
public McpServerList()
{
servers.Add("gaode",new SseMcpServer
{
Name = "gaode",
Type = "sse",
Description = "高德地图API",
IsActive = true,
BaseUrl = "https://mcp.amap.com/sse?key=ed418512c94ade8f83d42c37b77d2bb2",
Headers = new Dictionary<string, string>()
{
{"Content-Type","application/json"}
}
});
servers.Add("ArcGisPro", new InnerMcpServer
{
Name = "ArcGisPro",
Type = "inner",
Description = "可以调用arcgis的地理处理工具或执行python代码等",
IsActive = true
});
servers.Add("KnowledgeBase", new InnerMcpServer
{
Name = "KnowledgeBase",
Type = "inner",
Description = "可以调用进行查询知识库,获取相关参考信息。" ,
// "有地理信息的相关案例步骤参考以及Arcgis Pro的工具详细信息",
IsActive = true
});
servers.Add("filesystem", new StdioMcpServer()
{
Name = "filesystem",
Type = "stdio",
Command = "npx",
Args = new List<string>()
{
"-y",
"@modelcontextprotocol/server-filesystem",
"F:\\secondsemester\\linktool\\test\\LinkTool0607\\LinkTool0607.gdb"
}
});
servers.Add("fetch", new StdioMcpServer()
{
Name = "fetch",
Type = "stdio",
Command = "uvx",
Args = new List<string>()
{
"mcp-server-fetch"
}
});
servers.Add("bing-search", new StdioMcpServer()
{
Name = "bing-search",
Type = "stdio",
Command = "npx",
Args = new List<string>()
{
"bing-cn-mcp"
}
});
servers.Add("mcp-python-interpreter", new StdioMcpServer()
{
Name = "mcp-python-interpreter",
Type = "stdio",
Command = "uvx",
Args = new List<string>()
{
"--native-tls",
"mcp-python-interpreter",
"--dir",
"F:\\secondsemester\\linktool\\test\\LinkTool0607\\LinkTool0607.gdb",
"--python-path",
"C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\custom\\python.exe"
}
});
}
public McpServer GetServer(string name)
{
if (servers.ContainsKey(name))
{
return servers[name];
}
else
{
return null;
}
}
public List<McpServer> GetAllServers()
{
List<McpServer> serverList = new List<McpServer>();
foreach (var server in servers)
{
serverList.Add(server.Value);
}
return serverList;
}
public List<string> GetAllServerNames()
{
List<string> serverList = new List<string>();
foreach (var server in servers)
{
serverList.Add(server.Key);
}
return serverList;
}
}