Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

A 75-line Python server built on FastMCP can scan text for a few fixed PII and prompt-injection patterns and return a block, review, or no-match result with a masked preview, all before your application sends anything to a model. That is a useful preflight check for an application. It is not a PII detector, and a clean result does not mean the text is safe. The decision to stop a send belongs to the host application, which has to require the scan and enforce its result.

What the 75-line server actually checks

The walkthrough, published on DEV Community on September 29, 2026 by AI Dev Hub, builds a small server with FastMCP imported from mcp.server.fastmcp. It takes an input string and runs it against three hard-coded patterns. Each pattern carries its own action, and that action is what drives the gate.

The three rules

Rule What it matches Action when it fires What it does not establish
Email An email-shaped string review The regex is deliberately incomplete and can match strings that are not real mailboxes.
US SSN A number in the US Social Security Number shape review It recognizes the format only. It does not tell you whether the number was ever issued.
Instruction override A set of phrases associated with overriding prior instructions block It is a phrase match. Different wording can evade it.

Because the rules are fixed and few, the server’s coverage is exactly what the table shows. Anything outside those shapes is invisible to it, including names, street addresses, account numbers in other formats, and most non-English phrasing of an override attempt.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What the server returns

Each call returns a structured result that the host can act on without reading the raw text again:

#1 Best Overall
SightPro Magnetic Laptop Privacy Screen 14 Inch 16:10 - Patented Removable Laptop Privacy Filter Shield and Protector
  • 【Instant Snap-on Magnetic Attachment】- The Patented Magnetic Privacy Screen – Protected by U.S. Patents 9,829,669 and D844,012. Simply place the privacy screen along the top of your MacBook and let the magnets attach along the top. No need for tricky placement, messy tape, or damaging adhesive. Easily remove and reattach when you need it.
  • 【Filter Dimensions】: Width: 11 15/16" (304 mm), Height: 7 1/2" (190 mm), Diagonal: 14.1" (358.14 mm) - SightPro Blackout Privacy Filter is engineered to be compatible with Lenovo, HP, Dell, Acer, Asus, Samsung, and other laptop brands. Please verify your screen's width and height measurements before ordering. It's not recommended to make your selection based solely on your screen's diagonal size. [Not optimized for touchscreens.]
  • 【Superior Privacy】- Our advanced multi-layered film filter blacks out your screen when viewing from the side, while maintaining a crystal clear screen straight-on. It also protects your eyes from harmful UV and blue light. [Note: It does not block visibility directly behind you, regardless of the distance.]
  • 【Perfect for Travel and Open Workspaces】- The Laptop Privacy Screen Filter is the ideal solution for healthcare providers, mobile workers, commuters, students, and business travelers. Now you can stay compliant and safeguard sensitive corporate information while working in airplanes, subways, airports, and public areas.
  • 【Package Contents】- Each package includes a magnetic privacy screen filter, magnetic stickers, a webcam privacy cover, a storage folder, and a cleaning cloth. Buy with confidence – located in the US, Sight Pro specializes in providing best-in-class privacy solutions to individuals, small businesses, corporations, government, and educational institutions. Our privacy screens are Section 889 and TAA compliant.
  • Status: one of block, review, or no_match.
  • Reason: a short explanation of why the status was set.
  • Rule names and character offsets: which rules fired and where each match starts and ends in the input.
  • Masked preview: the original text with each matched span replaced by asterisks, so a reviewer can see the shape of what was flagged without seeing the value.

When the status is block, the most severe rule that fired determines the outcome. Because the preview only masks spans the rules found, it is not a redacted copy of the text. Treat it as a display aid, not as a sanitized payload to send onward.

Input caps and what happens at the limit

The sample sets two ceilings: 8,192 characters of input and 48 findings per call. These are constants written into the example code. The article does not measure performance at these values, and you should tune them to your own message sizes.

Rank #2
SightPro Magnetic Laptop Privacy Screen 16 Inch 16:10 - Patented Removable Laptop Privacy Filter Shield and Protector
  • 【Instant Snap-on Magnetic Attachment】- The Patented Magnetic Privacy Screen – Protected by U.S. Patents 9,829,669 and D844,012. Simply place the privacy screen along the top of your MacBook and let the magnets attach along the top. No need for tricky placement, messy tape, or damaging adhesive. Easily remove and reattach when you need it.
  • 【Filter Dimensions】: Width: 13.56" (344.5 mm), Height: 8.49" (215.6 mm), Diagonal: 16" (406 mm) - SightPro Blackout Privacy Filter is engineered to be compatible with Lenovo, HP, Dell, Acer, Asus, Samsung, and other laptop brands. Please verify your screen's width and height measurements before ordering. It's not recommended to make your selection based solely on your screen's diagonal size. [Not optimized for touchscreens.]
  • 【Superior Privacy】- Our advanced multi-layered film filter blacks out your screen when viewing from the side, while maintaining a crystal clear screen straight-on. It also protects your eyes from harmful UV and blue light. [Note: It does not block visibility directly behind you, regardless of the distance.]
  • 【Perfect for Travel and Open Workspaces】- The Laptop Privacy Screen Filter is the ideal solution for healthcare providers, mobile workers, commuters, students, and business travelers. Now you can stay compliant and safeguard sensitive corporate information while working in airplanes, subways, airports, and public areas.
  • 【Package Contents】- Each package includes a magnetic privacy screen filter, magnetic stickers, a webcam privacy cover, a storage folder, and a cleaning cloth. Buy with confidence – located in the US, Sight Pro specializes in providing best-in-class privacy solutions to individuals, small businesses, corporations, government, and educational institutions. Our privacy screens are Section 889 and TAA compliant.

When either cap is reached, the server returns review and omits the preview entirely. That is a sensible fail-safe, because a truncated scan could otherwise look like a clean one. Test both caps deliberately, since a long paste or a text with many short matches is the most likely way to hit them in production.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What a no_match result does and does not mean

The article is direct about the limits of the approach: “It can’t prove that text is safe, and its prompt injection check is only a tripwire.” A no_match result means only that these three rules found nothing in this input. It says nothing about names, addresses, other identifiers, or instructions phrased in ways the list does not cover.

Rank #3
15.6 Inch Privacy Screen Filter for 16:9 Monitor 1920 x 1080 Resolution
  • Compatible Models: Width: 13 9/16" (13.5 inch/344 mm), Height: 7 5/8" (7.6 inch/194 mm), Diagonal: 15.6" (396.24 mm) widescreen laptops which have a 16:9 aspect ratio. Not touchscreen compatible !!! Not fit for 16:10.Do NOT rely solely on your laptop’s diagonal size when ordering. Use a ruler to measure your screen’s visible area (excluding the black bezels). If the width reads 344mm and height reads 194mm, this filter is a perfect match for your device.
  • Keep Information Privacy: Effective "black out" privacy from side views outside the 60-degree viewing angle. Designed for optical clarity when viewing from the front, a person not at the front of the screen can only see the dark side of the screen, so it protects buisness secrets and personal privacy
  • Eye and Screen Protection: Privacy filter does not only protect your private life but also protects your eyes by blocking 30% of blue light , blocking the harmful blue light between 380 - 495nm, it filters out the blue light and relieves eye strain. Our laptop privacy screen also helps keep your screen safe from dust and scratches
  • Perfect For Open Workspaces: Great for maintaining screen privacy in high traffic areas such as open work spaces, airports, airplanes, commuter trains, coffee shops and other public places, etc
  • Easy Installation: Choose between 2 simple Options; Slide-On/Off or Mounted. Not touchscreen compatible

Build your product language around that boundary. Describing the output as “verified clean” or “PII-free” overstates what the scan checked.

Make the scan mandatory in the host application

The server cannot stop a model request by itself. A tool call is an option the host can take or skip, so if the agent can reach the model without calling the tool, the check is optional. The article’s own wording is “The host owns the gate.” Put the check where the application is forced through it:

Rank #4
SightPro 14 Inch 16:10 Laptop Privacy Screen Filter - Computer Monitor Privacy Shield and Anti-Glare Protector
  • Filter Dimensions: Width: 11 15/16" (304 mm), Height: 7 1/2" (190 mm), Diagonal: 14.1" (358.14 mm) - SightPro Blackout Privacy Filter is engineered to be compatible with Lenovo, HP, Dell, Acer, Asus, Samsung, and other laptop brands. Please verify your screen's width and height measurements before ordering. It's not recommended to make your selection based solely on your screen's diagonal size. [Not optimized for touchscreens.]
  • Two Attachment Options - Installs in minutes. Option 1 uses clear adhesive strips that securely attach to any screen. Option 2 uses slide mount tabs that easily stick to the display frame, allowing you to slide the filter on and off the screen as needed.
  • Superior Privacy and Anti Glare - Our advanced multi-layered film filter blacks out your screen when viewing from the side, while maintaining a crystal clear screen straight-on. It also protects your eyes from harmful glare, UV, and blue light. [Note: It does not block visibility directly behind you, regardless of the distance.]
  • Perfect for Travel and Open Workspaces - Our computer screen privacy filter is the ideal solution for healthcare providers, mobile workers, commuters, students, and business travelers. Now you can stay compliant and safeguard sensitive corporate information while working in airplanes, subways, airports and public areas.
  • Package Contents - Each package includes one privacy screen shield filter, two sets of clear adhesive strips, two sets of slide mount tabs, and a microfiber cleaning cloth. Buy with confidence – located in the US, Sight Pro specializes in providing best-in-class privacy solutions to individuals, small businesses, corporations, government, and educational institutions. Our privacy screens are Section 889 and TAA compliant.
  1. Locate the single function or code path that sends user content to an external model.
  2. Call the scan on that content inside that path, before the network request is built.
  3. If the status is block, stop the send and return an error to the caller without transmitting the text.
  4. If the status is review, also hold the send. Route it to whatever human or policy step your application uses to release it.
  5. Only transmit when the status is no_match, and log the status and rule names rather than the input.
  6. Make sure no alternate code path, such as a retry, a background job, or a second model client, skips step 2.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Local execution does not make the text harmless

The walkthrough runs as a local subprocess that talks to the host over stdio. It needs no model call, no API token, and no paid service. That keeps the scanner itself off the network, but it does not protect the data around it:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • The host process necessarily reads the full text to pass it to the tool.
  • Some hosts can export tool-call traces to a remote service. Check your host’s logging and trace settings before you run real customer data through the scan.
  • The masked preview can still contain PII that the rules did not catch, so it should be handled with the same care as the original text.

The tutorial’s practical suggestions fit with this. Keep raw matches out of ordinary debug logs. Use synthetic fixtures when you experiment with rule changes. Keep any protocol debug output off stdout, because stdio transport uses stdout for protocol messages. Test the cap and overlap cases. Finally, treat the scan as one layer of prompt-injection defense, alongside restricted tool permissions and human approval for consequential actions.

Best Value
SightPro 15.6 Inch 16:9 Laptop Privacy Screen Filter - Computer Monitor Privacy Shield and Anti-Glare Protector
  • 【Filter Dimensions】: Width: 13 9/16" (345 mm), Height: 7 5/8" (194 mm), Diagonal: 15.6" (396.24 mm) - SightPro Blackout Privacy Filter is engineered to be compatible with Lenovo, HP, Dell, Acer, Asus, Samsung, and other laptop brands. Please verify your screen's width and height measurements before ordering. It's not recommended to make your selection based solely on your screen's diagonal size. [Not optimized for touchscreens.]
  • 【Two Attachment Options】- Installs in minutes. Option 1 uses clear adhesive strips that securely attach to any screen. Option 2 uses slide mount tabs that easily stick to the display frame, allowing you to slide the filter on and off the screen as needed.
  • 【Superior Privacy and Reduce Glare】- Our advanced multi-layered film filter blacks out your screen when viewing from the side, while maintaining a crystal clear screen straight-on. It also protects your eyes from harmful glare, UV, and blue light. [Note: It does not block visibility directly behind you, regardless of the distance.]
  • 【Perfect for Travel and Open Workspaces】- Our computer screen privacy filter is the ideal solution for healthcare providers, mobile workers, commuters, students, and business travelers. Now you can stay compliant and safeguard sensitive corporate information while working in airplanes, subways, airports and public areas.
  • 【Package Contents】- Each package includes one privacy screen shield filter, two sets of clear adhesive strips, two sets of slide mount tabs, and a microfiber cleaning cloth. Buy with confidence – located in the US, Sight Pro specializes in providing best-in-class privacy solutions to individuals, small businesses, corporations, government, and educational institutions. Our privacy screens are Section 889 and TAA compliant.

Check the SDK version before you copy the code

The sample uses the v1-era FastMCP import and API. The official MCP Python SDK documentation, as of October 2026, labels v2 as the current stable line and documents MCPServer as the server class. Before you treat the sample as drop-in code:

  • Confirm your Python is 3.10 or newer, which the official SDK page states as its requirement.
  • Read the SDK’s migration guide and map the FastMCP calls to their v2 equivalents.
  • Pin the SDK version in your dependency file so an upgrade cannot change server behavior silently.
  • Confirm which transport you need. The official SDK describes stdio, Streamable HTTP, and SSE.

Choosing how to expose the scan

The same scan logic can be exposed three ways. The transport changes how callers reach the check, not how good the check is.

Option Good fit Boundary and data path Main cost
Local MCP tool An MCP-compatible host needs a named scan tool it can discover Host and subprocess permissions; text passes through local pipes Host setup and protocol handling
Plain Python function One Python application owns the whole send path Runs with the application’s existing permissions, in the same process Other hosts cannot discover it as a tool
Operated HTTP endpoint Several applications need one shared rules service Text crosses the network; you must implement authentication Deployment and ongoing service operations

A plain function is the simplest choice when one caller owns the path. MCP makes sense when several compatible hosts need the same named tool. An HTTP service is worth its operational cost only when many applications must share one rules set and you are prepared to secure it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.