@tiangong-lca/mcp-server 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,8 +4,7 @@ import { regOpenLcaResources } from '../resources/lca_calculation.js';
4
4
  import { regOpenLcaLciaTool } from '../tools/openlca_ipc_lcia.js';
5
5
  import { regOpenLcaListLCIAMethodsTool } from '../tools/openlca_ipc_lcia_methods_list.js';
6
6
  import { regOpenLcaListSystemProcessTool } from '../tools/openlca_ipc_process_list.js';
7
- import { getTokenType } from './auth_middleware.js';
8
- export function initializeServer(bearerKey, xApiKey) {
7
+ export function initializeServer() {
9
8
  const server = new McpServer({
10
9
  name: 'TianGong-LCA-MCP-Server',
11
10
  version: '1.0.0',
@@ -17,7 +16,6 @@ export function initializeServer(bearerKey, xApiKey) {
17
16
  regOpenLcaResources(server);
18
17
  return server;
19
18
  }
20
- export function getServer(bearerKey) {
21
- const tokenType = bearerKey ? getTokenType(bearerKey) : '';
22
- return initializeServer(tokenType !== 'supabase' ? undefined : bearerKey, tokenType !== 'supabase' ? bearerKey : undefined);
19
+ export function getServer() {
20
+ return initializeServer();
23
21
  }
@@ -1,40 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
3
3
  import express from 'express';
4
- import { authenticateRequest } from './_shared/auth_middleware.js';
5
4
  import { getServer } from './_shared/init_server_http_local.js';
6
- const authenticateBearer = async (req, res, next) => {
7
- const authHeader = req.headers.authorization;
8
- if (!authHeader || !authHeader.startsWith('Bearer ')) {
9
- res.status(401).json({
10
- jsonrpc: '2.0',
11
- error: {
12
- code: -32001,
13
- message: 'Missing or invalid authorization header',
14
- },
15
- id: null,
16
- });
17
- return;
18
- }
19
- const bearerKey = authHeader.substring(7).trim();
20
- const authResult = await authenticateRequest(bearerKey);
21
- if (!authResult || !authResult.isAuthenticated) {
22
- res.status(403).json({
23
- jsonrpc: '2.0',
24
- error: {
25
- code: -32002,
26
- message: authResult?.response || 'Forbidden',
27
- },
28
- id: null,
29
- });
30
- return;
31
- }
32
- req.bearerKey = bearerKey;
33
- next();
34
- };
35
5
  const app = express();
36
- app.set('trust proxy', 1);
37
- app.use(express.json());
38
6
  app.use((req, res, next) => {
39
7
  res.header('Access-Control-Allow-Origin', '*');
40
8
  res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
@@ -45,9 +13,9 @@ app.use((req, res, next) => {
45
13
  }
46
14
  next();
47
15
  });
48
- app.post('/mcp', authenticateBearer, async (req, res) => {
16
+ app.post('/mcp', async (req, res) => {
49
17
  try {
50
- const server = getServer(req.bearerKey);
18
+ const server = getServer();
51
19
  const transport = new StreamableHTTPServerTransport({
52
20
  sessionIdGenerator: undefined,
53
21
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiangong-lca/mcp-server",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "TianGong LCA MCP Server",
5
5
  "license": "MIT",
6
6
  "author": "Nan LI",