added mcp server file
This commit is contained in:
29
mcp_server.py
Normal file
29
mcp_server.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
from pathlib import Path
|
||||||
|
import json
|
||||||
|
from mcp.server.fastmcp import FastMCP
|
||||||
|
|
||||||
|
MCP_ROOT = Path(__file__).resolve().parent / "mcp"
|
||||||
|
|
||||||
|
mcp = FastMCP("aetoskia-mail-intake-docs")
|
||||||
|
|
||||||
|
|
||||||
|
@mcp.resource("docs://index")
|
||||||
|
def index():
|
||||||
|
return json.loads((MCP_ROOT / "index.json").read_text())
|
||||||
|
|
||||||
|
|
||||||
|
@mcp.resource("docs://nav")
|
||||||
|
def nav():
|
||||||
|
return json.loads((MCP_ROOT / "nav.json").read_text())
|
||||||
|
|
||||||
|
|
||||||
|
@mcp.resource("docs://module/{module}")
|
||||||
|
def module(module: str):
|
||||||
|
path = MCP_ROOT / "modules" / f"{module}.json"
|
||||||
|
if not path.exists():
|
||||||
|
raise FileNotFoundError(module)
|
||||||
|
return json.loads(path.read_text())
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
mcp.run()
|
||||||
@@ -2,6 +2,7 @@ beautifulsoup4==4.12.0
|
|||||||
google-api-python-client==2.187.0
|
google-api-python-client==2.187.0
|
||||||
google-auth-oauthlib==1.2.3
|
google-auth-oauthlib==1.2.3
|
||||||
types-beautifulsoup4
|
types-beautifulsoup4
|
||||||
|
mcp==1.25.0
|
||||||
|
|
||||||
# Test Packages
|
# Test Packages
|
||||||
pytest==7.4.0
|
pytest==7.4.0
|
||||||
|
|||||||
Reference in New Issue
Block a user