Audit Findings MCP Server
Enables managing audit findings in a SQLite database via natural language, allowing queries and updates without writing SQL.
README
Audit Findings MCP Server
監査指摘(audit findings)を管理する SQLite データベースを、MCP(Model Context Protocol)経由で Claude から操作できるようにするサーバーです。
自然言語で「未対応の重要な指摘を見せて」と尋ねるだけで、SQL を書かずにデータベースを検索できます。
動作要件
- Python 3.12 以上
- uv(パッケージ管理)
- SQLite3(macOS / Linux には標準で付属)
インストール
git clone <このリポジトリのURL>
cd week5-mcp-sqlite
uv sync
初期セットアップ
サンプルデータベースを作成します。
sqlite3 sample.db << 'SQL'
CREATE TABLE audit_findings (
id INTEGER PRIMARY KEY,
finding_date TEXT,
severity TEXT,
category TEXT,
description TEXT,
status TEXT
);
INSERT INTO audit_findings VALUES
(1, '2025-03-15', 'High', 'Access Control', 'Privileged access not reviewed', 'Open'),
(2, '2025-04-20', 'Medium', 'Change Management', 'Insufficient testing documentation', 'Closed'),
(3, '2025-05-10', 'High', 'Data Protection', 'Encryption keys rotation overdue', 'Open');
SQL
使い方
動作確認(MCP Inspector)
npx @modelcontextprotocol/inspector uv run python server.py
ブラウザが開いたら Connect を押し、Tools / Resources / Prompts の各タブから動作を確認できます。
Claude Code から利用する
claude mcp add audit-findings -- uv run python server.py
claude mcp list
claude
Claude Code 起動後、自然言語で問い合わせます。 監査指摘のうち、未対応(Open)のものを見せて 注意: local スコープで登録した場合、サーバーはこのプロジェクトフォルダに紐づきます。必ず week5-mcp-sqlite フォルダ内で claude を起動してください。
提供機能
Tools
| 名前 | 種別 | 説明 |
|---|---|---|
| list_findings | 読み取り | 監査指摘を全件取得する |
| find_by_status | 読み取り | 指定した状態(Open / Closed)の指摘を取得する |
| update_finding_status | 書き込み | 指摘のステータスを更新する |
Resources
| URI | 説明 |
|---|---|
| audit://findings/all | 監査指摘の全件データ(JSON形式、読み取り専用) |
Prompts
| 名前 | 説明 |
|---|---|
| summarize_open_findings | 未対応指摘を集計・要約するための手順テンプレート |
セキュリティ上の注意
書き込みツールについて
update_finding_status はデータベースを変更するツールです。監査指摘のステータスは統制上の証跡にあたるため、意図しない更新は監査証跡の完全性を損ないます。以下の多層防御を実装しています。
- 入力値のホワイトリスト検証 — new_status は Open / Closed のみ許可。それ以外はデータベースに到達する前に拒否します。
- 更新前の存在確認 — 対象 ID が存在しない場合、明示的にエラーを返します(SQL の UPDATE は 0 件更新でもエラーにならないため)。
- Tool description による警告 — 実行前にユーザーの確認を取るよう、docstring に明記しています。
- 変更前後の記録 — 応答に変更前後のステータスを含め、何が起きたかを追跡可能にしています。
- 実行時の許可要求 — Claude Code は書き込みツールの実行前にユーザーへ確認を求めます。
SQL インジェクション対策
すべての SQL はプレースホルダ(?)を使用し、値を SQL 文から分離しています。文字列連結による SQL 組み立ては行っていません。
本番利用にあたって
本リポジトリは学習用のサンプル実装です。実運用に用いる場合は、少なくとも以下の検討が必要です。
- 認証・認可(誰がどの指摘を更新できるか)
- 変更履歴の永続的な記録(監査ログテーブル)
- 読み取り専用モードの提供(参照用途では Resources のみ公開する)
- データベースのバックアップとリストア手順
ファイル構成
ライセンス
学習目的のサンプル実装です。
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.