# mcp_server
## 基本信息
- Slug: `hyojun6-mcp_server`
- Source: modelscope
- Publisher: @hyojun6/mcp_server
- Categories: search / rag-systems / documentation-access
- Hosted: No
- License: Unknown
- Source URL: https://www.modelscope.cn/mcp/servers/@hyojun6/mcp_server
## 简介
暂无描述。
## 安装提示

```bash
mcp_server/ src/ __init__.py main.py # FastAPI mcp_client.py # MCP mcp_server.py # MCP tools/ # MCP __init__.py search_docs.py # utils/ # __init__.py gemini.py # Gemini AI naver_search.py # tests/ test_api.py # API docs/ # ai_deps # Gemini search_deps # requirements.txt # Python pyproject.toml # README.md # .gitignore # Git
```

## MCP Server 详情

# Naver Search Docs MCP Server

  API Gemini AI       MCP(Model Context Protocol)   FastAPI .

## 

-   API    
- Gemini AI       
-   URL  
- FastAPI  REST API 
-   MCP  

##  

```
mcp_server/
 src/
    __init__.py
    main.py              # FastAPI 
    mcp_client.py        # MCP 
    mcp_server.py        # MCP  
    tools/               # MCP 
       __init__.py
       search_docs.py   #  
    utils/               #  
        __init__.py
        gemini.py        # Gemini AI 
        naver_search.py  #   
 tests/
    test_api.py          # API 
 docs/                    #  
    ai_deps              # Gemini  
    search_deps          #    
 requirements.txt         # Python 
 pyproject.toml          #  
 README.md               #  
 .gitignore              # Git  
```

##  

### 1.  
```bash
pip install -r requirements.txt
```

### 2.  

####  API  
`src/utils/naver_search.py`   API   :
```python
NAVER_CLIENT_ID = 'your_client_id'
NAVER_CLIENT_SECRET = 'your_client_secret'
```

#### Google Cloud 
`src/utils/gemini.py`  Google Cloud      :
```python
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "/path/to/your/credentials.json"
```

##  

###  1: FastAPI   ()

#### 1. FastAPI  
```bash
cd /Users/yanghyojun/Desktop/mcp_server
python -m src.main
```

 uvicorn  :
```bash
uvicorn src.main:app --reload --host 0.0.0.0 --port 8001
```

 **http://localhost:8001**  .

#### 2. API 

** API **
```bash
curl -X POST "http://localhost:8001/search" \
  -H "Content-Type: application/json" \
  -d '{"query": "Python  "}'
```

** **
```json
{
  "result": "'Python  '    :\n\n1. Python  \n   URL: https://docs.python.org/ko/3/\n   : Python    ...\n\n",
  "query": "Python  "
}
```

**API **
- Swagger UI: http://localhost:8001/docs
- ReDoc: http://localhost:8001/redoc

** **
- `GET /`: API  
- `GET /health`:  

#### 3.  
```bash
python tests/test_api.py
```

---

###  2:    

MCP   ,  FastAPI  HTTP  

#### 1: MCP   (8001 )
```bash
cd /Users/yanghyojun/Desktop/mcp_server
python -m src.main
```

#### 2:   HTTP  

```python
#  FastAPI  
import httpx
from fastapi import HTTPException

@app.post("/search-docs")
async def search_official_docs(query: str):
    """  """
    try:
        async with httpx.AsyncClient() as client:
            response = await client.post(
                "http://localhost:8001/search",
                json={"query": query},
                timeout=30.0
            )
            response.raise_for_status()
            return response.json()
    except httpx.RequestError as e:
        raise HTTPException(status_code=503, detail=f"MCP   : {str(e)}")
```

---

###  3: MCP   

```bash
python -m src.mcp_server
```

Claude Desktop  MCP     :

**MacOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`

```json
{
  "mcpServers": {
    "naver-search-docs": {
      "command": "python",
      "args": ["-m", "src.mcp_server"],
      "cwd": "/Users/yanghyojun/Desktop/mcp_server"
    }
  }
}
```

##  MCP  

### 1.   
`src/tools/`     :

```python
# src/tools/my_new_tool.py
from typing import Any, List
from mcp import types

class MyNewTool:
    """  """

    @staticmethod
    def get_tool_definition() -> types.Tool:
        """  """
        return types.Tool(
            name="my_new_tool",
            description=" ",
            inputSchema={
                "type": "object",
                "properties": {
                    "param": {
                        "type": "string",
                        "description": " "
                    }
                },
                "required": ["param"]
            }
        )

    @staticmethod
    async def execute(arguments: dict[str, Any]) -> List[types.TextContent]:
        """ """
        #   
        return [types.TextContent(
            type="text",
            text=""
        )]
```

### 2.  
`src/tools/__init__.py` :
```python
from .my_new_tool import MyNewTool

__all__ = [
    "SearchDocsTool",
    "MyNewTool",  # 
]
```

### 3. MCP  
`src/mcp_server.py` `TOOLS`  :
```python
from .tools import SearchDocsTool, MyNewTool

TOOLS = [
    SearchDocsTool,
    MyNewTool,  # 
]
```

##  

### FastAPI   
1. FastAPI    MCP  subprocess 
2. MCP  stdio  MCP  
3.  REST API  
4. MCP  MCP   
5. MCP    API   ( 30 )
6.   Gemini AI    
7.  FastAPI  JSON 

### MCP    
1. Claude Desktop  MCP  MCP  
2.   
3.   API    
4.   Gemini AI 
5. AI    
6.   , URL,  

## 

MIT

