Tiktoken MCP
About
Count tokens using OpenAI's tiktoken library.
Details
- Author
- adbertram
- Categories
- Developer Tools, AI
Jump to
Setup
Install Tiktoken MCP in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/adbertram/tiktoken-mcp
Follow the installation instructions in the repository README, then restart your MCP client.
An MCP (Model Context Protocol) server that provides token counting functionality using OpenAI's tiktoken library.
- 🔢Token Counting: Count tokens for any text using various tiktoken encodings
- 💰Cost Estimation: Estimate token costs for popular AI models (GPT-4, Claude, etc.)
- 🚀Easy to Use: Run directly withnpx- no installation required
- 🔧Claude Desktop Integration: Seamlessly integrates with Claude Desktop app
You can run this MCP server directly using npx:
- Node.js 16 or higher
- Python 3.6 or higher
- pip (Python package manager)
The tiktoken Python library will be automatically installed when you first run the package.
Count tokens in text using various tiktoken encodings.
- text(required): The text to count tokens for
- model(optional): The encoding model to use. Options: 'cl100k_base' (default), 'p50k_base', 'p50k_edit', 'r50k_base'
Estimate token costs for various AI models.
- text(required): The text to estimate cost for
- model(required): The model to estimate cost for. Options: 'gpt-4', 'gpt-4-turbo', 'gpt-3.5-turbo', 'claude-3-opus', 'claude-3-sonnet', 'claude-3-haiku'
To use this MCP server with Claude Desktop, add the following to your Claude configuration file:
Location:~/Library/Application Support/Claude/claude_desktop_config.json
Location:%APPDATA%\Claude\claude_desktop_config.json
{ "mcpServers": { "tiktoken": { "command": "npx", "args": ["tiktoken-mcp"] } } }
After adding this configuration, restart Claude Desktop. You should then be able to use the token counting tools in your conversations.
Once configured, you can use the tools like this:
- "Count the tokens in this text: 'Hello, world!'"
- "Estimate the cost of this prompt for GPT-4"
- "How many tokens are in this paragraph using the cl100k_base encoding?"
Token count: 13 Model: cl100k_base First 100 token IDs: 9906, 11, 1917, 0, 498, 1097, 701, 30, 220, 17, ...
Token count: 150 Model: gpt-4 Estimated input cost: $0.004500 Estimated output cost: $0.009000 Total cost (if used as both input and output): $0.013500
This MCP server uses Python's tiktoken library under the hood to accurately count tokens. It supports multiple encoding models:
- cl100k_base: Used by GPT-4, GPT-3.5-turbo, and newer models
- p50k_base: Used by Codex models
- p50k_edit: Used by edit models
- r50k_base: Used by GPT-3 models
Contributions are welcome! Please feel free to submit a Pull Request.
If you encounter any problems, please file an issue on theGitHub repository.
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
next-devtools-mcp is a MCP server that provides Next.js development tools and utilities for AI coding assistants like Claude and Cursor.
Word search, crossword, and sudoku generator MCP server with printable PDF worksheets, themed word banks, and verifiable LLM evals. Local-first, from the makers of puzzletide.com.
A demonstration server for ActionKit, providing access to Slack actions via Claude Desktop.
MCP server that lets Claude Code agents delegate tasks to agents in other project directories, with parallel dispatch, sessions, and async jobs.
Statistical regression testing for LLM agents: p-value, effect size, and CI on behavior change.
A Python MCP package that gives your LLM agents complete file system and shell capabilities — production-ready, sandboxed, and wired to any LLM in minutes.
Integrates with Google AI Studio/Gemini API for PDF to Markdown conversion and content generation.
Anchor Browser (https://anchorbrowser.io) is secure infrastructure for computer-use agents — stealth cloud browsers, authentication, captcha bypass, and a hosted MCP server for Cursor, Claude, and Windsurf.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.




