Skip to content

Commit b02a9e9

Browse files
committed
feat(solana): add separate server for pumpfun tools
1 parent 5e38f79 commit b02a9e9

File tree

6 files changed

+51
-2
lines changed

6 files changed

+51
-2
lines changed

main_pumpfun.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import logging
2+
import os
3+
import sys
4+
5+
# Add src to Python path so internal imports work
6+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src"))
7+
8+
import src.servers.pumpfun.tools
9+
from src.common.logger import setup_file_logging
10+
from src.servers.pumpfun.server import mcp
11+
12+
13+
def main():
14+
setup_file_logging(filename="mcp-pumpfun-server.log", level=logging.INFO)
15+
mcp.run()
16+
17+
18+
if __name__ == "__main__":
19+
main()

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ dependencies = [
1818
[project.scripts]
1919
mcp-evm = "main_evm:main"
2020
mcp-solana = "main_solana:main"
21+
mcp-pumpfun = "main_pumpfun:main"
2122

2223
[tool.setuptools]
23-
py-modules = ["main_evm", "main_solana"]
24+
py-modules = ["main_evm", "main_solana", "main_pumpfun"]
2425

2526
[tool.setuptools.packages.find]
2627
where = ["."]

src/servers/pumpfun/server.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from servers.pumpfun.tool_registry import mcp
2+
3+
# Export the mcp instance
4+
__all__ = ["mcp"]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from mcp.server.fastmcp import FastMCP
2+
3+
# Global MCP instance
4+
mcp = FastMCP("PumpFunMCP")
5+
6+
7+
def get_mcp_server():
8+
return mcp
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# src/servers/pumpfun/tools/__init__.py
2+
import importlib
3+
import pkgutil
4+
5+
__all__ = []
6+
7+
# Force import all modules to ensure tool registration
8+
for mod in pkgutil.iter_modules(__path__):
9+
try:
10+
module = importlib.import_module(f"{__name__}.{mod.name}")
11+
globals()[mod.name] = module
12+
__all__.append(mod.name)
13+
14+
# Log successful import for debugging
15+
print(f"Successfully imported Solana tool module: {mod.name}")
16+
except ImportError as e:
17+
print(f"Failed to import Solana tool module {mod.name}: {e}")

src/servers/solana/tools/pumpfun_utilities.py renamed to src/servers/pumpfun/tools/pumpfun_utilities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from solders.pubkey import Pubkey
88

99
from common.utils import _err, _ok
10-
from servers.solana.tool_registry import mcp
10+
from servers.pumpfun.tool_registry import mcp
1111

1212
LAMPORTS_PER_SOL = 1_000_000_000
1313
TOKEN_DECIMALS = 6

0 commit comments

Comments
 (0)