mcp_server
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"naver-search-docs": {
"args": [
"-m",
"src.mcp_server"
],
"command": "python",
"cwd": "/Users/yanghyojun/Desktop/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.
pip install -r requirements.txt
2.
API
src/utils/naver_search.py API :
NAVER_CLIENT_ID = 'your_client_id'
NAVER_CLIENT_SECRET = 'your_client_secret'
Google Cloud
src/utils/gemini.py Google Cloud :
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "/path/to/your/credentials.json"
1: FastAPI ()
1. FastAPI
cd /Users/yanghyojun/Desktop/mcp_server
python -m src.main
uvicorn :
uvicorn src.main:app --reload --host 0.0.0.0 --port 8001
http://localhost:8001 .
2. API
** API **
curl -X POST "http://localhost:8001/search" \
-H "Content-Type: application/json" \
-d '{"query": "Python "}'
{
"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 /: APIGET /health:
3.
python tests/test_api.py
2:
MCP , FastAPI HTTP
1: MCP (8001 )
cd /Users/yanghyojun/Desktop/mcp_server
python -m src.main
2: HTTP
# 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
python -m src.mcp_server
Claude Desktop MCP :
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"naver-search-docs": {
"command": "python",
"args": ["-m", "src.mcp_server"],
"cwd": "/Users/yanghyojun/Desktop/mcp_server"
}
}
}
MCP
1.
src/tools/ :
# 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 :
from .my_new_tool import MyNewTool
__all__ = [
"SearchDocsTool",
"MyNewTool", #
]
3. MCP
src/mcp_server.py TOOLS :
from .tools import SearchDocsTool, MyNewTool
TOOLS = [
SearchDocsTool,
MyNewTool, #
]
FastAPI
- FastAPI MCP subprocess
- MCP stdio MCP
- REST API
- MCP MCP
- MCP API ( 30 )
- Gemini AI
- FastAPI JSON
MCP
- Claude Desktop MCP MCP
- API
- Gemini AI
- AI
- , URL,
MIT