Mirror of https://github.com/Fujitsu-AI/MCP-Server-for-MAS-Developments
This MCP server provides a privateGPT-based agent that integrates with MCP clients to offer secure, authenticated chat and RAG (Retrieval-Augmented Ge...
349 elif name == "write_query":
350 if arguments["query"].strip().upper().startswith("SELECT"):
351 raise ValueError("SELECT queries are not allowed for write_query")
352 results = db._execute_query(arguments["query"])
353 return [types.TextContent(type="text", text=str(results))]// Exploitable if an attacker can influence the LLM's tool selection, e.g., via prompt injection or if the LLM is compromised.
355 elif name == "create_table":
356 if not arguments["query"].strip().upper().startswith("CREATE TABLE"):
357 raise ValueError("Only CREATE TABLE statements are allowed")
358 db._execute_query(arguments["query"])
359 return [types.TextContent(type="text", text="Table created successfully")]// Exploitable if an attacker can influence the LLM's tool selection, e.g., via prompt injection or if the LLM is compromised.
482 case "write_file": {
483 const parsed = WriteFileArgsSchema.safeParse(args);
484 if (!parsed.success) {
485 throw new Error(`Invalid arguments for write_file: ${parsed.error}`);
486 }
487 const validPath = await validatePath(parsed.data.path);
488 await fs.writeFile(validPath, parsed.data.content, "utf-8");
489 return {
490 content: [{ type: "text", text: `Successfully wrote to ${parsed.data.path}` }],
491 };
492 }// Exploitable if an attacker can influence the LLM's tool selection, e.g., via prompt injection or if the LLM is compromised.
448 case "read_file": {
449 const parsed = ReadFileArgsSchema.safeParse(args);
450 if (!parsed.success) {
451 throw new Error(`Invalid arguments for read_file: ${parsed.error}`);
452 }
453 const validPath = await validatePath(parsed.data.path);
454 const content = await fs.readFile(validPath, "utf-8");
455 return {
456 content: [{ type: "text", text: content }],
457 };
458 }// Exploitable if an attacker can influence the LLM's tool selection, e.g., via prompt injection or if the LLM is compromised.
133 get_local_storage = """
134 function() {
135 globalThis.setStorage = (key, value)=>{
136 localStorage.setItem(key, JSON.stringify(value))
137 }
138 globalThis.getStorage = (key, value)=>{
139 return JSON.parse(localStorage.getItem(key))
140 }
141 const username_input = getStorage('login')
142 const password_input = getStorage('password')
143 return [username_input, password_input];
144 }
145 """// Exploitable if the web application is vulnerable to XSS or if an attacker has access to the client machine.
320 elif name == "describe_table":
321 if not arguments or "table_name" not in arguments:
322 raise ValueError("Missing table_name argument")
323 results = db._execute_query(
324 f"PRAGMA table_info({arguments['table_name']})"
325 )// Exploitable if an attacker can influence the LLM's tool arguments, e.g., via prompt injection or if the LLM is compromised.
334server.setRequestHandler(ListToolsRequestSchema, async () => {
335 return {
336 tools: [
337 {
338 name: "read_file",
339 ...
340 },
341 {
342 name: "write_file",
343 ...
344 },
345 ...
346 ],
347 };
348});// Exploitable if an attacker can influence the LLM's tool selection, e.g., via prompt injection or if the LLM is compromised.
239 @server.list_tools()
240 async def handle_list_tools() -> list[types.Tool]:
241 """List available tools"""
242 return [
243 types.Tool(
244 name="read_query",
245 ...
246 ),
247 types.Tool(
248 name="write_query",
249 ...
250 ),
251 types.Tool(
252 name="create_table",
253 ...
254 ),
255 ...
256 ]// Exploitable if an attacker can influence the LLM's tool selection, e.g., via prompt injection or if the LLM is compromised.
41 vllm_url = config.get("vllm_url", "")
42 vllm_api_key = config.get("vllm_api_key", "")// Exploitable if an attacker gains access to the server's filesystem or network traffic.
200 client = OpenAI(
201 base_url=vllm_url,
202 api_key=vllm_api_key,
203 http_client=httpx.Client(verify=False)
204 )// Exploitable if an attacker can perform a man-in-the-middle attack on the network between the client and the vLLM server.