Spec3 MCP Server

Spec3 MCP Server

A demonstration MCP server for local development and testing with Claude Desktop on WSL. Provides basic utility tools including greeting messages, echo functionality, and server information retrieval.

Category
访问服务器

README

Spec3 MCP Server

A Model Context Protocol (MCP) server built with FastMCP for local development and testing with Claude Desktop on WSL.

Overview

This MCP server provides a set of tools and utilities that can be used by Claude Desktop through the MCP protocol. It's designed to run locally on your WSL machine and connect to Claude Desktop via stdio.

Features

  • Modern Python Project Structure: Uses pyproject.toml and follows Python packaging best practices
  • FastMCP Integration: Built on the FastMCP framework for easy MCP protocol handling
  • Multiple Tools: Includes basic demonstration and utility tools
  • Comprehensive Logging: Detailed logging for debugging and monitoring
  • Type Hints: Full type annotation support for better development experience
  • WSL Compatible: Runs seamlessly on WSL and connects to Claude Desktop

Available Tools

  1. hello_world: Returns a simple greeting message
  2. echo_message: Echoes back a message with additional formatting
  3. get_server_info: Returns comprehensive server information and capabilities
  4. list_available_tools: Lists all available tools with descriptions

Installation

Prerequisites

  • Python 3.10 or higher
  • WSL (Windows Subsystem for Linux)
  • Claude Desktop (installed on Windows)

Setup

  1. Navigate to the project directory:

    cd /home/dhevb/workspaces/spec3-mcp-server
    
  2. Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate
    
  3. Install the package in development mode:

    pip install -e .
    

    This will install the package and all its dependencies, including FastMCP.

  4. Verify the installation:

    spec3-mcp-server --help
    

Connecting to Claude Desktop

Configure Claude Desktop on Windows

  1. Locate your Claude Desktop config file:

    • On Windows, it's typically at: %APPDATA%\Claude\claude_desktop_config.json
    • Full path is usually: C:\Users\YourUsername\AppData\Roaming\Claude\claude_desktop_config.json
  2. Edit the configuration file and add the following:

    {
      "mcpServers": {
        "spec3-mcp-server": {
          "command": "wsl",
          "args": [
            "-e",
            "/home/dhevb/workspaces/spec3-mcp-server/venv/bin/python",
            "/home/dhevb/workspaces/spec3-mcp-server/src/spec3_mcp_server/main.py"
          ],
          "env": {}
        }
      }
    }
    

    Note: The wsl command allows Claude Desktop on Windows to execute Python in your WSL environment.

  3. Restart Claude Desktop to load the new configuration

  4. Verify the connection:

    • Open Claude Desktop
    • Start a new conversation
    • Look for the MCP tools icon or hammer icon
    • You should see the spec3-mcp-server tools available

Alternative: Using Installed Command

If you prefer to use the installed spec3-mcp-server command:

{
  "mcpServers": {
    "spec3-mcp-server": {
      "command": "wsl",
      "args": [
        "-e",
        "/home/dhevb/workspaces/spec3-mcp-server/venv/bin/spec3-mcp-server"
      ]
    }
  }
}

Testing the Server

Test Locally (Without Claude Desktop)

You can test the server locally to ensure it's working:

# Activate your virtual environment
source venv/bin/activate

# Run the server directly
python src/spec3_mcp_server/main.py

The server will start and wait for MCP messages on stdin. You can verify it's running if you see the startup logs.

Test with Claude Desktop

Once connected to Claude Desktop, you can test the tools by asking Claude to use them:

  • "Use the hello_world tool"
  • "Echo this message: Hello from WSL!"
  • "Get server information"
  • "List all available tools"

Development

Project Structure

spec3-mcp-server/
├── src/
│   └── spec3_mcp_server/
│       ├── __init__.py          # Package initialization
│       ├── main.py              # Main entry point
│       ├── server.py            # MCP server implementation
│       └── http_server.py       # HTTP server (for network access)
├── tests/                       # Test files (to be added)
├── pyproject.toml              # Project configuration
├── README.md                   # This file
├── claude_desktop_config.json  # Example config for Claude Desktop
└── .gitignore                  # Git ignore rules

Adding New Tools

To add new tools to the MCP server:

  1. Edit src/spec3_mcp_server/server.py
  2. Add a new tool function decorated with @mcp.tool()
  3. Add proper type hints and docstring

Example:

@mcp.tool()
async def my_new_tool(param: str) -> str:
    """
    Description of what this tool does.

    Args:
        param: Description of the parameter

    Returns:
        str: Description of the return value
    """
    logger.info(f"my_new_tool called with: {param}")
    return f"Processed: {param}"
  1. Reinstall the package (if needed):

    pip install -e .
    
  2. Restart Claude Desktop to load the updated tools

Code Quality

The project includes configuration for:

  • Black: Code formatting
  • isort: Import sorting
  • mypy: Type checking
  • ruff: Linting
  • pytest: Testing

Run quality checks:

# Format code
black src/

# Sort imports
isort src/

# Type checking
mypy src/

# Linting
ruff check src/

# Run tests (when added)
pytest

Troubleshooting

Common Issues

  1. Server won't start:

    • Check that Python 3.10+ is installed in WSL: python --version
    • Ensure FastMCP is installed: pip install fastmcp
    • Verify virtual environment is activated: which python
  2. Claude Desktop can't connect:

    • Verify the paths in claude_desktop_config.json are correct
    • Check that WSL is accessible from Windows
    • Look at Claude Desktop's logs for connection errors
    • Test the server manually in WSL first
  3. Tools not appearing:

    • Restart Claude Desktop after configuration changes
    • Check server logs for errors
    • Verify the server is running: ps aux | grep spec3-mcp-server
  4. WSL-specific issues:

    • Ensure WSL is properly installed: wsl --version
    • Test WSL execution from Windows CMD: wsl -e python --version
    • Check WSL distro is running: wsl -l -v

Logging

The server includes comprehensive logging. Check the console output for:

  • Server startup messages
  • Tool execution logs
  • Error messages and stack traces

To see logs when running via Claude Desktop, you can redirect them to a file by modifying the config:

{
  "mcpServers": {
    "spec3-mcp-server": {
      "command": "wsl",
      "args": [
        "-e",
        "/bin/bash",
        "-c",
        "/home/dhevb/workspaces/spec3-mcp-server/venv/bin/python /home/dhevb/workspaces/spec3-mcp-server/src/spec3_mcp_server/main.py 2>> /home/dhevb/workspaces/spec3-mcp-server/mcp-server.log"
      ]
    }
  }
}

Getting Help

If you encounter issues:

  1. Check the server logs for error messages
  2. Verify your Python and FastMCP versions
  3. Test the server independently before connecting to Claude Desktop
  4. Check the FastMCP documentation at https://github.com/jlowin/fastmcp
  5. Review Claude Desktop's documentation for MCP configuration

Next Steps

Once you have the local server working:

  1. Add more sophisticated tools for your specific use cases
  2. Implement error handling for robust operation
  3. Add tests to ensure reliability
  4. Explore advanced MCP features like resources and prompts
  5. Consider adding environment variables for configuration

License

MIT License - see LICENSE file for details.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选