Skip to main content
Glama
SoshiHashi

Audit Findings MCP Server

by SoshiHashi

Audit Findings MCP Server

監査指摘(audit findings)を管理する SQLite データベースを、MCP(Model Context Protocol)経由で Claude から操作できるようにするサーバーです。

自然言語で「未対応の重要な指摘を見せて」と尋ねるだけで、SQL を書かずにデータベースを検索できます。

動作要件

  • Python 3.12 以上

  • uv(パッケージ管理)

  • SQLite3(macOS / Linux には標準で付属)

Related MCP server: Karenina MCP

インストール

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 はデータベースを変更するツールです。監査指摘のステータスは統制上の証跡にあたるため、意図しない更新は監査証跡の完全性を損ないます。以下の多層防御を実装しています。

  1. 入力値のホワイトリスト検証 — new_status は Open / Closed のみ許可。それ以外はデータベースに到達する前に拒否します。

  2. 更新前の存在確認 — 対象 ID が存在しない場合、明示的にエラーを返します(SQL の UPDATE は 0 件更新でもエラーにならないため)。

  3. Tool description による警告 — 実行前にユーザーの確認を取るよう、docstring に明記しています。

  4. 変更前後の記録 — 応答に変更前後のステータスを含め、何が起きたかを追跡可能にしています。

  5. 実行時の許可要求 — Claude Code は書き込みツールの実行前にユーザーへ確認を求めます。

SQL インジェクション対策

すべての SQL はプレースホルダ(?)を使用し、値を SQL 文から分離しています。文字列連結による SQL 組み立ては行っていません。

本番利用にあたって

本リポジトリは学習用のサンプル実装です。実運用に用いる場合は、少なくとも以下の検討が必要です。

  • 認証・認可(誰がどの指摘を更新できるか)

  • 変更履歴の永続的な記録(監査ログテーブル)

  • 読み取り専用モードの提供(参照用途では Resources のみ公開する)

  • データベースのバックアップとリストア手順

ファイル構成

ライセンス

学習目的のサンプル実装です。

Available Tools

3 tools
find_by_statusA

指定した状態(Open / Closed)の監査指摘を取得する

ParametersJSON Schema
NameRequiredDescriptionDefault
statusYes

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses that the operation is read-only ('取得する') and lists the allowed statuses (Open/Closed), but it does not elaborate on pagination, response format, or error behavior. For a simple read tool, this is adequate but not rich.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no redundant words. It efficiently communicates the tool's function and parameter constraints.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (one required parameter, no output schema), the description covers the essential purpose and parameter values. It does not explicitly relate to sibling tools, but it is largely sufficient for a basic retrieval tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description's explicit mention of 'Open / Closed' adds critical meaning to the status parameter. This compensates for the bare schema, though it does not explain default values or validation behavior.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves audit findings filtered by status, using the specific verb '取得する' (retrieve). It distinguishes from siblings by specifying the status filter, differentiating it from list_findings and update_finding_status.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The usage is implied: one would use this tool to get findings by status. However, the description does not explicitly mention when to use this tool over list_findings or update_finding_status, nor does it provide any exclusions or alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_findingsA

監査指摘を全件取得する

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It makes clear the operation is a read-only retrieval of all findings, which is the primary behavioral trait. However, it does not disclose additional details such as pagination, ordering, or potential performance implications of fetching all records.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, short sentence in Japanese that directly states the tool's function. It is appropriately concise for a parameterless list operation, with no filler or redundant detail.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (no parameters, no output schema), the description is sufficient: it names the resource and the action. It could be slightly more complete by hinting at what a 'finding' is or whether results are paginated, but for a simple list tool, this is adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, and the schema is empty. The baseline for 0 params is 4, and there is nothing additional the description needs to explain about parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('取得する' = retrieve) and the resource ('監査指摘' = audit findings), specifying the scope as '全件' (all). This distinguishes it from the sibling tools 'find_by_status' (filtered retrieval) and 'update_finding_status' (mutation).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The word '全件' (all) implies this tool is for retrieving the complete set of findings without filtering. However, it does not explicitly mention alternatives or state when not to use it. Usage guidance is largely implied from the sibling tool names.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

update_finding_statusA
監査指摘のステータスを更新する。

【重要】これはデータベースを変更する書き込み操作です。
実行前に必ずユーザーに確認を取ってください。
どの指摘を、どのステータスに変更するかを明示し、
ユーザーの明確な同意を得てから実行すること。

Args:
    finding_id: 更新対象の指摘ID
    new_status: 新しいステータス("Open" または "Closed" のみ)

Returns:
    成功時: 更新後の指摘情報
    失敗時: error キーを含む辞書
ParametersJSON Schema
NameRequiredDescriptionDefault
finding_idYes
new_statusYes

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description takes full responsibility. It discloses that this is a database-modifying write operation and mandates user confirmation, which are crucial behavioral traits. It also specifies return behavior for success and failure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with sections for description, args, and returns, and it is reasonably concise. It contains a slight redundancy in the warning, but overall each part serves a purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple two-parameter tool with no output schema, the description covers purpose, parameters, return values, and the necessary user-confirmation requirement. It provides enough information for an agent to decide and invoke correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must explain the parameters. It provides a clear definition for each: finding_id as the ID to update and new_status with the only allowed values 'Open' or 'Closed'. This extends meaningfully beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: updating the status of audit findings. The verb 'update' and resource 'status of audit findings' are specific, and the tool is distinguished from sibling tools (list_findings, find_by_status) by its write operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly explains when to use the tool (to change finding status) and emphasizes the critical requirement to get user confirmation before executing, which is an important guideline. It does not mention alternatives or when-not to use, but the context is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 3 tool updatesv0.1.0
    • First observedfind_by_status
    • First observedlist_findings
    • First observedupdate_finding_status

TDQS

A4/5.0

Scored across 3 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: listing all findings, filtering by status, and updating a status. There is no overlap or ambiguity between them.

Naming Consistency4/5

All tools use snake_case and follow a verb-based pattern (list, find, update). The minor inconsistency is the use of 'find' vs 'list' for read operations, but the names are still predictable and readable.

Tool Count4/5

With 3 tools, the count is within the typical well-scoped range, but it is on the lower end. Each tool serves a functional purpose, though the scope feels minimal for an audit findings domain.

Completeness2/5

The server lacks fundamental operations like creating or deleting audit findings. It only supports reading (all or by status) and updating status, leaving obvious lifecycle gaps that would force agents to work around.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables natural language querying of Karenina benchmark verification results stored in SQLite databases, allowing AI assistants to explore and analyze model performance data without writing SQL manually.
    -
  • F
    license
    A
    quality
    D
    maintenance
    Automatically scans SQLite databases and generates typed CRUD tools for each table, allowing natural language database interaction without exposing raw SQL.
    12
    -