mcp-data-extractor
The mcp-data-extractor server extracts embedded data and components from TypeScript/JavaScript source code into structured files.
Data Extraction: Extracts data like i18n translations into JSON files, preserving nested structures, arrays, and template variables.
SVG Extraction: Extracts SVG components from React/TypeScript/JavaScript files into individual .svg files, removing React-specific code.
Source File Replacement: Optionally replaces original source files with migration messages to track processed files.
Customization: Supports customizing warning messages and extending supported patterns via Babel AST traversal.
Integration: Easily integrates into MCP Client configurations for automated extraction workflows.
Uses Babel to parse and traverse the AST (Abstract Syntax Tree) of source files for data extraction
Extracts data from JavaScript source code files, including nested objects, string literals, and template literals
Extracts SVG components from React files and removes React-specific code and props
Extracts SVG components from source files and creates individual .svg files with preserved structure and attributes
Extracts data from TypeScript source code files, including nested objects, string literals, and template literals
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-data-extractorextract translations from src/locales/en.ts to src/locales/en.json"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-data-extractor MCP Server
A Model Context Protocol server that extracts embedded data (such as i18n translations or key/value configurations) from TypeScript/JavaScript source code into structured JSON configuration files.
Features
Data Extraction:
Extracts string literals, template literals, and complex nested objects
Preserves template variables (e.g.,
Hello, {{name}}!)Supports nested object structures and arrays
Maintains hierarchical key structure using dot notation
Handles both TypeScript and JavaScript files with JSX support
Replaces source file content with "MIGRATED TO " after successful extraction (configurable)
SVG Extraction:
Extracts SVG components from React/TypeScript/JavaScript files
Preserves SVG structure and attributes
Removes React-specific code and props
Creates individual .svg files named after their component
Replaces source file content with "MIGRATED TO " after successful extraction (configurable)
Related MCP server: @lex-tools/codebase-context-dumper
Usage
Add to your MCP Client configuration:
{
"mcpServers": {
"data-extractor": {
"command": "npx",
"args": [
"-y",
"mcp-data-extractor"
],
"disabled": false,
"autoApprove": [
"extract_data",
"extract_svg"
]
}
}
}Basic Usage
The server provides two tools:
1. Data Extraction
Use extract_data to extract data (like i18n translations) from source files:
<use_mcp_tool>
<server_name>data-extractor</server_name>
<tool_name>extract_data</tool_name>
<arguments>
{
"sourcePath": "src/translations.ts",
"targetPath": "src/translations.json"
}
</arguments>
</use_mcp_tool>2. SVG Extraction
Use extract_svg to extract SVG components into individual files:
<use_mcp_tool>
<server_name>data-extractor</server_name>
<tool_name>extract_svg</tool_name>
<arguments>
{
"sourcePath": "src/components/icons/InspectionIcon.tsx",
"targetDir": "src/assets/icons"
}
</arguments>
</use_mcp_tool>Source File Replacement
By default, after successful extraction, the server will replace the content of the source file with:
"MIGRATED TO " for data extraction
"MIGRATED TO " for SVG extraction
This helps track which files have already been processed and prevents duplicate extraction. It also makes it easy for LLMs and developers to see where the extracted data now lives when they encounter the source file later.
To disable this behavior, set the DISABLE_SOURCE_REPLACEMENT environment variable to true in your MCP configuration:
{
"mcpServers": {
"data-extractor": {
"command": "npx",
"args": [
"-y",
"mcp-data-extractor"
],
"env": {
"DISABLE_SOURCE_REPLACEMENT": "true"
},
"disabled": false,
"autoApprove": [
"extract_data",
"extract_svg"
]
}
}
}Supported Patterns
Data Extraction Patterns
The data extractor supports various patterns commonly used in TypeScript/JavaScript applications:
Simple Object Exports:
export default {
welcome: "Welcome to our app",
greeting: "Hello, {name}!",
submit: "Submit form"
};Nested Objects:
export default {
header: {
title: "Book Your Flight",
subtitle: "Find the best deals"
},
footer: {
content: [
"Please refer to {{privacyPolicyUrl}} for details",
"© {{year}} {{companyName}}"
]
}
};Complex Structures with Arrays:
export default {
faq: {
heading: "Common questions",
content: [
{
heading: "What if I need to change my flight?",
content: "You can change your flight online if:",
list: [
"You have a flexible fare type",
"Your flight is more than 24 hours away"
]
}
]
}
};Template Literals with Variables:
export default {
greeting: `Hello, {{username}}!`,
message: `Welcome to {{appName}}`
};Output Formats
Data Extraction Output
The extracted data is saved as a JSON file with dot notation for nested structures:
{
"welcome": "Welcome to our app",
"header.title": "Book Your Flight",
"footer.content.0": "Please refer to {{privacyPolicyUrl}} for details",
"footer.content.1": "© {{year}} {{companyName}}",
"faq.content.0.heading": "What if I need to change my flight?"
}SVG Extraction Output
SVG components are extracted into individual .svg files, with React-specific code removed. For example:
Input (React component):
const InspectionIcon: React.FC<InspectionIconProps> = ({ title }) => (
<svg className="c-tab__icon" width="40px" id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<title>{title}</title>
<path className="cls-1" d="M18.89,12.74a3.18,3.18,0,0,1-3.24-3.11..." />
</svg>
);Output (InspectionIcon.svg):
<svg width="40px" id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<path class="cls-1" d="M18.89,12.74a3.18,3.18,0,0,1-3.24-3.11..." />
</svg>Extending Supported Patterns
The extractor uses Babel to parse and traverse the AST (Abstract Syntax Tree) of your source files. You can extend the supported patterns by modifying the source code:
Add New Node Types: The
extractStringValuemethod insrc/index.tshandles different types of string values. Extend it to support new node types:
private extractStringValue(node: t.Node): string | null {
if (t.isStringLiteral(node)) {
return node.value;
} else if (t.isTemplateLiteral(node)) {
return node.quasis.map(quasi => quasi.value.raw).join('{{}}');
}
// Add support for new node types here
return null;
}Custom Value Processing: The
processValuemethod handles different value types (strings, arrays, objects). Extend it to support new value types or custom processing:
private processValue(value: t.Node, currentPath: string[]): void {
if (t.isStringLiteral(value) || t.isTemplateLiteral(value)) {
// Process string values
} else if (t.isArrayExpression(value)) {
// Process arrays
} else if (t.isObjectExpression(value)) {
// Process objects
}
// Add support for new value types here
}Custom AST Traversal: The server uses Babel's traverse to walk the AST. You can add new visitors to handle different node types:
traverse(ast, {
ExportDefaultDeclaration(path: NodePath<t.ExportDefaultDeclaration>) {
// Handle default exports
},
// Add new visitors here
});Development
Install dependencies:
npm installBuild the server:
npm run buildFor development with auto-rebuild:
npm run watchDebugging
Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector, which is available as a package script:
npm run inspectorThe Inspector will provide a URL to access debugging tools in your browser.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Available Tools
2 toolsextract_dataA
Extract data content (e.g. i18n translations) from source code to a JSON file. IMPORTANT: When encountering files with data such as i18n content embedded in code, use this tool directly instead of reading the file content first. This tool will programmatically extract all translations into a structured JSON file, preserving nested objects, arrays, template variables, and formatting. This helps keep translations as configuration and prevents filling up the AI context window with translation content. By default, the source file will be replaced with "MIGRATED TO " and a warning message after successful extraction, making it easy to track where the data was moved to. This behaviour can be disabled by setting the DISABLE_SOURCE_REPLACEMENT environment variable to 'true'. The warning message can be customized by setting the WARNING_MESSAGE environment variable.
| Name | Required | Description | Default |
|---|---|---|---|
| sourcePath | Yes | Path to the source file containing data inside code | |
| targetPath | Yes | Path where the resulting JSON file should be written |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description fully discloses behavioral traits: it states the source file will be replaced with a 'MIGRATED TO ...' message and that this can be disabled via environment variable. It also mentions customizing the warning message. This gives the agent clear expectations of side effects.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is slightly longer but every sentence is purposeful: it explains the core action, usage directive, benefits, side effects, and configuration. It is front-loaded and well-structured, though could be slightly trimmed without losing value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema and a tool with side effects, the description covers usage, behavior, and configuration. It explains what happens after extraction (file replacement) and how to control it. It could explicitly mention the return value (the JSON file written) but it is implied.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with clear descriptions. The description adds minimal semantic value beyond the schema; it repeats the purpose but does not provide new details about parameter formats or constraints. Baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Clearly states it extracts data content (e.g., i18n translations) from source code to a JSON file. The verb 'extract' and resource 'data content from source code to JSON file' are specific, and it distinguishes from sibling 'extract_svg' by focusing on code data rather than SVG.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides explicit usage guidance: 'When encountering files with data such as i18n content embedded in code, use this tool directly instead of reading the file content first.' It explains why (prevents filling context window) but does not explicitly mention when not to use or alternatives.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
extract_svgA
Extract SVG components from React/TypeScript/JavaScript files into individual .svg files. This tool will preserve the SVG structure and attributes while removing React-specific code. By default, the source file will be replaced with "MIGRATED TO " and a warning message after successful extraction, making it easy to track where the SVGs were moved to. This behaviour can be disabled by setting the DISABLE_SOURCE_REPLACEMENT environment variable to 'true'. The warning message can be customized by setting the WARNING_MESSAGE environment variable.
| Name | Required | Description | Default |
|---|---|---|---|
| sourcePath | Yes | Path to the source file containing SVG components | |
| targetDir | Yes | Directory where the SVG files should be written |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Discloses key behavior: source file replacement by default and ability to disable/customize via environment variables. With no annotations, the description carries full burden; it could be more comprehensive (e.g., what happens if target directory doesn't exist, handling of multiple SVGs).
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Five sentences are well-structured, front-loaded with purpose, then preservation, then default behavior and customization options. No redundant information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema, no annotations, and 2 params, the description is fairly complete but lacks mention of return values or failure modes. Could also note if it handles one or multiple SVGs per file.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Input schema has 100% coverage with clear param descriptions. The description adds minimal extra meaning beyond what schema already provides (e.g., implying sourcePath is a code file). Baseline of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'Extract' and the resource 'SVG components from React/TypeScript/JavaScript files' with output to 'individual .svg files'. It distinguishes from the sibling tool 'extract_data' by specifying 'SVG components'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides clear context for when to use (extract SVGs from code files) and details about default source file replacement and environment variables to control behavior. However, it doesn't explicitly mention when not to use or compare with alternatives.
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. Dates show when Glama detected each change.
2 tool updates
- First observed
extract_data - First observed
extract_svg
TDQS
The two tools have clearly distinct purposes: extract_data focuses on extracting i18n translations and similar data from source code into JSON files, while extract_svg specifically handles SVG components from React/TypeScript/JavaScript files into individual SVG files. There is no overlap in functionality, and an agent can easily distinguish between them based on their descriptions.
Both tools follow a consistent verb_noun pattern with 'extract_' as the prefix, followed by the target resource (data or svg). This naming convention is predictable and makes it easy to understand the tool's purpose at a glance.
With only 2 tools, the server feels thin for a data extraction domain that could include operations like validate, transform, or merge extracted data. While the tools are well-defined, the limited count suggests incomplete coverage of potential extraction workflows, making it harder for agents to handle complex tasks.
The server covers extraction for specific file types (i18n data and SVGs) but lacks tools for other common extraction scenarios (e.g., images, CSS, or general text). There are no tools for validating, updating, or managing extracted data, creating significant gaps that could lead to agent failures in broader data extraction tasks.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
A Model Context Protocol server for Wix AI tools
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP Spec Compliance MCP — audits any MCP server.json against the official Model Context Protocol
A Model Context Protocol (MCP) server for Selise Blocks Cloud integration
Related MCP Servers
- AlicenseBqualityDmaintenanceA server based on Model Context Protocol that parses Swagger/OpenAPI documents and generates TypeScript types and API client code for different frameworks (Axios, Fetch, React Query).121616ISC
- AlicenseAqualityDmaintenanceA Model Context Protocol (MCP) server designed to easily dump your codebase context into Large Language Models (LLMs).1123Apache 2.0
- FlicenseBqualityDmaintenanceA basic TypeScript implementation of the Model Context Protocol (MCP) server designed as a starting point for MCP development. Provides a minimal foundation for building custom MCP servers with stdio configuration for local integration with VS Code and GitHub Copilot.1-
- FlicenseBqualityCmaintenanceA Model Context Protocol server that builds and queries a config-aware code graph with support for conditional compilation (#ifdef) filtering, enabling context-aware code analysis across different build configurations.9-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/sammcj/mcp-data-extractor'
If you have feedback or need assistance with the MCP directory API, please join our Discord server