AI and machine learning · Intermediate · 26 min
Redact personal data before sending text to an LLM
By Padding · Updated 18 Nov 2026
python:3.14-slim · Python 3.14 · presidio-analyzer 2.2.366 · spaCy 3.8.18 · en_core_web_sm 3.8.0
You will build a Python redaction layer with Presidio and spaCy that swaps names, emails, phone numbers and Nigerian and Kenyan ID numbers for placeholders before a prompt leaves your server, puts the real values back in the reply, keeps them out of your logs and measures what it still misses.
On this page
A support assistant that drafts replies with a language model sends every customer message to someone else's servers. Most of those messages carry personal data that the model does not need to do its job: the customer's name, email address, phone number, and in Nigeria often a NIN or BVN pasted in to "prove" who they are. The model can write "Hello Amaka, a colleague will call you today" just as well from "Hello <PERSON_1>, a colleague will call you on <PHONE_NUMBER_1> today".
This tutorial builds that layer. Before a prompt leaves your server, the code finds personal data and replaces each item with a numbered placeholder. The real values stay in a small dictionary on your server, called the vault here. When the reply comes back, the code puts the real values back in. Your logs only ever see the placeholder version.
You will use two Microsoft Presidio packages: presidio-analyzer finds personal data with patterns, checksums and a spaCy language model, and presidio-anonymizer replaces what it finds. You will add recognisers for Nigerian and Kenyan phone numbers, the Nigerian NIN and BVN and Kenyan national ID numbers. Then you will measure what slips through, because some always does. Presidio's own documentation says plainly that it cannot guarantee to find all sensitive information.
Two legal points frame this. Nigeria's Data Protection Act 2023 requires personal data to be limited to the minimum necessary for the purpose (section 24(1)(c)) and protected with appropriate technical and organisational measures (section 24(2)). The GDPR has the same minimisation principle. Under the GDPR, though, replacing values with placeholders you can reverse is pseudonymisation, and pseudonymised data is still personal data. Redaction reduces what you send. It does not take the text out of data protection law, and the vault is now among the most sensitive things you hold. This tutorial is engineering guidance, not legal advice.
Step 1 · Install Presidio and the small English model
Create a throwaway project folder and a virtual environment, then install pinned versions. The spaCy model is a separate download from GitHub:
mkdir -p ~/redact-demo
cd ~/redact-demo
python3 -m venv .venv
. .venv/bin/activate
pip install presidio-analyzer==2.2.366 presidio-anonymizer==2.2.366 spacy==3.8.18
pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whlThis tutorial uses en_core_web_sm, spaCy's small English model. The wheel is about 13 MB. Presidio's default configuration asks for en_core_web_lg, which is about 400 MB. The large model finds more names, but the download matters if you are on prepaid mobile data, and so does the memory on a small server. Start small and let the measurement in a later step tell you whether you need more.
Check it worked
python -c "import presidio_analyzer, presidio_anonymizer, spacy, en_core_web_sm; print(spacy.__version__, en_core_web_sm.__version__)"The output is 3.8.18 3.8.0. If pip says no matching distribution was found for presidio-analyzer, your Python is too new or too old: check python3 --version and use 3.11 to 3.14.
Step 2 · See what Presidio finds with its defaults
Create four support messages of the kind a shop in Lagos or Nairobi receives. All the names, numbers and addresses in this tutorial are made up:
cat > messages.txt <<'TXT'
Hi, I'm Amaka Okonkwo. My order hasn't arrived. Email me at amaka.okonkwo@example.com or call 0803 555 0142.
This is Wanjiru Kamau from Nairobi. My ID number is 31234567 and my phone is +254 712 345 678.
Please update my account. My NIN is 12345678901 and my BVN is 22198765432. Thanks, Tunde Bakare.
Hello, can you reset my password? You can reach me on +234 909 555 7788. Regards, Ngozi.
TXTNow run Presidio's analyser over them with its built-in recognisers, asking only for names, emails and phone numbers. The NlpEngineProvider block tells Presidio to load the small model instead of the large one:
cat > first_look.py <<'PY'
from presidio_analyzer import AnalyzerEngine
from presidio_analyzer.nlp_engine import NlpEngineProvider
provider = NlpEngineProvider(nlp_configuration={
"nlp_engine_name": "spacy",
"models": [{"lang_code": "en", "model_name": "en_core_web_sm"}],
})
analyzer = AnalyzerEngine(nlp_engine=provider.create_engine(), supported_languages=["en"])
for line in open("messages.txt", encoding="utf-8"):
text = line.strip()
results = analyzer.analyze(text=text, language="en", entities=["PERSON", "EMAIL_ADDRESS", "PHONE_NUMBER"])
for r in sorted(results, key=lambda r: r.start):
print(f"{r.entity_type:<15} {r.score:.2f} {text[r.start:r.end]}")
print("--")
PY
python first_look.pyCheck it worked
You see one block per message, separated by --. Read it as a reviewer would:
Amaka Okonkwo, the email address andNgoziare found.Wanjiru KamauandTunde Bakareare not: the small model does not recognise every name, and it does worse on names it saw less often in training.- The Nigerian and Kenyan phone numbers are found, but partly by luck. Presidio's phone recogniser checks numbers against a default list of regions (the US, UK, Germany, France, Israel, India, Canada and Brazil), and
0803 555 0142happens to be a valid shape for a German or Indian number. - The NIN
12345678901is reported as a phone number, because it is also a valid shape for a US number. The BVN22198765432and the Kenyan ID31234567are not reported at all.
Each result has a score between 0 and 1. A phone number with no supporting words nearby scores 0.40. The score matters in the next step.
Step 3 · Add recognisers for Nigerian and Kenyan data
Put the analyser setup in its own module so the rest of the code can share it. It makes four changes to the defaults:
cat > recognisers.py <<'PY'
from presidio_analyzer import AnalyzerEngine, Pattern, PatternRecognizer
from presidio_analyzer.context_aware_enhancers import LemmaContextAwareEnhancer
from presidio_analyzer.nlp_engine import NlpEngineProvider
from presidio_analyzer.predefined_recognizers import PhoneRecognizer
ENTITIES = ["PERSON", "EMAIL_ADDRESS", "PHONE_NUMBER", "NG_NIN", "NG_BVN", "KE_NATIONAL_ID"]
THRESHOLD = 0.4
def build_analyzer():
provider = NlpEngineProvider(nlp_configuration={
"nlp_engine_name": "spacy",
"models": [{"lang_code": "en", "model_name": "en_core_web_sm"}],
})
analyzer = AnalyzerEngine(
nlp_engine=provider.create_engine(),
supported_languages=["en"],
context_aware_enhancer=LemmaContextAwareEnhancer(
context_prefix_count=2, context_matching_mode="whole_word"
),
)
# swap the default phone recogniser for one that knows Nigerian and Kenyan numbers
analyzer.registry.remove_recognizer("PhoneRecognizer")
analyzer.registry.add_recognizer(
PhoneRecognizer(supported_regions=["NG", "KE", "GH", "ZA", "GB", "US"], name="AfricaPhoneRecognizer")
)
eleven_digits = r"(?<!\d)\d{11}(?!\d)"
analyzer.registry.add_recognizer(PatternRecognizer(
supported_entity="NG_NIN",
patterns=[Pattern("eleven digits", eleven_digits, 0.3)],
context=["nin", "nimc", "identification", "identity"],
))
analyzer.registry.add_recognizer(PatternRecognizer(
supported_entity="NG_BVN",
patterns=[Pattern("eleven digits", eleven_digits, 0.3)],
context=["bvn", "verification"],
))
analyzer.registry.add_recognizer(PatternRecognizer(
supported_entity="KE_NATIONAL_ID",
patterns=[Pattern("seven or eight digits", r"(?<!\d)\d{7,8}(?!\d)", 0.2)],
context=["id", "kenyan", "national"],
))
return analyzer
def find(analyzer, text, known_names=()):
"""Detect personal data. known_names are names you already hold, such as the account holder's."""
ad_hoc = []
if known_names:
words = set(known_names) | {part for name in known_names for part in name.split() if len(part) > 2}
ad_hoc.append(PatternRecognizer(supported_entity="PERSON", deny_list=sorted(words, key=len, reverse=True)))
return analyzer.analyze(
text=text, language="en", entities=ENTITIES, score_threshold=THRESHOLD, ad_hoc_recognizers=ad_hoc
)
PYWhat it changes:
- Phone regions. The default phone recogniser is removed and replaced with one that checks numbers against Nigeria, Kenya, Ghana, South Africa, the UK and the US. It uses Google's phone number rules, so
0803 555 0142is now matched because it is a valid Nigerian number, not by accident. Put your own customers' countries in this list. - NIN and BVN. Both are 11 digits, so a pattern alone cannot tell them apart, or tell either from a reference number. Each recogniser gives a bare 11-digit number a low score of 0.3, below the threshold of 0.4. When a context word such as
NINorBVNappears just before the number, Presidio raises the score by 0.35 and the number is reported. - Kenyan ID numbers. The sample uses eight-digit numbers, and the pattern accepts seven or eight. Check the formats on your own users' documents before you rely on a pattern like this. A bare eight-digit number scores 0.2, so only one introduced by words such as
IDornationalis reported. - Tighter context. Presidio looks five words back for context by default and matches substrings, so
idwould match insidepaid, and in "My NIN is ... and my BVN is ..." the wordNINwould also boost the BVN. Two words back and whole-word matching keep each label attached to its own number.
The find function also takes known_names. You will use that in the last measurement step.
Now detect with the new setup:
cat > detect.py <<'PY'
from recognisers import build_analyzer, find
analyzer = build_analyzer()
for line in open("messages.txt", encoding="utf-8"):
text = line.strip()
for r in sorted(find(analyzer, text), key=lambda r: r.start):
print(f"{r.entity_type:<15} {r.score:.2f} {text[r.start:r.end]}")
print("--")
PY
python detect.pyCheck it worked
The second block now has KE_NATIONAL_ID 0.55 31234567, and the third has NG_NIN 0.65 for 12345678901 and NG_BVN 0.65 for 22198765432. The NIN still also appears as a PHONE_NUMBER at 0.40. That overlap is fine: when two results cover the same text, the anonymiser in the next step keeps the one with the higher score. Wanjiru Kamau and Tunde Bakare are still missing. You will measure that properly and then reduce it.
Step 4 · Swap personal data for placeholders you can reverse
Write the redactor. redact returns the text with placeholders and a vault that maps each placeholder back to its value. restore does the reverse on the model's reply:
cat > redactor.py <<'PY'
import re
from presidio_anonymizer import AnonymizerEngine
from presidio_anonymizer.entities import OperatorConfig
from recognisers import ENTITIES, build_analyzer, find
PLACEHOLDER = re.compile(r"<([A-Z_]+?)_(\d+)>")
_analyzer = build_analyzer()
_anonymizer = AnonymizerEngine()
def redact(text, known_names=()):
"""Return (redacted text, vault). The vault maps each placeholder to the original."""
# a customer must not be able to plant a placeholder of their own
text = PLACEHOLDER.sub(r"(\1_\2)", text)
tags = {} # (entity, original) -> temporary tag
originals = {} # temporary tag -> original
def tagger(entity):
def make(original):
if (entity, original) not in tags:
tag = f"<{entity}_{len(tags) + 1000}>"
tags[(entity, original)] = tag
originals[tag] = original
return tags[(entity, original)]
return make
results = find(_analyzer, text, known_names)
operators = {e: OperatorConfig("custom", {"lambda": tagger(e)}) for e in ENTITIES}
tagged = _anonymizer.anonymize(text=text, analyzer_results=results, operators=operators).text
# Presidio replaces from the end of the text, so renumber in reading order
vault, renamed, counts = {}, {}, {}
def renumber(match):
old = match.group(0)
if old not in renamed:
entity = match.group(1)
counts[entity] = counts.get(entity, 0) + 1
renamed[old] = f"<{entity}_{counts[entity]}>"
vault[renamed[old]] = originals[old]
return renamed[old]
return PLACEHOLDER.sub(renumber, tagged), vault
def restore(text, vault):
"""Put the originals back. Return the text and any placeholders the vault did not know."""
unknown = []
def swap(match):
if match.group(0) in vault:
return vault[match.group(0)]
unknown.append(match.group(0))
return match.group(0)
return PLACEHOLDER.sub(swap, text), unknown
PYHow it works:
- Presidio's
customoperator calls a function for every item it replaces.taggergives the same value the same tag, so a customer who writes their email twice gets<EMAIL_ADDRESS_1>twice and the model can see it is one address. - Presidio works from the end of the text backwards, so the temporary tags come out in reverse. The
renumberpass renames them in reading order, which makes the redacted text easier for a person to review. - The first line turns anything that already looks like a placeholder, such as
<PERSON_1>typed by a customer, into(PERSON_1). Otherwise someone could write a placeholder into their message and have your own code swap another value into the reply. restorereturns the placeholders it did not recognise instead of guessing. A model can invent<PERSON_3>or mangle<PERSON_1>into[PERSON_1], and your code needs to notice.
Try it on the first message and on a reply that uses a placeholder the vault does not hold:
python - <<'PY'
from redactor import redact, restore
text, vault = redact("Hi, I'm Amaka Okonkwo. Email amaka.okonkwo@example.com or amaka.okonkwo@example.com, or type <PERSON_1>.")
print(text)
print(vault)
print(restore("Hello <PERSON_1>, we have updated <NG_BVN_1>.", vault))
PYCheck it worked
The output has three lines:
Hi, I'm <PERSON_1>. Email <EMAIL_ADDRESS_1> or <EMAIL_ADDRESS_1>, or type (PERSON_1).The repeated email shares one placeholder, and the typed placeholder has been defused.- The vault,
{'<PERSON_1>': 'Amaka Okonkwo', '<EMAIL_ADDRESS_1>': 'amaka.okonkwo@example.com'}. ('Hello Amaka Okonkwo, we have updated <NG_BVN_1>.', ['<NG_BVN_1>']): the known placeholder was restored, and the unknown one was left alone and reported.
Step 5 · Send only redacted text to the model and log only that
Now wire it into a request handler. fake_llm stands in for the model call so you can run everything offline. It replies the way a model is asked to: using the placeholders it was given. In your app, replace it with your client call, as in the tutorial on calling an LLM API from Python.
cat > app.py <<'PY'
import logging
import re
import sys
from redactor import redact, restore
logging.basicConfig(filename="support.log", level=logging.INFO, format="%(asctime)s %(message)s")
log = logging.getLogger("support")
def fake_llm(prompt):
"""Stands in for the model call. It answers the way a model would: using the placeholders."""
name = re.search(r"<PERSON_\d+>", prompt)
phone = re.search(r"<PHONE_NUMBER_\d+>", prompt)
reply = f"Hello {name.group(0) if name else 'there'}, sorry about the delay."
if phone:
reply += f" A colleague will call you on {phone.group(0)} today."
return reply
def answer(message, account_name=""):
redacted, vault = redact(message, [account_name] if account_name else [])
log.info("prompt: %s", redacted)
prompt = f"Write a short, polite reply to this customer message:\n\n{redacted}"
reply = fake_llm(prompt)
log.info("reply: %s", reply)
final, unknown = restore(reply, vault)
if unknown:
log.warning("reply used unknown placeholders %s; sent to a person", unknown)
return None
return final
if __name__ == "__main__":
print(answer(sys.argv[1], sys.argv[2] if len(sys.argv) > 2 else ""))
PY
python app.py "Hi, I'm Amaka Okonkwo. My order hasn't arrived. Email me at amaka.okonkwo@example.com or call 0803 555 0142."
cat support.logPoints that matter in a real service:
- The vault lives only inside
answerand is gone when the request ends. For a conversation that spans several turns, keep it server-side, keyed by conversation, encrypted, with a short expiry, and never send it to the browser or the model. - Only redacted text reaches the log calls. Log the vault, or the raw message in an exception handler, and you have undone the work. Error trackers that capture local variables need the same care.
- A reply with unknown placeholders is not sent. It goes to a person, because a guess could put one customer's data in another customer's reply.
Check it worked
The terminal shows Hello Amaka Okonkwo, sorry about the delay. A colleague will call you on 0803 555 0142 today. The customer sees their own details. support.log has two lines, a prompt and a reply, and neither contains the name, the email address or the phone number, only <PERSON_1>, <EMAIL_ADDRESS_1> and <PHONE_NUMBER_1>.
Step 6 · Measure what slips through
Redaction is a classifier, and classifiers miss. The only way to know how often is to run it over messages where you have marked every item of personal data by hand, then count. Create a labelled sample of 19 messages. They include Nigerian Pidgin and Swahili lines, because real support queues mix languages, and three messages with no personal data at all, to catch over-redaction:
cat > labelled.jsonl <<'JSONL'
{"text": "Hi, I'm Amaka Okonkwo. My order hasn't arrived. Email me at amaka.okonkwo@example.com or call 0803 555 0142.", "account": "Amaka Okonkwo", "pii": [["PERSON", "Amaka Okonkwo"], ["EMAIL_ADDRESS", "amaka.okonkwo@example.com"], ["PHONE_NUMBER", "0803 555 0142"]]}
{"text": "This is Wanjiru Kamau from Nairobi. My ID number is 31234567 and my phone is +254 712 345 678.", "account": "Wanjiru Kamau", "pii": [["PERSON", "Wanjiru Kamau"], ["KE_NATIONAL_ID", "31234567"], ["PHONE_NUMBER", "+254 712 345 678"]]}
{"text": "Please update my account. My NIN is 12345678901 and my BVN is 22198765432. Thanks, Tunde Bakare.", "account": "Tunde Bakare", "pii": [["NG_NIN", "12345678901"], ["NG_BVN", "22198765432"], ["PERSON", "Tunde Bakare"]]}
{"text": "Hello, can you reset my password? You can reach me on +234 909 555 7788. Regards, Ngozi.", "account": "", "pii": [["PHONE_NUMBER", "+234 909 555 7788"], ["PERSON", "Ngozi"]]}
{"text": "Good morning. My name is Ibrahim Musa and I was charged twice. My email is i.musa@example.org.", "account": "", "pii": [["PERSON", "Ibrahim Musa"], ["EMAIL_ADDRESS", "i.musa@example.org"]]}
{"text": "Abeg, my name na Chinedu Okafor. Call me for 08123456789, the delivery never reach.", "account": "Chinedu Okafor", "pii": [["PERSON", "Chinedu Okafor"], ["PHONE_NUMBER", "08123456789"]]}
{"text": "Habari, naitwa Achieng Otieno. Namba yangu ni 0722 123 456.", "account": "", "pii": [["PERSON", "Achieng Otieno"], ["PHONE_NUMBER", "0722 123 456"]]}
{"text": "My husband John Mensah placed the order, his number is +233 24 123 4567.", "account": "", "pii": [["PERSON", "John Mensah"], ["PHONE_NUMBER", "+233 24 123 4567"]]}
{"text": "I tried to verify with my NIN 70123456789 but the app says it is invalid.", "account": "", "pii": [["NG_NIN", "70123456789"]]}
{"text": "Here are my details for the upgrade: 44455566677", "account": "", "pii": [["NG_NIN", "44455566677"]]}
{"text": "Kindly confirm the refund to Fatima Bello, BVN 22311122233.", "account": "", "pii": [["PERSON", "Fatima Bello"], ["NG_BVN", "22311122233"]]}
{"text": "Here is my national ID 28765432 for the KYC check. Peter Njoroge.", "account": "", "pii": [["KE_NATIONAL_ID", "28765432"], ["PERSON", "Peter Njoroge"]]}
{"text": "send it to oluwaseun.adeyemi@example.com pls, my other email is down", "account": "", "pii": [["EMAIL_ADDRESS", "oluwaseun.adeyemi@example.com"]]}
{"text": "Dear support, Mrs Grace Wambui here. My number changed to 0733 987 654.", "account": "Grace Wambui", "pii": [["PERSON", "Grace Wambui"], ["PHONE_NUMBER", "0733 987 654"]]}
{"text": "My identity number is 55566677788, why is my account locked?", "account": "", "pii": [["NG_NIN", "55566677788"]]}
{"text": "The courier, Emeka, called me from 0701 234 5678 and was rude.", "account": "", "pii": [["PERSON", "Emeka"], ["PHONE_NUMBER", "0701 234 5678"]]}
{"text": "Order 40021 still shows as pending after 3 days. Please check.", "account": "", "pii": []}
{"text": "Can I pay with a card ending 4242? It failed twice today.", "account": "", "pii": []}
{"text": "I live on Allen Avenue in Ikeja and the rider could not find the shop.", "account": "", "pii": []}
JSONLEach line has the message, the name on the account it came from (empty when the writer is not the account holder or you would not know it), and the items a person marked. The measuring script counts an item as caught when its value no longer appears in the redacted text, which is the check that matters: did it leave your server or not. It also counts extra redactions, values that were replaced but not labelled.
cat > measure.py <<'PY'
import json
import sys
from collections import Counter
from redactor import redact
use_account = "--with-account-names" in sys.argv
found, total, extra = Counter(), Counter(), 0
leaks = []
for line in open("labelled.jsonl", encoding="utf-8"):
item = json.loads(line)
names = [item["account"]] if use_account and item["account"] else []
redacted, vault = redact(item["text"], names)
for entity, value in item["pii"]:
total[entity] += 1
if value in redacted:
leaks.append(f"{entity}: {value}")
else:
found[entity] += 1
labelled = {value for _, value in item["pii"]}
extra += sum(1 for value in vault.values() if value not in labelled)
print(f"{'entity':<16}{'caught':>7}{'of':>4}")
for entity in sorted(total):
print(f"{entity:<16}{found[entity]:>7}{total[entity]:>4}")
caught, everything = sum(found.values()), sum(total.values())
print(f"caught {caught} of {everything} ({caught / everything:.0%}), missed {everything - caught}, extra redactions {extra}")
for leak in leaks:
print(" leaked", leak)
PY
python measure.pyCheck it worked
The summary line reads caught 26 of 31 (84%), missed 5, extra redactions 0. The table shows every email, phone number, BVN and Kenyan ID caught, three of four NINs and eight of twelve names. Five values leaked:
- Four names:
Wanjiru Kamau,Tunde Bakare,Grace WambuiandEmeka. The Pidgin and Swahili messages were fine this time, but the small model misses names that a person would spot at once. - One NIN,
44455566677, sent with no label in front of it. That is the cost of the threshold: a bare 11-digit number is not redacted, because it could equally be an order or reference number.
Write the numbers down. They are your baseline, and every change from here is judged against them. Nineteen messages is enough to learn how the tool fails, not to quote a miss rate. For that, label a few hundred real messages from your own queue, and keep that labelled set as private as the data it contains.
Step 7 · Catch the names you already know
Most missed names in support messages belong to the customer who is writing, and you already have their name on the account. Passing it in as known_names adds a deny-list recogniser for that one request, matching the full name and each part of it, in any letter case. Run the measurement again with account names:
python measure.py --with-account-namesCheck it worked
The summary now reads caught 29 of 31 (94%), missed 2, extra redactions 0. Names went from 8 of 12 to 11 of 12. What is left is the courier Emeka, a third party you could not know about, and the unlabelled NIN.
Decide what to do about each kind of miss rather than hoping:
- Unknown third-party names. Try
en_core_web_lgor a transformer model and measure again on the same set, weighing the extra memory and slower requests. Presidio also supports other NLP engines. Whatever you change, the labelled set tells you whether it helped. - Bare ID numbers. If your users often paste numbers with no label, lower the NIN and BVN pattern scores to 0.4 so every 11-digit number is redacted, then check the extra redactions count. Losing an order number from a prompt is usually cheaper than sending a BVN.
- Things this tutorial does not look for. Addresses, dates of birth, card numbers and account numbers are personal data too. "Allen Avenue in Ikeja" went through untouched because
LOCATIONis not inENTITIES. Add the entities your messages carry, then label examples of them. - What still leaks. Treat the provider as receiving some personal data, because it will. Check its data retention and training terms, record the transfer in your data protection records, and tell customers in your privacy notice.
Step 8 · Clean up
When you have finished, leave the virtual environment and delete the demo folder, which holds the environment, the scripts, the sample data and support.log:
deactivate
cd ~
rm -rf ~/redact-demoCheck it worked
ls ~/redact-demo reports that there is no such file or directory.
Next steps
- Personal data is one risk of putting user text in a prompt. Instructions hidden in that text are another: defend an LLM app against prompt injection.
- Replace
fake_llmwith a real model: call an LLM API from Python. - Tell people what happens to their data and give them control over it: design consent and data controls for AI features.
- Redacting by hand before you paste research into an AI tool: remove personal data before sharing research with AI.
Related tutorials
- Use MCP server tools from your own Claude appYou will connect a Python app to the stdio clinic-hours MCP server, hand an allowlisted set of its tools to Claude, pass every tool call through to the server with a tested bridge, and know when the API's MCP connector can do the connecting for you.
- Trace LLM calls with OpenTelemetryYou will have a Python app whose Claude calls, retries and tool runs appear as one OpenTelemetry trace with GenAI attributes, token and latency metrics, prompts kept out by default, and an export path from the console to an OpenTelemetry Collector.
- Serve an MCP server over Streamable HTTP with authenticationYou will run an MCP server over Streamable HTTP on localhost that checks the Origin header, accepts only bearer tokens your token verifier knows, limits each tool to the right scope, and refuses calls without a token.
Need this done for you?
Padding does this work for growing companies, from the first diagnosis to a system that keeps working.
Get new tutorials