MCP Tool Poisoning Attacks
A Node.js project demonstrating MCP client and server interactions for tool poisoning attacks, requiring an Anthropic API key.
MCP_TOOL_POISONING_ATTACKS
INDEX
ABOUT
MCP Client and MCP Server
ENVIRONMENT
- node.js v22
- mcp sdk
claude-3-5-haiku-20241022
[!NOTE] ./servers/ipinfo/は現在
npxを使ってMCP Clientから使用する形を取っている。 npxを使ってGitHubのリポジトリからinstallするにはpackage.jsonをリポジトリトップに配置する必要があるため,npx使用のための./package.jsonをリポジトリトップに配置している。
PREPARING
For Dev Container
- install VSCode, Docker
- install VSCode Extensions Dev ContainerS
- On the VSCode,
Ctrl shift pand runDev Containers: Rebuild Containers - create
.envand addANTHROPIC_API_KEY
cat << EOF > mcp_client/.env
ANTHROPIC_API_KEY=your_anthropic_api_key
EOF
- create
mcp_client/mcpservers.json
Docker
- create
.envand addANTHROPIC_API_KEY
cat << EOF > mcp_client/.env
ANTHROPIC_API_KEY=your_anthropic_api_key
EOF
- create
mcp_client/mcpservers.json - build docker image
docker compose build
HOW TO USE
Running in Dev Containers
cd mcp_client
yarn run bundle
node dist/index.js
Running to docker run
docker compose run -it mcp_client
EXAMPLE
example of mcp_client/mcpservers.json
{
"mcpServers": {
"ipinfo": {
"command": "/usr/local/bin/npx",
"args": [
"-y",
"github:RyosukeDTomita/mcp_tool_poisoning_attacks#main",
"ipinfo"
],
"env": {
"PATH": "/usr/local/bin:/usr/bin:/bin"
}
},
"burp": {
"url": "http://localhost:9876/sse"
}
}
}
[!NOTE] 現状は
mcpservers.jsonの中にある一番上のサーバを使用するようになっている。
docker compose run -it mcp_client
Tools:
[
{
name: 'ipinfo',
description: 'Get My IP information',
input_schema: {
type: 'object',
properties: {},
additionalProperties: false,
'$schema': 'http://json-schema.org/draft-07/schema#'
}
},
{
name: 'ipinfo_target_ipjson',
description: 'Get Target IP information from user request parameter',
input_schema: {
type: 'object',
properties: [Object],
additionalProperties: false,
'$schema': 'http://json-schema.org/draft-07/schema#'
}
}
]
Enter your message: 8.8.8.8の情報を教えて
=====Request to Anthoropic API=====
[ { role: 'user', content: '8.8.8.8の情報を教えて' } ]
=====Response from Anthropic API=====:
{
id: 'msg_012ZGLAfhWKmgDroHELiq6F6',
type: 'message',
role: 'assistant',
model: 'claude-3-5-haiku-20241022',
content: [
{
type: 'text',
text: '8.8.8.8の情報を調べるために、ipinfo_target_ipjsonツールを使用します。'
},
{
type: 'tool_use',
id: 'toolu_01EecHroNi48aFhzTaW5V5NW',
name: 'ipinfo_target_ipjson',
input: [Object]
}
],
stop_reason: 'tool_use',
stop_sequence: null,
usage: {
input_tokens: 432,
cache_creation_input_tokens: 0,
cache_read_input_tokens: 0,
output_tokens: 97
}
}
8.8.8.8の情報を調べるために、ipinfo_target_ipjsonツールを使用します。
=====MCP Server Tool result=====
: {
content: [
{
type: 'text',
text: '{"ip":"8.8.8.8","hostname":"dns.google","city":"Mountain View","region":"California","country":"US","loc":"38.0088,-122.1175","org":"AS15169 Google LLC","postal":"94043","timezone":"America/Los_Angeles","readme":"https://ipinfo.io/missingauth","anycast":true}'
}
]
}
=====Response from Anthropic API after tool use=====
この情報は、IPアドレス8.8.8.8の詳細を示しています。主な特徴は以下の通りです:
1. IP: 8.8.8.8
2. ホスト名: dns.google
3. 所在地:
- 都市: Mountain View
- 地域: カリフォルニア
- 国: アメリカ合衆国(US)
4. 地理的座標: 北緯38.0088、西経-122.1175
5. 組織: AS15169 Google LLC
6. 郵便番号: 94043
7. タイムゾーン: アメリカ/ロサンゼルス
8. エニーキャスト: はい(true)
この8.8.8.8は、Googleが提供する公開DNSサーバーの1つで、一般的に多くのユーザーが利用している信頼性の高いDNSサービスです。
References
Related Servers
Scout Monitoring MCP
sponsorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
sponsorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
Terraform MCP Server by Binadox
MCP server for Terraform — automatically validates, secures, and estimates cloud costs for Terraform configurations. Developed by Binadox, it integrates with any Model Context Protocol (MCP) client (e.g. Claude Desktop or other MCP-compatible AI assistants).
Mezmo MCP
Mezmo's remote MCP server connects AI assistants to Mezmo's Observability platform so you can run advanced root-cause analysis, discover pipelines, and export logs without hosting anything yourself.
POC MCP HTTP Server
A proof-of-concept server implementing the Model Context Protocol with a streamable HTTP transport.
Code Assistant
A Rust-based CLI tool for code-related tasks, operating as an MCP server.
BloodHound-MCP
integration that connects BloodHound with AI through MCP, allowing security professionals to analyze Active Directory attack paths using natural language queries instead of Cypher.
Flowise
Integrate with the Flowise API to create predictions and manage chatflows and assistants.
SD Elements MCP Server
Provides SD Elements API integration for security and compliance management.
MCP Server Automation CLI
A CLI tool to automate packaging MCP servers as Docker images and deploying them to AWS ECS.
Futarchy MCP
Interact with the Futarchy protocol on the Solana blockchain.
Simple Loki MCP Server
An MCP server for querying Loki logs via logcli.
