diff --git a/LinkToolAddin.csproj b/LinkToolAddin.csproj
index d730a4a..6bd5b78 100644
--- a/LinkToolAddin.csproj
+++ b/LinkToolAddin.csproj
@@ -104,6 +104,10 @@
+
+
+
+
diff --git a/client/CallArcGISPro.cs b/client/CallArcGISPro.cs
new file mode 100644
index 0000000..a3c00e4
--- /dev/null
+++ b/client/CallArcGISPro.cs
@@ -0,0 +1,18 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using LinkToolAddin.server;
+using Newtonsoft.Json;
+
+namespace LinkToolAddin.client;
+
+public class CallArcGISPro
+{
+ public async static Task CallArcGISProTool(Dictionary parameters)
+ {
+ // Call the ArcGIS Pro method and get the result
+ var result = await server.CallArcGISPro.CallArcGISProTool(parameters["toolName"], JsonConvert.DeserializeObject>(parameters["toolParams"]));
+
+ // Serialize the result back to a JSON string
+ return JsonConvert.SerializeObject(result);
+ }
+}
\ No newline at end of file
diff --git a/client/PythonMcpClient.cs b/client/PythonMcpClient.cs
new file mode 100644
index 0000000..e25e7d8
--- /dev/null
+++ b/client/PythonMcpClient.cs
@@ -0,0 +1,6 @@
+namespace LinkToolAddin.client;
+
+public class PythonMcpClient
+{
+
+}
\ No newline at end of file
diff --git a/client/SseMcpClient.cs b/client/SseMcpClient.cs
new file mode 100644
index 0000000..471af60
--- /dev/null
+++ b/client/SseMcpClient.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using ModelContextProtocol.Client;
+using ModelContextProtocol.Protocol.Transport;
+using Newtonsoft.Json;
+
+namespace LinkToolAddin.client;
+
+public class SseMcpClient
+{
+ public static async Task testGaodeMcp()
+ {
+ Console.WriteLine("Connecting to 高德 MCP Server via SSE...");
+
+ // 创建 MCP Server 配置
+ SseClientTransportOptions options = new SseClientTransportOptions
+ {
+ Endpoint = new Uri("https://mcp.amap.com/sse?key=ed418512c94ade8f83d42c37b77d2bb2"),
+ };
+
+ IClientTransport transport = new SseClientTransport(options);;
+
+ // 创建 MCP Client
+ var client = await McpClientFactory.CreateAsync(transport);
+ Console.WriteLine("Connected to 高德 MCP Server");
+
+ try
+ {
+ // 获取可用工具列表
+ var tools = await client.ListToolsAsync();
+ Console.WriteLine("\nAvailable Tools:");
+ foreach (var tool in tools)
+ {
+ Console.WriteLine($"- {tool.Name}: {tool.Description}");
+ }
+
+ // 示例调用:获取当前定位
+ var result = await client.CallToolAsync("amap.maps_weather", new Dictionary{{"city","北京"}});
+ Console.WriteLine("\n[amap.get_location] Result:");
+ Console.WriteLine(result);
+ return JsonConvert.SerializeObject(result);
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"Error occurred: {ex.Message}");
+ }
+ finally
+ {
+ await client.DisposeAsync();
+ }
+
+ Console.WriteLine("Client closed.");
+ return "failed";
+ }
+}
\ No newline at end of file
diff --git a/common/HttpRequest.cs b/common/HttpRequest.cs
new file mode 100644
index 0000000..a38807c
--- /dev/null
+++ b/common/HttpRequest.cs
@@ -0,0 +1,21 @@
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Text;
+using System.Threading.Tasks;
+using LinkToolAddin.host.llm.entity;
+using Newtonsoft.Json;
+
+namespace LinkToolAddin.common;
+
+public class HttpRequest
+{
+ public static async Task SendPostRequestAsync(string url, string jsonContent, string apiKey)
+ {
+ using var httpClient = new HttpClient();
+ httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
+ var response = await httpClient.PostAsync(url, new StringContent(jsonContent, Encoding.UTF8, "application/json"));
+ response.EnsureSuccessStatusCode();
+ var responseBody = await response.Content.ReadAsStringAsync();
+ return responseBody;
+ }
+}
\ No newline at end of file
diff --git a/host/CallMcp.cs b/host/CallMcp.cs
new file mode 100644
index 0000000..a98488d
--- /dev/null
+++ b/host/CallMcp.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using LinkToolAddin.server;
+using log4net;
+using Newtonsoft.Json;
+
+namespace LinkToolAddin.host
+{
+ public class CallMcp
+ {
+ private static readonly ILog log = LogManager.GetLogger(typeof(CallMcp));
+ public static async Task CallInnerMcpTool(string jsonRpcString)
+ {
+ log.Info("通过反射调用内部MCP工具");
+ var jsonRpcEntity = JsonConvert.DeserializeObject(jsonRpcString);
+
+ Type type = Type.GetType("LinkToolAddin.client."+jsonRpcEntity.Method.Split('.')[0]);
+ MethodInfo method = type.GetMethod(jsonRpcEntity.Method.Split('.')[1],BindingFlags.Public | BindingFlags.Static);
+ var task = method.Invoke(null, new object[] { jsonRpcEntity.Params }) as Task;
+ JsonRpcResultEntity result = await task;
+ return JsonConvert.SerializeObject(result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/host/llm/Bailian.cs b/host/llm/Bailian.cs
new file mode 100644
index 0000000..bd444c7
--- /dev/null
+++ b/host/llm/Bailian.cs
@@ -0,0 +1,45 @@
+using System.Collections.Generic;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Text;
+using System.Threading.Tasks;
+using LinkToolAddin.common;
+using LinkToolAddin.host.llm.entity;
+using Newtonsoft.Json;
+
+namespace LinkToolAddin.host.llm;
+
+public class Bailian : Llm
+{
+ public string model { get; set; } = "qwen-max";
+ public string temperature { get; set; }
+ public string top_p { get; set; }
+ public string max_tokens { get; set; }
+ public string app_id { get; set; }
+ public string api_key { get; set; }
+ public IAsyncEnumerable SendChatStreamAsync(string message)
+ {
+ throw new System.NotImplementedException();
+ }
+
+ public IAsyncEnumerable SendApplicationStreamAsync(string message)
+ {
+ throw new System.NotImplementedException();
+ }
+
+ public async Task SendChatAsync(LlmJsonContent jsonContent)
+ {
+ string url = "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions";
+ string responseBody = await HttpRequest.SendPostRequestAsync(url, JsonConvert.SerializeObject(jsonContent), api_key);
+ LlmChat result = JsonConvert.DeserializeObject(responseBody);
+ return result.Choices[0].Message.Content;
+ }
+
+ public async Task SendApplicationAsync(CommonInput commonInput)
+ {
+ string url = $"https://dashscope.aliyuncs.com/api/v1/apps/{app_id}/completion";
+ string responseBody = await HttpRequest.SendPostRequestAsync(url, JsonConvert.SerializeObject(commonInput), api_key);
+ ApplicationOutput result = JsonConvert.DeserializeObject(responseBody);
+ return responseBody;
+ }
+}
\ No newline at end of file
diff --git a/host/llm/Llm.cs b/host/llm/Llm.cs
index 95e11c4..62a11f4 100644
--- a/host/llm/Llm.cs
+++ b/host/llm/Llm.cs
@@ -1,4 +1,6 @@
using System.Collections.Generic;
+using System.Threading.Tasks;
+using LinkToolAddin.host.llm.entity;
namespace LinkToolAddin.host.llm;
@@ -11,4 +13,6 @@ public interface Llm
public IAsyncEnumerable SendChatStreamAsync(string message);
public IAsyncEnumerable SendApplicationStreamAsync(string message);
+ public Task SendChatAsync(LlmJsonContent jsonContent);
+ public Task SendApplicationAsync(CommonInput commonInput);
}
\ No newline at end of file
diff --git a/host/llm/entity/ApplicationOutput.cs b/host/llm/entity/ApplicationOutput.cs
new file mode 100644
index 0000000..94405fa
--- /dev/null
+++ b/host/llm/entity/ApplicationOutput.cs
@@ -0,0 +1,51 @@
+namespace LinkToolAddin.host.llm.entity
+{
+ using System;
+ using System.Collections.Generic;
+
+ using System.Globalization;
+ using Newtonsoft.Json;
+ using Newtonsoft.Json.Converters;
+
+ public partial class ApplicationOutput
+ {
+ [JsonProperty("output")]
+ public Output Output { get; set; }
+
+ [JsonProperty("usage")]
+ public Usage Usage { get; set; }
+
+ [JsonProperty("request_id")]
+ public Guid RequestId { get; set; }
+ }
+
+ public partial class Output
+ {
+ [JsonProperty("finish_reason")]
+ public string FinishReason { get; set; }
+
+ [JsonProperty("session_id")]
+ public string SessionId { get; set; }
+
+ [JsonProperty("text")]
+ public string Text { get; set; }
+ }
+
+ public partial class Usage
+ {
+ [JsonProperty("models")]
+ public List Models { get; set; }
+ }
+
+ public partial class Model
+ {
+ [JsonProperty("output_tokens")]
+ public long OutputTokens { get; set; }
+
+ [JsonProperty("model_id")]
+ public string ModelId { get; set; }
+
+ [JsonProperty("input_tokens")]
+ public long InputTokens { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/host/llm/entity/CommonInput.cs b/host/llm/entity/CommonInput.cs
new file mode 100644
index 0000000..6d1da54
--- /dev/null
+++ b/host/llm/entity/CommonInput.cs
@@ -0,0 +1,31 @@
+namespace LinkToolAddin.host.llm.entity
+{
+ using System;
+ using System.Collections.Generic;
+
+ using System.Globalization;
+ using Newtonsoft.Json;
+ using Newtonsoft.Json.Converters;
+
+ public partial class CommonInput
+ {
+ [JsonProperty("input")]
+ public Input Input { get; set; }
+
+ [JsonProperty("parameters")]
+ public Debug Parameters { get; set; }
+
+ [JsonProperty("debug")]
+ public Debug Debug { get; set; }
+ }
+
+ public partial class Debug
+ {
+ }
+
+ public partial class Input
+ {
+ [JsonProperty("prompt")]
+ public string Prompt { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/host/llm/entity/KnowldgeResult.cs b/host/llm/entity/KnowldgeResult.cs
new file mode 100644
index 0000000..0937e30
--- /dev/null
+++ b/host/llm/entity/KnowldgeResult.cs
@@ -0,0 +1,42 @@
+namespace LinkToolAddin.host.llm.entity
+{
+ using System;
+ using System.Collections.Generic;
+
+ using System.Globalization;
+ using Newtonsoft.Json;
+ using Newtonsoft.Json.Converters;
+
+ public partial class KnowledgeResult
+ {
+ [JsonProperty("rewriteQuery")]
+ public string RewriteQuery { get; set; }
+
+ [JsonProperty("chunkList")]
+ public List ChunkList { get; set; }
+ }
+
+ public partial class ChunkList
+ {
+ [JsonProperty("score")]
+ public double Score { get; set; }
+
+ [JsonProperty("imagesUrl")]
+ public List