focxle MCP server
✓ 인증됨프로세스 내에서 토큰 사용량을 직접 모니터링하여 여러 벤더에 걸친 AI agent 비용을 추적하고 할당합니다.
다른 이름 focxle/focxle-python, focxle-python, focxle
- 스타
- 0
- Tools
- —
- 다운로드, 30일
- 122
- 최신 버전
- 0.1.7
- 마지막 커밋
- 2026년 8월 10일
- 라이선스
- MIT
focxle MCP란?
focxle은(는) MCP server입니다. 프로세스 내에서 토큰 사용량을 직접 모니터링하여 여러 벤더에 걸친 AI agent 비용을 추적하고 할당합니다.
프로젝트 README에서 생성된 요약
focxle MCP server 정보
focxle는 단일 프로세스 내에서 여러 벤더를 사용하는 AI agent의 비용을 추적하고 할당하는 방법을 제공합니다. OpenAI, Anthropic 또는 Serper의 개별 대시보드를 일일이 확인할 필요 없이, 개발자는 특정 agent에 할당된 지출 내역을 통합된 형태로 확인할 수 있습니다. 벤더 자체의 카운트에서 토큰 사용량을 직접 모니터링하므로, 추측이나 프록시에 의존하지 않고 정확한 데이터를 보장합니다.
이 도구는 계정, API key, 초기 네트워크 호출이 필요 없는 Python 라이브러리를 통해 로컬 통합이 가능하도록 설계되었습니다. fail open 방식으로 구축되어 측정 도구에 오류가 발생하더라도 agent의 요청은 중단 없이 계속됩니다. Cursor, Windsurf, Claude Code와 같은 AI 통합 에디터를 사용하는 개발자의 경우, 포함된 MCP server를 통해 로컬 JSON rollup을 사용하여 채팅 인터페이스에서 직접 지출 내역을 조회할 수 있습니다.
활용 사례
- 1다중 벤더 agent 비용 분석AI 에디터에게 이번 주에 agent가 사용한 모든 API 제공업체의 총 지출액을 계산해 달라고 요청합니다.
- 2비용이 많이 드는 agent 워크플로우 식별현재 API 청구서에서 가장 큰 비중을 차지하는 특정 agent 이름을 확인합니다.
- 3비용 절감을 위한 예산 제한 시뮬레이션호출당 특정 지출 한도를 설정했을 경우 얼마나 많은 비용을 절감할 수 있었을지 평가합니다.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
focxle MCP 설치 방법
형식 확인: 2026년 11월 10일Cursor에 추가Goose에 추가Claude Code에 focxle MCP 설치
$ claude mcp add focxle-python -- uvx focxleCursor에 focxle MCP 설치
~/.cursor/mcp.json
{
"mcpServers": {
"focxle-python": {
"command": "uvx",
"args": [
"focxle"
]
}
}
}VS Code에 focxle MCP 설치
.vscode/mcp.json
{
"servers": {
"focxle-python": {
"type": "stdio",
"command": "uvx",
"args": [
"focxle"
]
}
}
}VS Code CLI에 focxle MCP 설치
$ code --add-mcp '{"name":"focxle-python","type":"stdio","command":"uvx","args":["focxle"]}'Claude Desktop에 focxle MCP 설치
claude_desktop_config.json
{
"mcpServers": {
"focxle-python": {
"command": "uvx",
"args": [
"focxle"
]
}
}
}Codex에 focxle MCP 설치
$ codex mcp add focxle-python -- uvx focxleCodex config.toml에 focxle MCP 설치
~/.codex/config.toml
[mcp_servers.focxle-python] command = "uvx" args = ["focxle"]
Gemini CLI에 focxle MCP 설치
$ gemini mcp add -s user focxle-python uvx -- focxleGemini settings.json에 focxle MCP 설치
~/.gemini/settings.json
{
"mcpServers": {
"focxle-python": {
"command": "uvx",
"args": [
"focxle"
]
}
}
}구성
FOCXLE_NO_HISTORYSet to 1 to stop focxle keeping any local spend history. The server then has nothing to read and will say so.
| 이름 | 설명 | 유형 |
|---|---|---|
| FOCXLE_NO_HISTORY | Set to 1 to stop focxle keeping any local spend history. The server then has nothing to read and will say so. |
자동 검사
2026년 11월 15일에 실행됨전체 보고서 →자동 검사를 통과했습니다. 이는 보안 감사가 아닙니다. 코드를 직접 읽고 서버에 필요한 최소한의 권한만 부여하십시오. 검사 방식
- 소스 저장소 연결 및 접근 가능focxle/focxle-python is public and reachablegithub.com/focxle/focxle-python ↗통과
- 패키지가 이 저장소를 소스로 명시focxle names focxle/focxle-python as sourcepypi.org/project/focxle/ ↗통과
- 빌드 출처(Sigstore 증명)No build attestation published for this release검사되지 않음
- 오픈 소스 라이선스 (OSI)MITspdx.org/licenses/MIT.html ↗통과
- 최근 1년 내 커밋 또는 릴리스Last commit or release 2026-09-21github.com/focxle/focxle-python ↗통과
- OpenSSF Scorecard검사되지 않음
- 패키지 이름이 인기 패키지와 유사하지 않음No popular package one edit away from focxle통과
- 패키지 및 해당 종속성에 중요한 보안 권고 없음1 resolved dependencies checked; no critical advisoryosv.dev ↗통과
- 모델에 대한 숨겨진 지침 없음0 tool descriptions and the README read; no override phrases, credential paths or hidden characters통과
- 파괴적인 도구에 라벨 표시됨검사되지 않음
- 원격 엔드포인트가 MCP 핸드셰이크에 응답검사되지 않음
README
GitHub에서 보기focxle
See what every AI agent costs you, across every vendor. In one line, with no account, in under a second.
Nothing you already have can tell you what one agent cost. Your OpenAI dashboard cannot see Anthropic. Neither can see Serper, Firecrawl, or the twelve other APIs your agent calls in a loop at 3am. They all report per key and per month, which is the wrong unit twice over: you do not run a key, you run agents, and by the time the month closes the money is gone.
focxle runs inside your process, so it sees every one of them, attributes them to the agent that made the call, and prices them from the vendor's own token counts rather than a guess. Connect an account and payments your agent settles on-chain land in the same total.
Why the number gets large fast. Do the arithmetic on a stuck agent. Two frontier-model calls a second, 10k tokens in and 1k out, at $5 per million in and $25 per million out, is 7.5 cents a call and $540 an hour. Twelve hours overnight is $6,480. A two-day weekend is $25,900. Nobody budgets for this, because nobody plans it: it is a bad stopping condition, one retry wrapper too many, a tool that feeds its own output back into the prompt. The first anyone hears is the invoice.
That is the entire reason this exists. It is free, forever, to watch it happen and to see exactly what a cap would have stopped before you pay for one.
This library fails open. It runs inside your agent, so the worst thing it
could do is break a request it was only supposed to measure. If anything inside
it fails, your call goes through and the failure is counted and printed at the
end. focxle.init(fail_open=False) inverts that if an unmeasured call is
genuinely worse for you than a failed one.
It blocks nothing by default. Out of the box it only measures. Refusing a call needs an account on a paid plan, and even then the instruction comes from a signed document rather than a local setting, so nothing you or we write in code can quietly switch it on. Calls to vendors we cannot price are always allowed through.
pip install focxle
import focxle
focxle.init()
That is the whole setup. No account, no API key, no config file, and no network call. Prices ship with the package, so the first run works on a plane. Telemetry is off unless you turn it on, and we ask exactly once.
What you get
focxle spend $47.21
--------------------------------------------------------
support-triage $31.04 (1,284 calls)
anthropic $28.10
google.serper.dev $2.94
research $16.17 (203 calls)
openai $14.02
api.firecrawl.dev $2.15
3 calls would have been stopped under $1.50/call and $50/day
$12.30 prevented, worst single call $4.10
3x single call $4.10 over the $1.50 per-call limit
$5,904 a month at the rate this run was going
$412.60 prevented across 17 runs in 9 days
observe mode: nothing was actually blocked
prices dated 2026-08-05
turn these into real caps: https://focxle.com/upgrade
The second block is the point. It is what a cap would have done, evaluated by the same code that would do the blocking, printed so you can decide whether you want one before you pay for one.
Every figure there is a measurement, not a sales number. The total, the worst call and the running total are sums of calls that really happened, priced from the vendor's own usage numbers. The monthly figure is the only projection, it is this run's own measured rate carried forward, it says so on the line itself, and it is withheld entirely unless the run was long enough and busy enough to mean anything.
If a cap would have stopped a large share of your calls, it says that instead of quoting a figure. A cap that blocks a quarter of an agent's work is not saving money, it is stopping the agent, and calling the difference a saving would make the number worthless on the day it matters. Nothing is offered for sale on those runs either.
Why there is nothing else quite like this
Cost tools for AI fall into three shapes, and all three ask you for something before they tell you anything.
Vendor dashboards are per key and per month, one per vendor, and none of them can see the others. Four vendors means four tabs and no total.
Proxies and gateways see everything, because every call now goes through somebody else's server. That is a new dependency on your live path, a new company holding your prompts, and a new thing that can be down at 3am.
Observability platforms want a trace pipeline, an account, and a seat or per-trace bill before the first number appears. Several are excellent. All of them are a project, and none of them is something you do at 4pm because you got a surprising invoice at lunchtime.
focxle is pip install focxle and one line. It has zero dependencies, so
nothing enters your environment and nothing can conflict with your pins. It
makes zero network calls on the free path, which the test suite proves by
deleting socket.socket and running the whole suite anyway. It needs no
account, no key and no config file, and the price table ships inside the
package, so the first run works on a plane. It fails open by construction:
the worst thing a bug in here can do is fail to measure a call that still went
through.
And it answers the question none of the others can: what did this agent cost me, across everything it touched.
Attributing spend to an agent
Per agent is the number nobody else can show you, and it only exists if calls are labelled.
with focxle.agent("support-triage"):
result = my_agent.run(ticket)
Works across threads and async tasks. Or set FOCXLE_AGENT in the environment,
which is usually right, because the same image is normally deployed as several
different agents.
Exact token counts
The HTTP layer already sees your model calls. Wrapping the client upgrades them from "a request happened" to the vendor's own token counts.
from openai import OpenAI
client = focxle.watch(OpenAI())
Streaming is handled. Wrapping the same client twice is a no-op rather than a double count.
For LangChain, where the framework builds the client for you:
chain.invoke(x, config={"callbacks": [focxle.langchain_handler()]})
Ask it in your editor
focxle ships an MCP server, so you can ask about your own spend in Claude Code, Cursor, Windsurf, Zed or anything else that speaks MCP:
what did my agents cost this week which agent is the expensive one what would a $2 per call cap have stopped
Add this to your client's MCP config:
{
"mcpServers": {
"focxle": { "command": "python", "args": ["-m", "focxle", "mcp"] }
}
}
It answers from a small daily rollup kept in ~/.focxle/history.json, written
when an instrumented process exits. It reads that file and nothing else: no
network, no account, and it never starts measuring anything itself, so your
editor's own model calls are never counted as yours. FOCXLE_NO_HISTORY=1
turns the rollup off, and then there is nothing to ask about.
Reading the numbers yourself
focxle.spend() # total USD observed
focxle.spend("support-triage") # for one agent
focxle.counterfactual() # what a cap would have stopped
focxle.report() # print now instead of at exit
focxle.init(file="~/spend.jsonl") # one JSON object per call
What it does not do
It does not block anything on its own. With no account, policy evaluation
runs and the verdict is only recorded, so you see what a cap would have done
before you decide you want one. Policy(mode="enforce") written in your own
code is refused and downgraded to observe, with a note on stderr: enforcement
is something an account is granted, not a flag a process sets for itself.
When it is granted, caps are judged on what you have actually spent, not on a
guess at what a call is about to cost. Output length cannot be known before the
reply is written, so guessing it refuses ordinary work and misses the runaways.
The one exception is the per-call ceiling, which has to be decided in advance:
it prices the max_tokens you asked for, so set it above what your largest
declared reply would cost rather than above what calls typically cost.
It does not price everything. A vendor missing from the price table is recorded at zero, and both the host and the exact model id are named in the report, so a zero that means "free" is never confused with a zero that means "we did not recognise this". The call is allowed through. Blocking a call because we do not know what it costs would be this library making a decision on missing information inside a process that trusted it to be passive. An invented figure would be worse, because it looks like knowledge.
Routers are priced as the provider they name, so a call through OpenRouter to
anthropic/claude-haiku-4.5 costs what that model costs. Dots and dashes in a
version are treated as one spelling, because which one you see depends on whose
SDK produced the string.
It is per process. An agent running across fifty workers produces fifty
partial pictures. Reconciling them needs somewhere to send them, which is what
an account is for. The one exception is the running total of what a cap would
have prevented, which is kept in ~/.focxle/lifetime.json so a second run does
not start from zero. It holds two numbers and a date, never leaves your
machine, and FOCXLE_NO_LIFETIME=1 stops it being written at all.
Everything under ~/.focxle is created for your user only, 0700 on the
directory and 0600 on the files, the way ~/.ssh and ~/.aws/credentials
are. Your account id is a credential: whoever reads it can read that account's
spend and start a checkout against it, and agent workloads run on shared CI
runners constantly. Anything an earlier version left world readable is
tightened the next time it is written.
It has no dependencies. Nothing is added to your environment and nothing can conflict with your versions. The SDKs and frameworks it instruments are detected at runtime and never imported at install time.
What is sent anywhere
Nothing, unless you turn it on. There is no network call on the observe path at
all, which the test suite asserts by removing socket.socket and running
anyway.
There is exactly one thing we ask for, printed once after your first breakdown and never again. It is off until you type a command:
python -m focxle share preview # the exact JSON, before you decide
python -m focxle share on
python -m focxle share off
If you turn it on, it sends anonymous vendor totals: which vendors you used, how many calls, how much, and the hosts we could not price. That last one is the whole reason we ask, because it is how we know what to price next.
It never sends your agent names, your model names, prompts, responses, URLs or
anything derived from your machine. The install id is a random UUID generated
locally, not a hash of your hostname, because anything derived can be reversed
by whoever holds the same input. Private hosts (.internal, .corp, bare
names, IP addresses) are dropped from every field and counted under withheld,
so the totals are visibly partial rather than quietly so.
It never prompts. This runs at process exit, often with no terminal attached, and blocking on stdin there would hang a production agent.
If you enable the local file sink, it records the host and the first two segments of the path, never query strings, so your search terms and document ids stay out of it. That file never leaves your machine.
Compatibility
Python 3.9 and up. Instruments openai, anthropic, httpx, requests and
LangChain when they are present, and does nothing when they are not.
Source, issues and contributions
The source is published at github.com/focxle/focxle-python so you can read it before running it inside your agent. It is generated from a private build repository and is source only: the test suite lives there and is not mirrored here, because those files have never been through the checks that decide what is safe to publish.
Because the repo is generated, pull requests cannot be merged back and are not accepted. That is a limitation of how this is built, not a comment on your patch. What is genuinely wanted, and acted on:
- Bugs and feature requests — open an issue, or email mrinal@focxle.com.
- A vendor or model we price wrongly, or do not price at all. The report names them, and that list is the single most useful thing you can send us.
- Security findings — use GitHub's private vulnerability reporting on that repo, or email the address above. Please give us a reasonable window before publishing.
Licence
MIT.
focxle MCP 질문
focxle MCP를 Claude Code에 추가하려면 어떻게 하나요?
터미널에서 claude mcp add focxle-python -- uvx focxle를 실행합니다. 모든 프로젝트에서 사용할 수 있게 하려면 --scope user를 추가합니다.
focxle MCP를 Cursor에 추가하려면 어떻게 하나요?
~/.cursor/mcp.json를 열고 mcpServers 아래에 서버를 추가합니다. 위 설치 섹션에 표시된 Cursor 구성을 사용합니다.
focxle를 시작하려면 계정이나 API key가 필요한가요?
아니요, 계정, API key, 설정 파일이 전혀 필요하지 않습니다. 가격 정보가 패키지에 포함되어 있어 오프라인에서도 작동합니다.
focxle를 사용하면 기존 agent 코드가 망가지나요?
이 라이브러리는 fail open 방식으로 설계되었습니다. 즉, 오류가 발생하더라도 agent 호출은 그대로 진행되며 실패 기록만 남습니다.
코드 에디터와 함께 focxle를 사용할 수 있나요?
네, MCP server가 포함되어 있어 Claude Code, Cursor, Windsurf, Zed와 같은 에디터에서 agent 지출 내역을 질문할 수 있습니다.
프롬프트나 응답을 서버로 전송하나요?
아니요, agent 이름, 모델 이름, 프롬프트, 응답 또는 URL을 전송하지 않습니다. 텔레메트리는 기본적으로 비활성화되어 있으며, 명시적으로 활성화한 경우에만 익명의 벤더별 합계 데이터만 전송합니다.