Claude MCP Starter

Claude MCP Starter

A production-ready MCP server template with built-in tools for file search, web fetching, and data transformation, enabling easy customization for Claude Code and Claude Desktop.

Category
访问服务器

README

Claude MCP Server — Starter Template

A clean, production-quality MCP (Model Context Protocol) server template for Claude Code and Claude Desktop. Includes 3 ready-to-use tool modules and a simple pattern for adding your own in minutes.

MCP is the skill that lets you turn Claude into a custom AI agent for any system. This is the template that shows you how.


What is MCP?

MCP (Model Context Protocol) lets Claude call tools you define on your own machine. When Claude needs to search files, hit an API, or transform data — it sends a JSON-RPC request to your local server, your code runs, and Claude gets the result. Your data never leaves your machine.

Claude Code / Claude Desktop
          │
          │  JSON-RPC over stdio
          ▼
   ┌─────────────────┐
   │   server.py     │   ← MCP server (this repo)
   │   (MCP host)    │
   └────────┬────────┘
            │
     ┌──────┼──────┐
     ▼      ▼      ▼
   File    Web    Data
  Search  Fetch  Transform

The protocol is open, vendor-neutral, and supported natively in Claude Code CLI and Claude Desktop. Once you have a working MCP server, every tool you add is instantly available to Claude — no API wrappers, no cloud functions, no rate limits beyond your own.


Included Tools

Tool Module What it does
search_files file_search Glob-search any directory; returns paths, sizes, timestamps
read_file_summary file_search Preview first N lines of a file + metadata and encoding
fetch_url web_fetch HTTP GET or POST — returns status code and response body
extract_links web_fetch Fetch a page, extract all anchor links as a list
json_to_csv data_transform Convert a JSON array of objects to a CSV file
csv_stats data_transform Analyze CSV columns: types, unique values, numeric ranges

Quick Start

1. Clone and install

git clone https://github.com/JustDreameritis/claude-mcp-starter.git
cd claude-mcp-starter
pip install -r requirements.txt

Python 3.10+ required.

2. Configure for Claude Code

Add to your project's .claude/settings.json (or global ~/.claude/settings.json):

{
  "mcpServers": {
    "starter-tools": {
      "command": "python",
      "args": ["/full/path/to/claude-mcp-starter/server.py"]
    }
  }
}

See .claude/settings.json.example in this repo for the full schema.

3. Configure for Claude Desktop

Add to claude_desktop_config.json (location varies by OS):

{
  "mcpServers": {
    "starter-tools": {
      "command": "python",
      "args": ["/full/path/to/claude-mcp-starter/server.py"]
    }
  }
}

See claude_desktop_config.json.example for the full schema.

4. Start a conversation

Restart Claude Code (or Claude Desktop). The tools will appear automatically. Try:

  • "Search for all Python files under /home/me/project"
  • "Fetch https://news.ycombinator.com and extract all links"
  • "Convert this JSON array to a CSV at /tmp/output.csv"

Environment Variables

Copy .env.example to .env and adjust as needed. The server reads these at startup.

Variable Default Description
LOG_LEVEL INFO Logging verbosity (DEBUG, INFO, WARNING, ERROR)
MAX_FILE_SIZE_MB 10 Max file size for read/analyze tools
MAX_FETCH_SIZE_KB 500 Max response body size for fetch_url
ALLOWED_DIRECTORIES /home,/tmp,/mnt Comma-separated root paths file tools may access

All file tool calls are validated against ALLOWED_DIRECTORIES. Attempts to read outside these paths return a permission error — no silent failures.


Project Structure

claude-mcp-starter/
├── server.py                       # MCP server entry point
├── tools/
│   ├── __init__.py
│   ├── file_search.py              # search_files, read_file_summary
│   ├── web_fetch.py                # fetch_url, extract_links
│   └── data_transform.py          # json_to_csv, csv_stats
├── docs/
│   └── SOW-template.md            # Upwork statement-of-work template
├── .claude/
│   └── settings.json.example      # Claude Code configuration template
├── claude_desktop_config.json.example
├── requirements.txt
├── .env.example
├── .gitignore
└── README.md

Adding Your Own Tools

Each tool module follows the same three-part pattern. Creating a new tool takes about 10 minutes.

Step 1 — Create tools/my_tool.py

from mcp.types import Tool, TextContent

MY_TOOLS = [
    Tool(
        name="my_tool_name",
        description="One clear sentence describing what this tool does.",
        inputSchema={
            "type": "object",
            "properties": {
                "param1": {
                    "type": "string",
                    "description": "What this parameter is for.",
                },
                "param2": {
                    "type": "integer",
                    "description": "Optional count. Default: 10.",
                    "default": 10,
                },
            },
            "required": ["param1"],
        },
    ),
]


async def _my_tool_handler(arguments: dict) -> list[TextContent]:
    param1 = arguments.get("param1", "")
    param2 = int(arguments.get("param2", 10))

    if not param1:
        raise ValueError("'param1' is required.")

    # Your logic here
    result = f"Processed '{param1}' with count={param2}."
    return [TextContent(type="text", text=result)]


MY_HANDLERS = {
    "my_tool_name": _my_tool_handler,
}

Step 2 — Register in server.py

from tools.my_tool import MY_TOOLS, MY_HANDLERS

ALL_TOOLS.extend(MY_TOOLS)
TOOL_HANDLERS.update(MY_HANDLERS)

Step 3 — Restart Claude Code

That's it. Your tool is live.


Architecture Notes

Why stdio transport?

MCP servers communicate with Claude via stdin/stdout using JSON-RPC 2.0. Claude Code spawns the server as a subprocess and manages the lifecycle. This means:

  • No network port to open or firewall to configure
  • Server starts and stops with Claude
  • Logs go to stderr (visible in Claude Code's MCP debug output)
  • Multiple MCP servers can run simultaneously without conflicts

Handler dispatch pattern

server.py uses a central dispatch table rather than decorating individual handlers per-tool. This keeps modules independent — each exports a plain dict — and makes it trivial to register, inspect, or disable tools at startup without touching tool code.

Error handling

All tool errors are caught in server.py's call_tool dispatcher and returned as TextContent responses. This means Claude always gets a useful error message instead of a protocol-level failure, and can reason about what went wrong and try an alternative approach.


Running the Server Directly (for debugging)

python server.py

The server will wait for JSON-RPC input on stdin. You can test with raw JSON:

echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | python server.py

Or enable debug logging:

LOG_LEVEL=DEBUG python server.py

Tech Stack

  • Python 3.10+
  • mcp — Anthropic's official MCP SDK
  • httpx — Async HTTP client for web fetch tools
  • chardet — Encoding detection for file tools
  • Standard library only for everything else (csv, json, glob, pathlib)

Security Considerations

  • File tools validate all paths against ALLOWED_DIRECTORIES before any I/O
  • fetch_url enforces a response size cap (MAX_FETCH_SIZE_KB) to prevent memory exhaustion
  • File read tools enforce a file size cap (MAX_FILE_SIZE_MB)
  • HTTP requests use a 15-second timeout
  • No shell execution, no subprocess spawning, no eval

For production team deployments, consider adding per-tool authentication and audit logging.


Freelance / Upwork

Want to offer this as a service? See docs/SOW-template.md for a ready-to-use Statement of Work covering discovery, development, testing, and documentation phases — with tiered pricing from $150 to $800 depending on complexity.

MCP development is an emerging skill with very few practitioners and significant demand as teams start integrating Claude into their internal tooling.


License

MIT — use it, fork it, sell services with it.


Built by JustDreameritis

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选